How can I convert a .tex file to a PDF via the command line?

At the command line, first install the texlive package if it isn't already installed:

sudo apt-get install texlive

Then use the pdflatex utility to convert the file like this:

pdftex /path/to/myfile.tex

The path /path/to/myfile.tex is, of course, an example path. You would put the path to your own file on your system.

Notice that although the utility is called pdflatex you execute it with the command pdftex (without the la).

There are several settings that you can read about in the help for pdflatex:

pdflatex --help

The setting I use the most is the one to generate the pdf in a different directory:

pdflatex --output-directory=../otherdir /path/to/myfile.tex

The pdflatex utility is also interactive, so that if you forget to supply necessary information it will prompt you to enter it before converting the file.


As far as I know, you won't find a single standalone binary that will do this for you. The typical utility is called pdflatex and is part of the TeX Live package. It's in the repositories, so simply opening the terminal and typing the below will install pdflatex and lots of other essential TeX stuff:

sudo apt-get install texlive

You should try rubber. It is a command-line tool to handle all the tasks associated with compiling TeX documents into pdf, dvi, etc.

Tags:

Pdf

Latex