latex
Compile LaTeX documents into PDF or other formats
TLDR
Compile a DVI document
Compile a DVI document, specifying an output directory
Compile a DVI document, exiting on each error
SYNOPSIS
latex [OPTION]... [TEXFILE[.tex]]
PARAMETERS
-file-line-error
Print errors in source file:line format
-halt-on-error
Stop processing at first error
-help
Display help and exit
-ini
Enable iniTeX mode (dump formats)
-interaction=mode
Set interaction mode: errorstopmode, scrollmode, nonstopmode, batchmode
-jobname=string
Set main file name
-kpathsea-debug=number
Set Kpathsea debug flags
-mktexfmt
Enable mktexfmt (create formats)
-mktexpk
Enable mktexpk (PK fonts)
-mktextex
Enable mktextex (TeX fonts)
-no-mktexfmt
Disable mktexfmt
-output-comment=string
Set output DVI comment
-output-directory=dir
Output files to dir
-output-format=format
Use format for output (dvi default)
-parse-first-line
Parse first line for %&format
-papersize=string
Override paper size
-pool-size=number
Set pool size
-progname=string
Set program name
-recorder
Enable file dependency recording
-shell-escape
Enable shell commands from document
-src-specials
Embed source file info in DVI
-translate-file=targ src
Translation file
-version
Show version and exit
DESCRIPTION
The latex command is a high-level TeX formatter for processing LaTeX documents. It takes a .tex source file as input and produces a Device Independent (DVI) output file, suitable for printing or conversion to other formats like PDF via tools such as dvipdf or dvips. LaTeX extends plain TeX with macros for easier document structuring, including sections, bibliographies, indexes, figures, tables, and complex mathematics.
Usage typically involves multiple runs: first to generate auxiliary files (.aux, .toc), second (and possibly more) to resolve cross-references, citations, and page numbers. Errors are reported interactively unless -interaction=batchmode is used. It relies on the underlying TeX engine (often pdfTeX) with the latex.fmt format preloaded.
Essential for academic papers, theses, books, and technical reports, latex ensures consistent typography. Install via TeX Live or MiKTeX. For direct PDF output, prefer pdflatex. Supports packages via \usepackage for extensions like graphics (graphicx) or hyperlinks (hyperref).
CAVEATS
Produces DVI only; use pdflatex for PDF. Multiple runs often needed for references. Requires full TeX distribution. Shell escape risky for untrusted files.
EXAMPLES
latex document.tex
latex document (second run for TOC)
latex --interaction=nonstopmode document.tex
OUTPUT FILES
document.dvi (main), .aux, .log, .toc, .lof, .lot
HISTORY
Developed by Leslie Lamport in 1985 atop Donald Knuth's TeX (1978). Evolved through LaTeX 2.09, LaTeX2e (1994, current standard). Integrated into TeX Live distributions since 1990s.


