4

I am writing a presentation using the beamer class and XeTeX. I have changed the sans font using \setsansfont. Now some symbols in my equations are rendered using the mono font (like the lowercase letters).

How can I force math mode to render all symbols in the equations in the default Computer Modern, ignoring the font set with \setsansfont?

Caramdir
  • 89,023
  • 26
  • 255
  • 291
  • Could you pleas edit your question and add that you are seeing this behavior with beamer slides. That would be helpful for people having the same problem and searching for a solution. – Caramdir Feb 07 '11 at 16:07
  • I changed the tags. – Leo Liu Feb 07 '11 at 16:18

3 Answers3

7

By default, Beamer does some math font manipulation, because many fonts, such as the cm-sans used by default, don't provide matching mathematical glyphs. If you want the standard Computer Modern (serif) math font, just say

\usefonttheme{professionalfonts}

in the preamble. This suppresses any auto-manipulations.

AlexG
  • 54,894
  • Note that you don't have to (and in fact shouldn't) sign with your name since it automatically appears in the lower right corner of your post. – Hendrik Vogt Feb 08 '11 at 16:19
  • I was looking into changing only the math font for the metropolis theme. This solution works much better than fiddling with the packageunicode-math. – Gabriel Romon Jan 19 '24 at 14:43
5

Yes, it was a beamer issue. Using

\documentclass[onlymath]{beamer}
\usefonttheme{serif}

solves the problem. Thanks for pointing me in the right direction, though.

2
\usepackage[cm-default,no-math]{fontspec}
Leo Liu
  • 77,365
  • 1
    This change makes more symbols appear in the sans font, instead of the less, e.g. now numbers are in the sans font. Could this be a beamer issue? – Nickolay Kolev Feb 07 '11 at 15:55