Skip to main content
Use pdfLaTeX for English and other Latin-script documents, and whenever a journal or university template asks for it. Use XeLaTeX or LuaLaTeX when you need fonts installed on the system (through the fontspec package) or text in Greek, Cyrillic, Arabic, Chinese and other scripts; choose LuaLaTeX if you also want Lua scripting or font expansion with microtype. All three engines read the same LaTeX syntax and produce a PDF. The differences are in fonts, character input and a few engine-only packages.

pdfLaTeX: the default for Latin-script text

pdfLaTeX is what most templates, tutorials and journal submission systems expect. UTF-8 is the default input encoding in current LaTeX, so accented Latin letters work without \usepackage[utf8]{inputenc}. \usepackage[T1]{fontenc} selects fonts that contain those accented letters as single glyphs.
pdflatex-example.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
pdfLaTeX cannot load system fonts, and it stops on characters outside the set LaTeX has prepared for it. Typing a Greek letter directly into the text, for example, gives:
main.log
In math, write $\alpha$ instead. For whole paragraphs in another script, switch engines or follow the setup for that language in the languages guides.

XeLaTeX: system fonts and Unicode text

XeLaTeX reads UTF-8 text directly and, with fontspec, uses any OpenType or TrueType font installed on the system. Select a font by its name with \setmainfont. The characters you type print as long as the chosen font contains them.
xelatex-fontspec.tex
microtype works with XeLaTeX for character protrusion (hanging punctuation into the margin), but font expansion is not available. Requesting it with \usepackage[expansion=true]{microtype} stops with Package microtype Error: Font expansion does not work with xetex. Font selection is covered in Fonts in LaTeX; script-specific setups are in the languages guides.

LuaLaTeX: system fonts plus Lua

LuaLaTeX supports fontspec and Unicode input like XeLaTeX, and it also runs Lua code during compilation, through \directlua or the luacode package. microtype supports both protrusion and expansion with LuaLaTeX. Japanese documents set with the LuaTeX-ja packages also need LuaLaTeX.
lualatex-luacode.tex

Switching between engines

  • pdfLaTeX to XeLaTeX or LuaLaTeX: remove \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc}, load fontspec, and choose fonts with \setmainfont.
  • XeLaTeX or LuaLaTeX to pdfLaTeX: remove fontspec and its font commands, then load a pdfLaTeX font package such as lmodern or newtxtext with \usepackage[T1]{fontenc}.
  • Engine-only packages: fontspec and polyglossia need XeLaTeX or LuaLaTeX; luacode and LuaTeX-ja need LuaLaTeX. The error messages and fixes are on Compiler and engine errors.
On your own computer, the engine is the command you run: pdflatex main.tex, xelatex main.tex or lualatex main.tex.

In LaTeX Cloud Studio

LaTeX Cloud Studio compiles with a full TeX Live 2026 installation and supports all three engines. The LaTeX Engine setting in the project settings offers Auto (Recommended), PDFLaTeX, XeLaTeX and LuaLaTeX. Auto switches to XeLaTeX when the project uses fontspec or system fonts; Compiler and engine errors lists the rules it follows. To compare the engines on your own text, start from the Basic Article template in LaTeX Cloud Studio and change the LaTeX Engine setting.