To turn a .tex file into a PDF you run a compile command in a terminal. pdflatex, lualatex, xelatex, latex, and the Japanese platex / uplatex are all “LaTeX” — but the command you pick selects the engine underneath, which in turn decides the output format (PDF or DVI) and what fonts and characters you can use. This page is a practical map of each command, plus the options you actually type.
The command name picks the engine
LaTeX is a format (a system of commands); the engine (the program that actually processes it) is a separate thing. The command name names the combination: pdflatex is “the pdfTeX engine + the LaTeX format,” lualatex is “LuaTeX + LaTeX,” and so on. You invoke them all the same way — pass the source file as an argument; the .tex extension is optional.
pdflatex document.tex # → document.pdf, document.aux, document.log
lualatex document # 拡張子は省略可 / extension optional
xelatex document.texRunning a command produces the main output (.pdf or .dvi) plus helper files: an .aux file that accumulates cross-reference and table-of-contents data, a .log of the run, and others. To settle numbering, references, and the contents page you normally run the same command twice (the first pass writes numbers into .aux; the second pass reads them back into the text). Build tools like latexmk automate this multi-pass dance. The full pipeline is covered in “From source to PDF.”
The three that output PDF directly
pdflatex, lualatex, and xelatex all produce a PDF directly. They differ in how they handle Unicode and fonts — and in speed.
pdflatex uses the pdfTeX engine. pdfTeX was Hàn Thế Thành’s extension of TeX during his doctoral work on microtypography (character protrusion into the margin, subtle font expansion); its headline feature was producing PDF directly, skipping the DVI step. It is the oldest of the three, with the best compatibility with existing packages and the fastest compilation. The trade-off: its input is fundamentally byte-oriented, with no native Unicode or system fonts (modern LaTeX accepts UTF-8 input by default, but fonts are limited to TeX’s own).
lualatex uses the LuaTeX engine. It assumes UTF-8 from the start and, via the fontspec package, uses the OpenType/TrueType fonts already installed on your system. Its defining feature is an embedded Lua scripting language that lets you reach into the typesetting process itself. It is promoted as the standard direction for LaTeX; Japanese typesetting is handled by the luatexja package.
xelatex uses the XeTeX engine (developed by Jonathan Kew around 2004). It also supports Unicode and system fonts, but its implementation leans on external libraries and is quite different from LuaTeX. Internally it does not write PDF directly — it produces an extended-DVI .xdv file, which the bundled xdvipdfmx then converts to PDF automatically. Passing -no-pdf stops at the .xdv before that conversion.
| Command | Engine | Output | Unicode / fonts |
|---|---|---|---|
pdflatex | pdfTeX | PDF directly | TeX fonts; fast, great compatibility |
lualatex | LuaTeX | PDF directly | System fonts + Unicode + Lua |
xelatex | XeTeX | PDF (via .xdv internally) | System fonts + Unicode |
The latex command outputs DVI
The plain latex command, in today’s TeX Live, runs the pdfTeX engine in DVI mode and produces a .dvi file rather than a PDF. DVI (device-independent) is an intermediate format tied to no particular output device; since it is awkward to view or print as-is, you convert it — to PDF with dvipdfmx, or to PostScript with dvips. Where pdflatex emits PDF directly, this is a two-step approach that separates “typesetting” from “making the PDF.”
Why still use DVI? Some older machinery works only through DVI (parts of PSTricks, for instance), and — as the next section explains — Japanese typesetting has traditionally gone through DVI. To produce DVI from LuaTeX, use dvilualatex. Converting from DVI is covered in detail on the “DVI converters” page.
Japanese commands — platex / uplatex
platex is pLaTeX running on the Japanese-specialised pTeX engine (developed at ASCII Corporation; today e-pTeX). It handles vertical writing, Japanese line spacing and line-breaking rules (*kinsoku*), and the spacing between Japanese and Latin text. Its output is DVI. Its default input encoding varies by environment (Shift_JIS / EUC-JP / UTF-8); passing -kanji=utf8 tells it to read UTF-8. Even so, pTeX can directly handle only the ASCII + JIS X 0208 range of characters.
uplatex is upLaTeX on the upTeX engine (by Takuji Tanaka), whose internal processing is Unicode-based. Its default input is UTF-8 and it handles characters outside JIS X 0208 (rare name kanji, the full CJK Unified Ideographs, and so on) without extra packages, which makes it the standard for modern Japanese papers. Its output is also DVI, and the -kanji option can change the input encoding.
# 日本語: 組版 → DVI → PDF / Japanese: typeset → DVI → PDF
uplatex -kanji=utf8 document.tex # → document.dvi
dvipdfmx document.dvi # → document.pdfThe DVI from (u)platex becomes a PDF via dvipdfmx (the dvipdfmx in TeX Live is upTeX-aware). Recent TeX Live defaults to UTF-8 input, so -kanji=utf8 can often be omitted — but stating it explicitly avoids surprises across environments. For reliable BOM-less UTF-8, pair it with -no-guess-input-enc on uplatex. Alternatively, lualatex + luatexja produces a PDF directly from Japanese source, with no DVI step at all.
Options you actually use
Pass options before the source file name. These work across the pdfTeX / XeTeX / LuaTeX commands:
| Option | What it does |
|---|---|
-synctex=1 | Emits SyncTeX data so editor and PDF can jump to each other |
-interaction=nonstopmode | Runs to the end without pausing on errors (batchmode is quieter still) |
-halt-on-error | Stops at the very first error |
-file-line-error | Reports errors in file:line: form (good for IDEs) |
-output-directory=DIR | Writes outputs to an existing directory |
-jobname=NAME | Sets the base name of the output files |
-shell-escape | Allows running external commands via \write18 (see caution) |
-draftmode | Skips writing the PDF for a fast check (pdfTeX / LuaTeX) |
pdflatex -synctex=1 -interaction=nonstopmode -halt-on-error -file-line-error document.texFor output format, pdfTeX and LuaTeX accept -output-format=dvi|pdf (XeTeX uses -no-pdf for .xdv instead). Be careful with -shell-escape: packages like minted (code highlighting) and some drawing packages need it to call external programs, but it lets a document run arbitrary shell commands — never enable it for sources you do not trust.
Which one should you use
- A new Japanese document —
uplatex(→dvipdfmx), orlualatex+luatexja. - Mostly English / European text —
pdflatex; fast and compatible. - You want your system’s fonts —
lualatexorxelatex. - You need DVI-only machinery —
latex(→dvipdfmx/dvips).
In practice, rather than typing these commands twice by hand, most people hand the job to a build tool like latexmk, which runs as many passes as needed and even handles the DVI conversion. To dig deeper into the engines themselves, see “Choosing an engine and format.”
Pre-submission command check
- First test the command alone: run the chosen command —
pdflatex,lualatex,uplatex, and so on — once in a terminal to prove the failure is not editor-specific. - Submission default: add
-halt-on-error -file-line-error -interaction=nonstopmodeso CI and logs point to the first real error. - Japanese PDF decision: with upLaTeX, run
uplatexthendvipdfmx; with LuaLaTeX, emit PDF directly. Do not mix the two routes accidentally. - How to read the log: read from the first
!, not only the end of.log, so you return to the command that caused the cascade.