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?

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

  • Thanks! +1 Can you explain how setmainfont interacts with beamer to produce sans-serif font for everything except small caps? – darthbith Jan 12 '15 at 19:02
  • @darthbith I'm afraid not... – karlkoeller Jan 12 '15 at 19:04
  • OK guess I have to do some research! Thanks again :-) – darthbith Jan 12 '15 at 19:05
  • @darthbith You're welcome. – karlkoeller Jan 12 '15 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.