Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compile Latex file using a python script

I am able to use python script to create a LaTeX file, but I want to take that file and compile it, so it creates a pdf by using a python script. I have seen some things using os and subprocess but I really don't understand it.

like image 518
Alex Avatar asked Oct 19 '15 06:10

Alex


People also ask

Can Python compile LaTeX?

PyLaTeX is a Python library for creating and compiling LaTeX files. The goal of this library is to be an easy, but extensible interface between Python and LaTeX.

How do I compile a LaTeX file?

In order to compile a LaTeX file, simply press \ll while editing the file. This runs latex on the current file and displays the errors in a |quickfix-window| below the file being edited.

How do I compile with TeXworks?

Select the "Editor" tab and check the "Line numbers" box. Click OK. Now at the top of TeXworks you will see a green button. This is the "Compile" button.

How do I compile LaTeX in TeXShop?

In TeXShop, go to the Typeset menu bar, make sure the LaTeX option is checked, and select Typeset, or simply press Command+T. TeXShop will now try to compile your document. If everything is installed correctly, a compiled PDF document will pop up which says, “Congratulations!


1 Answers

Try this out.

  import os  
  os.system("pdflatex mylatex.tex")
like image 78
Riyaz Avatar answered Oct 01 '22 02:10

Riyaz