## I have a custom font I'd like to load to my document. How can I do this?

### If you're using pdfLaTeX or LaTeX

If you'd like to use a custom font in your document, you can upload the relevant .tfm, .ttf, .fd or .maps file via the files menu, and then create a custom font as usual within your LaTeX document.

Note that if you have a .map file (e.g. myfont.map) to be used along with the font files, you may need to enable it like this in your preamble:

\pdfmapfile{+myfont.map}

Here's a quick demo showing how to create and use a custom ttf font.

### If you're using xelatex or lualatex

The easiest way to use it is via XeLaTeX/LuaLaTeX and fontspec.
1. Selecting XeLaTeX/LuaLaTeX as your LaTeX engine
1. With your project loaded in the Overleaf editor, click the Settings icon (the gear icon in the upper right, just next to your user name.)
2. Under “Advanced Build Options”, from the “LaTeX engine” drop list, select XeLaTeX or LuaLaTeX.
3. Click on “Save Project Settings”.
2. Load the fontspec package (this allows you to use TTF/OTF fonts directly)

\usepackage{fontspec}

Note that you no longer need \usepackage[T1]{fontenc} and \usepackage[utf8]{inputenc} when using XeLaTeX and LuaLaTeX as the engine.

4. Set the fonts you need
5. You can now set the fonts to be used in your document, using their names as installed in the operating system. (See this link for a list of fonts already installed on Overleaf.) For example:

\setmainfont{Georgia}
\setsansfont{Trebuchet MS}
\setmonofont{Inconsolata}


will use Georgia as the serif/roman font; Trebuchet MS as the sans serif font; and Inconsolata for the typewriter/monospaced fonts.

6. Using a custom font
2. Use the following syntax instead for the \setxxxfont commands:
\setmainfont{[CrimsonText-Regular.ttf]}

or
\setmainfont{CrimsonText}[
Extension = .ttf,
UprightFont = *-Regular,
...]


You can also declare a new font family to use it in arbitrary situations:

\newfontfamily{\crimson}{CrimsonText}
[Extension = .ttf, UprightFont = *-Regular, ...]

{\crimson This text uses the CrimsonText font}

See the fontspec documentation for more options.