How to Use Different Fonts on Overleaf

Hongtao Hao / 2020-11-13


Two steps #

Using different fonts is much easier than I thought. It involves two steps:

  1. Change the Compiler from LaTex or pdfLatex to either XeLaTex or LuaLaTex. To make this change, click the Menu button on the upper-left corner of your Overleaf project. In Settings, you’ll see a drop list in Compiler.

  2. Add these two lines:

\usepackage{fontspec}
\setmainfont{Choose Your Own Font}

Where to find the fonts that were supported via fontspec? Read this list , which I think is quite comprehensive. It contains many modern fonts, including those you can find in Google fonts.

Several fonts in a document #

According to this post , instead of using \setmainfont{Choose Your Own Font}, you can do this:

\setromanfont{first font choice}
\setsansfont{second font choice}
\setmonofont{third font choice}

The second choice can be activated by \ssfamily, and the third by

\begin{verbatim}
...
\end{verbatim}

Read this post for more info.

Your own fonts #

If your favorate font is not found the list , you can refer to this post to upload and your own fonts.

Last modified on 2021-10-05