Two steps #
Using different fonts is much easier than I thought. It involves two steps:
-
Change the Compiler from
LaTex
orpdfLatex
to eitherXeLaTex
orLuaLaTex
. To make this change, click the Menu button on the upper-left corner of your Overleaf project. InSettings
, you’ll see a drop list inCompiler
. -
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