Skip to content
Get started

Custom fonts

You can typeset your document in any font you have a file for, such as your university’s house font or a font you have licensed. Upload the font files to your project and load them with the fontspec package.

  1. In the file tree, click Upload files, or drag the font files onto the file tree.
  2. Pick your .ttf, .otf or .ttc files. You can put them in any folder, for example fonts/.

Click a font file in the file tree to see a preview of the font, together with the lines that load it.

Each font file can be up to 10 MB, and font files count toward your storage like images do. See Supported file types and limits.

Load fontspec and name the font by its file name, including the extension:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Inter-Regular.ttf}
\begin{document}
Hello in my own font.
\end{document}

Luzbase finds a font file in any folder of the project, so you don’t need to write the folder name or a Path= option. Loading fontspec makes Luzbase compile with XeLaTeX automatically. To use LuaLaTeX instead, add % !TEX program = lualatex at the top of your main file. See Compilers and TeX Live.

A font family usually comes as several files, one per style. Upload all of them and name each style:

\setmainfont{Inter-Regular.ttf}[
BoldFont = Inter-Bold.ttf,
ItalicFont = Inter-Italic.ttf,
BoldItalicFont = Inter-BoldItalic.ttf,
]

If you leave a style out, text in that style falls back to the regular font, and the Output panel shows a font warning.

Use \setsansfont and \setmonofont in the same way, or \newfontfamily for a font you switch to by hand:

\setsansfont{Lato-Regular.ttf}[BoldFont = Lato-Bold.ttf]
\setmonofont{JetBrainsMono-Regular.ttf}
\newfontfamily\headingfont{Merriweather-Bold.ttf}
  • Use the file name, not the font’s family name. \setmainfont{Inter} looks only for fonts installed with TeX Live, not for files in your project. Write \setmainfont{Inter-Regular.ttf} instead.
  • pdfLaTeX can’t use font files. If your main file sets % !TEX program = pdflatex, remove that line or change it to xelatex or lualatex.
  • Web fonts aren’t supported. .woff and .woff2 files can’t be uploaded, because LaTeX can’t read them. Most font sites also offer a .ttf or .otf download.
  • Give each font file a unique name. If two folders contain a font file with the same name, Luzbase may use either one.