[Question] How can I just compile an existing TeX document?
MartinThoma opened this issue · comments
I am currently looking at different options to generate nice PDF documents. I like the approach of PyLaTeX and I wondered if one can use PyLaTeX to compile an existing TeX document.
I could also do something like this:
import os
os.system("pdflatex thedoc.tex")
But then I might need to deal with intermediate files (log / aux / ...) and having to re-run (e.g. for bibtex / indices / references).
Is it possible to compile an existing TeX document via PyLaTeX? Where are limitations?
PyLaTeX itself uses Latexmk for compiling (see https://mg.readthedocs.io/latexmk.html). This is a build tool that automatically performs reruns if needed, runs bibtex etc., and can clean up temporary files afterwards. You can use Latexmk with the relevant options via os.system("latexmk thedoc.tex")
. Of course you can also bypass Python and run Latexmk directly from any programming language/toolchain/shell script that fits the use case.
Possible duplicate of #321