1

I am trying to use JetBrainsMono as the main font for beamer. I am using xelatex to compile the document and it seems to recognize the font but the font is not applied to the document.

\documentclass[aspectratio=169]{beamer}
\usepackage{fontspec}
\usepackage[spanish]{babel}

\newfontfamily{\jtbmedium}{JetBrainsMono-Medium}[ Path =/home/dbarcene/.fonts/, Extension =.ttf, Ligatures =TeX]

\newfontfamily{\jtbbold}{JetBrainsMono-Bold}[ Path =/home/dbarcene/.fonts/, Extension =.ttf, Ligatures =TeX]

\setmainfont{\jtbmedium}

\title{Long Title} \author{John Doe} \date\today

\begin{document}

\maketitle

\section{First Section} \begin{frame}{First Frame} Hello, world! \end{frame}

\end{document}

What would be the proper procedure to use system fonts like JetBrainsMono in beamer? Thanks in advance.

1 Answers1

2

Beamer uses sans serif text, you have to use \setsansfont instead of \setmainfont (or use a serif font theme instead)

% !TeX TS-program = lualatex

\documentclass[aspectratio=169]{beamer} \usepackage{fontspec} \usepackage[spanish]{babel}

\setsansfont{JetBrains Mono}

\title{Long Title} \author{John Doe} \date\today

\begin{document}

\maketitle

\section{First Section} \begin{frame}{First Frame} Hello, world! \end{frame}

\end{document}

enter image description here

(Using your newly defined font families in \setsansfont doesn't work, so I'm using the font there directly, see The macros setmainfont and setsansfont do not accept the new command of a newfontfamily. Is there compatibility between them? for details)