Questions regarding the distinction between XeTeX and XeLaTeX and how they relate to TeX and LaTeX?
tex
tex
is an executable file--a runnable program. By default it has the Plain TeX format preloaded, so when you run tex file.tex
it is prepared to read macros defined in plain.tex
. It produces DVI output.
pdftex
pdftex
is another version of the tex
executable that includes certain extensions to the original program (the e-tex
extensions, including additional memory registers). By default this produces PDF output directly instead of DVI. It also has the Plain TeX format preloaded.
latex
The command latex
calls the pdftex
program (or "engine") but with the LaTeX format preloaded instead of Plain TeX, and set to produce DVI output.
pdflatex
The command pdflatex
calls the pdftex
engine but with the LaTeX format preloaded instead of Plain TeX, and set to produce PDF output.
xetex
xetex
is a different executable file from tex
and pdftex
. It includes extensions to the original program to allow Unicode input and right-to-left typesetting, among other features. By default it has the Plain TeX format preloaded and produces PDF output.
xelatex
The command xelatex
calls the xetex
engine but with the LaTeX format preloaded instead of Plain TeX and produces PDF output.
luatex
luatex
is yet another distinct executable file, a partial reimplementation of tex
that incorporates the lua
scripting language. Like xetex
, luatex
is built to accept Unicode input. It has the Plain TeX format preloaded and produces PDF output.
lualatex
The command lualatex
calls the luatex
engine with the LaTeX format preloaded instead of Plain TeX, and produces PDF output.
Examples
Plain TeX format
You can successfully compile this Plain Tex file with either tex
, pdftex
, xetex
, or luatex
:
Test of Plain \TeX.\bye
Plain TeX format with Unicode input
If you use Unicode characters, you will only be able to print those characters by running xetex
or luatex
and selecting a font that includes them:
\font\tenrm=ecrm1000 \rm
Test of Unicode with Plain \TeX: Matthäuspassion, esdrújulo.\bye
LaTeX format
To compile a LaTeX document, use latex
, pdflatex
, xelatex
, or lualatex
:
\documentclass{article}
\begin{document}
Test of \LaTeX.
\end{document}
LaTeX format with Unicode input
If you use Unicode characters, you can print them in two ways:
- use
pdflatex
and set the proper input and font encoding usinginputenc
andfontenc
packages, or - use
xelatex
orlualatex
and select a Unicode font using thefontspec
package.
For pdflatex
:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Test of Unicode with \LaTeX: Matthäuspassion, esdrújulo.
\end{document}
For xelatex
or lualatex
:
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Latin Modern Roman}
\begin{document}
Test of Unicode with \LaTeX: Matthäuspassion, esdrújulo.
\end{document}