Next: , Up: Command line   [Contents][Index]

28.1 Command line options

These are the command-line options relevant to ordinary document authoring. For a full list, try running ‘latex --help’ from the command line.

With many implementations you can specify command line options by prefixing them with ‘-’ or ‘--’. This is the case for both TeX Live (and MacTeX) and MiKTeX. We will use both conventions interchangeably.


Show the current version, like ‘pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian)’ along with a small amount of additional information, and exit.


Give a brief usage message that is useful as a prompt and exit.


TeX compiles a document in one of four interaction modes: batchmode, nonstopmode, scrollmode, errorstopmode. In errorstop mode (the default), TeX stops at each error and asks for user intervention. In batch mode it prints nothing on the terminal, errors are scrolled as if the user hit <return> at every error, and missing files cause the job to abort. In nonstop mode, diagnostic message appear on the terminal but as in batch mode there is no user interaction. In scroll mode, TeX only stops for missing files or keyboard input.

For instance, starting LaTeX with this command line

pdflatex -interaction=batchmode filename

eliminates most terminal output.


Set the value of TeX’s jobname to the string. The log file and output file will then be named string.log and string.pdf.

When you run pdflatex options argument, if argument does not start with a backslash then TeX considers it the name of a file to input. Otherwise it waits for the first \input instruction and the name of the input file will be the job name. This is used to name the log file the output file. The jobname option overrides that process and directly specifies the name. See Command line input for an example of its use.


Write files in the directory directory. It must already exist.


Enable or disable \write18{shell_command} (see \write18). The first two options are for with TeX Live or MacTeX while the second two are for MiKTeX.

Sometimes you want to run external system commands from inside a LaTeX file. For instance the package sagetex allows you to have the mathematics software system Sage do calculations or draw graphs and then incorporate that output in your document. For this TeX provides the \write18 command.

But with this functionality enabled, security issues could happen if you compiled a LaTeX file from the Internet. By default \write18 is disabled. (More precisely, by default TeX Live, MacTeX, and MiKTeX only allow the execution of a limited number of TeX-related programs, which they distribute.)

If you invoke LaTeX with the option no-shell-escape, and in your document you call \write18{ls -l}, then you do not get an error but the log file says ‘runsystem(ls -l)...disabled’.


Stop processing at the first error.


Enable or disable filename:lineno:error-style error messages. These are only available with TeX Live or MacTeX.

Unofficial LaTeX2e reference manual