Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] How can I just compile an existing TeX document? #350

Open
MartinThoma opened this issue Mar 30, 2022 · 2 comments
Open

[Question] How can I just compile an existing TeX document? #350

MartinThoma opened this issue Mar 30, 2022 · 2 comments

Comments

@MartinThoma
Copy link

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?

@marijnschraagen
Copy link

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.

@mmarras
Copy link

mmarras commented Sep 1, 2022

Possible duplicate of #321

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants