Compilers & Engines
When Should You Use XeLaTeX Instead of pdfLaTeX?
pdfLaTeX is the default engine for most LaTeX users, but it has limitations: no native Unicode support, no access to system fonts, and poor handling of non-Latin scripts. XeLaTeX removes these limitations while staying mostly compatible with pdfLaTeX documents. You should switch to XeLaTeX when you need custom fonts, multilingual text, or full Unicode support. Bibby AI makes this switch seamless — it detects when XeLaTeX is needed and handles the transition automatically.
Scenarios Where XeLaTeX Is the Right Choice
Switch to XeLaTeX when you encounter any of these requirements:
% SCENARIO 1: You need a specific font
% (e.g., your university requires Calibri)
\documentclass{article}
\usepackage{fontspec}
\setmainfont{Calibri}
\begin{document}
This text is in Calibri — impossible with pdfLaTeX.
\end{document}
% Compile with: xelatex main.tex
% SCENARIO 2: Multilingual document with non-Latin scripts
\documentclass{article}
\usepackage{fontspec}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{arabic}
\newfontfamily\arabicfont{Amiri}
\begin{document}
English text with some
\begin{Arabic}
نص عربي
\end{Arabic}
mixed in.
\end{document}
% SCENARIO 3: You need OpenType font features
\setmainfont{EB Garamond}[
Ligatures = TeX,
Numbers = OldStyle,
Style = Historic
]What Changes When Switching from pdfLaTeX to XeLaTeX
Some packages and commands differ between engines. Here's what to update:
% REMOVE these pdfLaTeX-specific packages:
% \usepackage[utf8]{inputenc} % Not needed
% \usepackage[T1]{fontenc} % Not needed
% REPLACE font packages with fontspec:
% REMOVE: \usepackage{mathpazo}
% ADD:
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella} % Palatino equivalent
% KEEP these — they work with both engines:
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage{booktabs}
% CHANGE if using microtype (limited XeLaTeX support):
% pdfLaTeX: Full microtype features
\usepackage{microtype}
% XeLaTeX: Only some features work
\usepackage[protrusion=true]{microtype}
% CHANGE graphics format preference:
% pdfLaTeX: Prefers .pdf, .png, .jpg
% XeLaTeX: Same, but also handles .eps better
\includegraphics[width=0.5\textwidth]{figure.pdf}A Complete XeLaTeX Document Template
Here's a ready-to-use XeLaTeX template with system fonts and Unicode:
\documentclass[12pt, a4paper]{article}
% XeLaTeX font setup
\usepackage{fontspec}
\setmainfont{Linux Libertine O} % or any system font
\setsansfont{Linux Biolinum O}
\setmonofont{Fira Code}[Scale=0.9]
% Math with Unicode
\usepackage{unicode-math}
\setmathfont{Libertinus Math}
% Standard packages (engine-agnostic)
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{booktabs}
\usepackage[colorlinks]{hyperref}
\title{XeLaTeX Document Template}
\author{Your Name}
\date{\today}
\begin{document}
\maketitle
\section{Unicode Characters}
Direct Unicode: café, naïve, Ångström, €100.
Greek: αβγδ, Cyrillic: абвг, Math: ℝ ∈ ∀ ∃.
\section{Mathematics}
\[
∫_{-∞}^{∞} e^{-x²} dx = \sqrt{π}
\]
\end{document}💡 Tips
- •Don't switch to XeLaTeX unless you have a reason — pdfLaTeX is faster and more compatible with conference/journal templates.
- •Bibby AI detects \usepackage{fontspec} and automatically switches to XeLaTeX, so you never need to configure the engine manually.
- •If you only need better fonts in pdfLaTeX, try packages like newtxtext, libertinus, or stix2 before switching engines entirely.
- •XeLaTeX is slightly slower than pdfLaTeX — for large documents, the compilation time difference is noticeable.
Try This in Bibby AI
Write LaTeX faster with AI auto-complete and instant compilation.
Start Writing Free