LinuxCommandLibrary

pdflatex

Compile LaTeX documents into PDF format

TLDR

Compile a PDF document

$ pdflatex [source.tex]
copy

Compile a PDF document specifying an output directory
$ pdflatex -output-directory=[path/to/directory] [source.tex]
copy

Compile a PDF document, exiting on each error
$ pdflatex -halt-on-error [source.tex]
copy

SYNOPSIS

pdflatex [options] texname

PARAMETERS

-draftmode
    Sets draft mode, suppressing picture output.

-file-line-error
    Outputs error messages in file:line:error format.

-halt-on-error
    Exits immediately if an error is encountered.

-interaction=
    Sets the interaction mode. can be 'batchmode', 'nonstopmode', 'scrollmode', or 'errorstopmode'.

-jobname=
    Sets the job name. The output file will be named .pdf.

-output-directory=
    Specifies the output directory.

-ini
    Starts LaTeX in INI mode.

-shell-escape
    Enables shell commands in the LaTeX document (use with caution).

-no-shell-escape
    Disables shell commands in the LaTeX document.

-synctex=
    Enables or disables SyncTeX support. 1 enables, 0 disables.

-version
    Displays the pdflatex version information.

texname
    The name of the LaTeX source file to compile (e.g., document.tex).

DESCRIPTION

pdflatex is a command-line tool used to compile LaTeX source files (typically with the `.tex` extension) into PDF documents. It is a widely used engine for producing high-quality, typeset documents with complex mathematical formulas, cross-references, and bibliographies.

The command reads the LaTeX source, processes the markup commands, and generates a PDF file as output. It supports a wide range of LaTeX packages and configurations, allowing for extensive customization of the document's appearance and content. It implicitly runs `pdftex`, which produces PDF output directly, rather than going through DVI as an intermediate stage. pdflatex is commonly used for scientific papers, books, presentations, and other documents requiring precise typesetting. It can handle features like table of contents generation, index creation, and the inclusion of graphics. pdflatex is a key component of the LaTeX ecosystem, and is fundamental for generating PDFs from LaTeX source code.

CAVEATS

Using the `-shell-escape` option can introduce security risks if the LaTeX document is untrusted, as it allows arbitrary shell commands to be executed. It is generally recommended to avoid using this option unless absolutely necessary and with extreme caution.

Be aware that `pdflatex` can only be run on one `.tex` file at a time.

COMPILATION PROCESS

The pdflatex compilation typically involves several steps.
First, the .tex file is read and parsed.
Then, LaTeX commands are interpreted, and the document is typeset according to the specified formatting.
Finally, the output is generated as a PDF file. If necessary, pdflatex can be run multiple times to resolve cross-references and generate the table of contents and index correctly.

HISTORY

pdflatex evolved from the need to directly produce PDF output from LaTeX documents without relying on intermediate formats like DVI.

It builds upon the `pdfTeX` engine, which was developed to provide this direct PDF generation capability. pdflatex quickly became a standard tool in the LaTeX ecosystem due to its convenience and efficiency in creating PDF documents.

SEE ALSO

latex(1), dvips(1), dvipdfm(1), bibtex(1), makeindex(1)

Copied to clipboard