invoke external program
What is the proper way to call external applications in my programs? Specifically, pdfLaTeX compiler. When I invoke os.system("pdflatex foo.tex")
in Sage's CLI console, the command executes as expected. However, when I embedded this into my code and run this code, TeX asks for another input:
This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
* [blinking cursor here]
Am I missing something or why doesn't this work?
P. S. My original post may have been confusing. When I wrote:
However, when I embedded this into my code and run this code,
I meant embedding into "my_code.sage" source code, which is consequently attached and run in Sage's CLI.
P. P. S. When use it in my "foo.sage" code as below:
os.system("pdflatex -interaction=batchmode foo.tex")
following log is produced:
(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
! Emergency stop.
<*> /tmp/foo.tex
*** (job aborted, no legal \end found)
However, written explicitly in Sage's console and even in bash console, everything compiles correctly. Does this mean something? Just FYI, I did end my source file with \end{document}
Your file "foo.tex" is in /tmp, right? That's where pdflatex is looking for it.
Yes, right, it is. I've already found out the cause of problem - I'm gonna write the solution in a few minutes...