3

I would like to use small caps for short text sections in a beamer presentation. In a normal article, the following produces small caps in the TeX Gyre Heros font, as shown in this question:

\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Tex Gyre Heros}
\begin{document}
\textsc{Test text} Test text
\end{document}

while the following beamer document produces a warning and serif small caps:

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage{unicode-math}
\setmainfont{Tex Gyre Heros}
\begin{document}
\begin{frame}
\textsc{Test text} Test text
\end{frame}
\end{document}

with the warning:

LaTeX Font Warning: Font shape `EU2/lmss/m/sc' in size <10.95> not available
(Font)              Font shape `EU2/lmr/m/sc' tried instead on input line 9.

How can I use small caps with unicode-math/fontspec in beamer?

darthbith
  • 7,384

1 Answers1

5

beamer uses the Sans Serif font as default.

So setting

\setsansfont{TeX Gyre Heros}

instead of

\setmainfont{TeX Gyre Heros}

works for me.

MWE

\documentclass{beamer}
\usefonttheme{professionalfonts}
\usepackage{unicode-math}
\setsansfont{TeX Gyre Heros}
\begin{document}
\begin{frame}
\textsc{Test text} \textsf{Test text}
\end{frame}
\end{document} 

enter image description here

karlkoeller
  • 124,410