pdfLaTeX vs XeLaTeX vs LuaLaTeX

Three programs turn the same .tex file into a PDF. They are not interchangeable: a document written for one can fail outright on another. This is how to tell which one you need.

The short answer

Use pdfLaTeX unless something forces you off it. The two things that most often force you off it are wanting a font installed on your computer, and writing in a script that is not Latin, Greek or Cyrillic. Both point at XeLaTeX orLuaLaTeX, which share a font model and differ mainly in what else they can do.

If a template tells you which engine to use, use that one. The choice was made by whoever wrote the class file, and it is usually not negotiable without editing the preamble.

What the catalogue actually uses

Every template on this site is compiled before it is published, and the engine that produced the PDF is recorded. Across 909 templates:

EngineTemplatesShareWhy
pdflatex75283%The default, and what most classes on CTAN are written for.
xelatex12514%Chosen when the document needs system fonts or non-Latin scripts.
lualatex283%Chosen when the document needs Lua scripting or heavy font work.
pdftex20%Plain TeX rather than LaTeX — a handful of legacy documents.
latex-dvips20%The DVI route, still required by a few older classes.

That distribution is worth reading carefully, because it contradicts the impression you get from forum advice. Roughly 83% of working, compiling documents still use pdfLaTeX — not because their authors are behind the times, but because it does everything those documents need. The newer engines are a minority, and they are chosen for specific reasons rather than as a general upgrade.

These are not opinions about what people should use. They are the engines that produced a PDF that actually built.

The real difference: fonts

Almost every practical distinction between the engines comes back to fonts, so it is worth being precise about it.

pdfTeX inherits TeX's original font model. It uses fonts that have been installed into your TeX distribution and described to it by metric files — historically Type 1 fonts. TeX Live ships a large collection of these, and they are excellent, but the set is fixed at install time. You cannot point pdfLaTeX at a .ttf or.otf file sitting on your desktop.

XeTeX and LuaTeX can load TrueType and OpenType fonts directly, including the fonts already installed on your operating system, by name. This is what the fontspec package provides:

Requires XeLaTeX or LuaLaTeX
\documentclass{article}
\usepackage{fontspec}
\setmainfont{EB Garamond}
\begin{document}
Set in whichever EB Garamond the system can find.
\end{document}

This is the single most common reason a document will not compile. Run the file above through pdfLaTeX and it does not degrade gracefully or substitute a default — it stops:

pdflatex output
! Fatal Package fontspec Error: The fontspec package requires either XeTeX or
(fontspec)                      LuaTeX.

So \usepackage{fontspec} in a preamble is a reliable signal: that document needs XeLaTeX or LuaLaTeX, and no amount of rerunning will change it. The reverse is also worth knowing — a document written for pdfLaTeX will usually compile fine under the newer engines, so the incompatibility mostly runs one way.

Unicode and non-Latin scripts

A related confusion is worth clearing up, because it is often stated too strongly. Since the April 2018 release, LaTeX assumes your source file is UTF-8 by default under every engine, so\usepackage[utf8]{inputenc} is no longer needed in new documents — and under XeTeX and LuaTeX it never did anything at all. Accented Latin characters therefore work in pdfLaTeX without ceremony.

What pdfLaTeX cannot do easily is typeset scripts outside its installed font encodings. Chinese, Japanese, Korean, Arabic, Hebrew, Devanagari and Thai all want a Unicode engine plus a font that contains the glyphs. Arabic and Hebrew additionally need right-to-left support, and complex scripts need the shaping engine that XeTeX and LuaTeX provide. This is why templates for East Asian and Indic universities cluster on xelatex in the table above.

microtype, stated correctly

microtype is the package that makes LaTeX output look subtly better — it nudges punctuation into the margin (protrusion) and imperceptibly stretches glyphs to improve line breaking (expansion). Guides frequently say it "only works with pdfLaTeX". That is not right, and the accurate version is more useful.

So you do not lose microtype by moving to XeLaTeX — you lose one of its two mechanisms, and the one you keep is the more visible. If typographic polish is the priority and you also need OpenType fonts, LuaLaTeX is the combination that gives up nothing.

When you must switch

Concrete cases, rather than general advice:

And the case for not switching: if your document compiles under pdfLaTeX today, moving it is work with no reward. Bibliography styles, font packages and layout can all shift underneath you.

Choosing between XeLaTeX and LuaLaTeX

Once you need a Unicode engine, the two are close enough that either will usually work. The differences that decide it:

For a new document with no constraints, LuaLaTeX is the forward-looking choice. For an existing document, use whatever it was written for.

Finding out which engine a document needs

If you have inherited a .tex file, read the preamble before guessing. fontspec, unicode-math orpolyglossia mean a Unicode engine.inputenc or fontenc with[T1] suggests it was written for pdfLaTeX. Many templates also state it in a comment on the first line, or in a% !TEX program = xelatex directive that editors read automatically.

Every template on this site records the engine it was compiled with on its own page, so you do not have to infer it.

Bibliography guideWhat is LaTeX?Choosing a thesis template