28 Command line interface

Synopsis (from a terminal command line):

pdflatex options argument

Run LaTeX on argument. In place of pdflatex you can also use (for PDF output) xelatex or lualatex, or (for DVI output) latex or dvilualatex, among others (see TeX engines).

For example, this will run LaTeX on the file thesis.tex, creating the output thesis.pdf.

pdflatex thesis

Note that .tex is the default file name extension.

pdfTeX is an extension of the original TeX program, as are XeTeX and LuaTeX (see TeX engines). The first two are completely backward compatible and the latter, almost so. Perhaps the most fundamental new feature for all three is that the original TeX output its own DVI format, while the newer ones can output directly to PDF. This allows them to take advantage of the extra features in PDF such as hyperlinks, support for modern image formats such as JPG and PNG, and ubiquitous viewing programs. In short, if you run pdflatex or xelatex or lualatex then you will by default get PDF and have access to all its modern features. If you run latex, or dvilualatex, then you will get DVI. The description here assumes pdflatex.

See Command line options, for a selection of the most useful command line options. As to argument, the usual case is that it does not begin with a backslash, so the system takes it to be the name of a file and it compiles that file. If argument begins with a backslash then the system will interpret it as a line of LaTeX input, which can be used for special effects (see Command line input).

If you gave no arguments or options then pdflatex prompts for input from the terminal. You can escape from this by entering CTRL-D.

If LaTeX finds an error in your document then by default it stops and asks you about it. See Recovering from errors, for an outline of what to do.


Unofficial LaTeX2e reference manual