pdfLaTeX, XeLaTeX, or LuaLaTeX: Which One Should You Choose?
Português: Leia este tutorial em português.
Choosing a LaTeX compiler affects font support, Unicode handling, package compatibility, speed, and automation. The three most common engines—pdfLaTeX, XeLaTeX, and LuaLaTeX—produce PDF files, but they follow different workflows.
Quick recommendation
- Use pdfLaTeX for traditional templates, maximum compatibility, and fast compilation.
- Use XeLaTeX when you need system fonts or straightforward multilingual typesetting.
- Use LuaLaTeX for modern font support, advanced automation, and programmable documents.
pdfLaTeX
pdfLaTeX is mature, fast, and supported by a very large number of templates. It works especially well with classic font packages and standard academic documents.
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\begin{document}
A document compiled with pdfLaTeX.
\end{document}
Advantages
- Fast and predictable compilation.
- Excellent compatibility with older templates and publishers.
- Stable output for conventional Latin-script documents.
Limitations
- System fonts are not directly available.
- Complex Unicode and multilingual projects require additional configuration.
XeLaTeX
XeLaTeX provides direct access to fonts installed on the operating system through fontspec. It is a convenient choice for branding, non-Latin writing systems, and documents that must match a specific typeface.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\begin{document}
A document compiled with XeLaTeX.
\end{document}
Advantages
- Simple access to OpenType and TrueType fonts.
- Strong Unicode support.
- Convenient for multilingual documents.
Limitations
- Compilation can be slower than pdfLaTeX.
- Some traditional packages or publisher workflows may require changes.
LuaLaTeX
LuaLaTeX combines modern font technology with the Lua programming language. It supports system fonts and allows advanced document processing, data-driven generation, and custom automation.
\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}
\begin{document}
A document compiled with LuaLaTeX.
\end{document}
Advantages
- Modern Unicode and font support.
- Lua scripting for automation and data processing.
- A strong long-term choice for complex projects.
Limitations
- Usually slower than pdfLaTeX.
- Some specialized packages may behave differently.
Comparison by use case
- Journal template: follow the publisher’s required engine, often pdfLaTeX.
- Branded report: XeLaTeX is convenient for corporate fonts.
- Multilingual thesis: XeLaTeX or LuaLaTeX.
- Automated document generation: LuaLaTeX offers the most flexibility.
- Legacy project: keep the compiler already used unless there is a clear reason to migrate.
How to switch engines on Overleaf
- Open the project menu.
- Find the compiler setting.
- Select pdfLaTeX, XeLaTeX, or LuaLaTeX.
- Recompile from scratch after changing the engine.
- Review fonts, warnings, and the final PDF.
Best practice: record the required compiler in the project README. Explore the TexDrop templates and always follow the compiler specified by each template.