Using Google fonts with XeLaTeX
Author
Overleaf
Last Updated
1年前
License
Creative Commons CC BY 4.0
Abstract
This example accompanies an Overleaf help article.
\documentclass{article}
\usepackage{parskip}
\usepackage{hologo}% to access the XeTeX logo via \hologo{XeLaTeX}
\usepackage{fontspec}
\setsansfont{Asap}[
Path=./AsapFontFiles/,
Scale=0.9,
Extension = .ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic
]
\setmainfont{Brygada1918}[
Path=./BrygadaFontFiles/,
Extension = .ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic
]
\setmonofont{JetBrainsMono}[
Path=./JetbrainsFontFiles/,
Scale=0.85,
Extension = .ttf,
UprightFont=*-Regular,
BoldFont=*-Bold,
ItalicFont=*-Italic,
BoldItalicFont=*-BoldItalic
]
\title{Using Google Fonts with \hologo{XeLaTeX}}
\author{Overleaf}
\date{September 2023}
\begin{document}
\maketitle
\section{Introduction}
The following lists demonstrate the various fonts we have uploaded.
{\sffamily This is the Asap sans serif font:
\begin{itemize}
\item {\itshape now in italic}
\item {\bfseries now in bold}
\item {\itshape\bfseries now in bold italic}
\end{itemize}
}
{\ttfamily This is the JetBrains Mono font:
\begin{itemize}
\item {\itshape now in italic}
\item {\bfseries now in bold}
\item {\itshape\bfseries now in bold italic}
\end{itemize}
}
{\rmfamily This is the Brygada1918 font:
\begin{itemize}
\item {\itshape now in italic}
\item {\bfseries now in bold}
\item {\itshape\bfseries now in bold italic}
\end{itemize}
}
\end{document}