Next: , Up: Command line interface   [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 (including MacTeX) and MiKTeX. We will use both conventions interchangeably. If an option takes a value, it can be specified either as a separate argument (‘--foo val’), or as one argument with an ‘=’ sign (‘--foo=val’), but there can be no spaces around the ‘=’. We will generally use the ‘=’ syntax.

-version

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.

-help

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

-interaction=mode

TeX compiles a document in one of four interaction modes: batchmode, nonstopmode, scrollmode, errorstopmode. In errorstopmode (the default), TeX stops at each error and asks for user intervention. In batchmode 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 nonstopmode, diagnostic message appear on the terminal but as in batch mode there is no user interaction. In scrollmode, TeX stops for missing files or keyboard input, but nothing else.

For instance, starting LaTeX with this command line

pdflatex -interaction=batchmode filename

eliminates most terminal output.

-jobname=string

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. see Jobname.

-output-directory=directory

Write files in the directory directory. It must already exist. This applies to all external files created by TeX or LaTeX, such as the .log file for the run, the .aux, .toc, etc., files created by LaTeX, as well as the main .pdf or .dvi output file itself.

When specified, the output directory directory is also automatically checked first for any file that it is input, so that the external files can be read back in, if desired. The true current directory (in which LaTeX was run) remains unchanged, and is also checked for input files.

--enable-write18
--disable-write18
--shell-escape
--no-shell-escape

Enable or disable \write18{shell_command} (see \write18). The first two options are supported by both TeX Live and MiKTeX, while the second two are synonyms supported by TeX Live.

Enabling this functionality has major security implications, since it allows a LaTeX file to run any command whatsoever. Thus, by default, unrestricted \write18 is not allowed. (The default for TeX Live, MacTeX, and MiKTeX is to allow the execution of a limited number of TeX-related programs, which they distribute.)

For example, 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’.

-halt-on-error

Stop processing at the first error.

-file-line-error
-no-file-line-error

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


Unofficial LaTeX2e reference manual