Change LaTeX Compiler in Overleaf
Nov. 06, 2025 in Buffalo, United States • Updated Nov. 07, 2025
Sometimes, we may have to use TeX engine XeLaTeX to compile LaTeX document; for example, specify the typeface as Arial for the whole document1 (the way of using XeLaTeX in TeXStudio can also be found in blog1):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
\documentclass[a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{lipsum}
\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}
\usepackage{fontspec}
\setmainfont{Arial}
\begin{document}
\lipsum[1-8]
\end{document}
However, Overleaf uses pdfLaTeX as a default engine (the same as TeXStudio), so when running the above script, some errors will occur:

So at this time, we need to change TeX engine as XeLaTeX to solve this problem. Here is the method:
First, click Menu in the left top corner:

Then, change the compiler from pdfLaTeX to XeLaTeX in the Settings part:

Finally, recompile the document at this time, we’ll get a normal output:

Bingo~
References