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.
Upload a font
Section titled “Upload a font”- In the file tree, click Upload files, or drag the font files onto the file tree.
- Pick your
.ttf,.otfor.ttcfiles. You can put them in any folder, for examplefonts/.
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.
Use the font in your document
Section titled “Use the font in your document”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.
Bold and italic
Section titled “Bold and italic”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.
Sans-serif and monospace fonts
Section titled “Sans-serif and monospace fonts”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}Things to know
Section titled “Things to know”- 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 toxelatexorlualatex. - Web fonts aren’t supported.
.woffand.woff2files can’t be uploaded, because LaTeX can’t read them. Most font sites also offer a.ttfor.otfdownload. - Give each font file a unique name. If two folders contain a font file with the same name, Luzbase may use either one.