Documentation/Compilers & Engines/LaTeX vs pdfLaTeX vs XeLaTeX vs LuaLaTeX — Which Engine to Use
Compilers & Engines

LaTeX vs pdfLaTeX vs XeLaTeX vs LuaLaTeX — Which Engine to Use

LaTeX isn't a single program — it's a family of engines that process your .tex files differently. The three main engines are pdfLaTeX (the classic default), XeLaTeX (for Unicode and system fonts), and LuaLaTeX (the modern, extensible choice). Choosing the wrong engine can mean your document won't compile, your fonts won't work, or you'll miss out on useful features. Bibby AI automatically selects the best engine for your document based on your preamble, but understanding the differences helps you make informed choices.

Comparing the Three Engines

Each engine has different strengths, input handling, and font support:

% pdfLaTeX (default for most documents)
% + Fastest compilation
% + Best compatibility with older packages
% + Produces PDF directly
% - Limited to T1/OT1 font encodings
% - No native Unicode support
% - Cannot use system fonts (.ttf, .otf)
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}  % Required for UTF-8
\begin{document}
Basic pdfLaTeX document.
\end{document}

% XeLaTeX (for fonts and Unicode)
% + Native Unicode support
% + Uses system fonts directly
% + Great for non-Latin scripts
% - Slower than pdfLaTeX
% - Some pdfLaTeX packages don't work
\documentclass{article}
\usepackage{fontspec}  % XeLaTeX/LuaLaTeX only
\setmainfont{Times New Roman}
\begin{document}
XeLaTeX with system fonts.
\end{document}

% LuaLaTeX (modern and extensible)
% + Everything XeLaTeX does
% + Lua scripting built in
% + Advanced OpenType features
% + Better memory handling
% - Slowest compilation
% - Newest, some edge-case bugs

Decision Guide: Which Engine to Choose

Use this flowchart to pick the right engine for your project:

% DECISION GUIDE:
%
% Q: Do you need system fonts (.ttf/.otf)?
%   YES -> XeLaTeX or LuaLaTeX
%   NO  -> Continue
%
% Q: Do you need non-Latin scripts (CJK, Arabic, etc.)?
%   YES -> XeLaTeX or LuaLaTeX
%   NO  -> Continue
%
% Q: Do you need Lua scripting or advanced computation?
%   YES -> LuaLaTeX
%   NO  -> Continue
%
% Q: Do you need maximum compatibility and speed?
%   YES -> pdfLaTeX
%   NO  -> LuaLaTeX (future-proof default)

% For most academic papers, pdfLaTeX is fine:
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage{amsmath, graphicx, hyperref}
\usepackage{mathpazo}  % Palatino font (pdfLaTeX)
\begin{document}
Most conferences and journals expect pdfLaTeX.
\end{document}

Engine-Specific Code Examples

See how the same task differs across engines:

% TASK: Use a custom font

% pdfLaTeX approach (use font packages):
\usepackage[T1]{fontenc}
\usepackage{mathpazo}     % Palatino
% or
\usepackage{newtxtext,newtxmath}  % Times

% XeLaTeX/LuaLaTeX approach (use any system font):
\usepackage{fontspec}
\setmainfont{EB Garamond}
\setsansfont{Helvetica Neue}
\setmonofont{Fira Code}
\setmathfont{Garamond-Math}  % LuaLaTeX with unicode-math

% TASK: Include Unicode characters

% pdfLaTeX (needs inputenc + specific support):
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
Caf\'e, na\"ive, r\'esum\'e  % Accents via commands

% XeLaTeX/LuaLaTeX (native Unicode):
Café, naïve, résumé  % Just type directly!
% Also: Chinese 你好, Arabic مرحبا, Greek αβγ

💡 Tips

  • When in doubt, start with pdfLaTeX — it's the fastest and most compatible. Switch to XeLaTeX or LuaLaTeX only when you need their specific features.
  • Bibby AI auto-detects when your document needs XeLaTeX or LuaLaTeX (e.g., when you use fontspec) and switches engines automatically.
  • Most journal and conference templates are designed for pdfLaTeX — check the submission guidelines before switching engines.
  • If you need system fonts AND Lua scripting, LuaLaTeX is your only option — it's a superset of XeLaTeX's capabilities.

Try This in Bibby AI

Write LaTeX faster with AI auto-complete and instant compilation.

Start Writing Free

Related Tutorials

LaTeX vs pdfLaTeX vs XeLaTeX vs LuaLaTeX — Which Engine to Use | Bibby AI