In a beamer presentation I can use \usefonttheme[onlymath]{serif} to typeset the math in a serif font while the rest of the presentation is in a sans-serif font. But the \SI command from siunitx appears to typeset its argument as text, which means it follows the text font style, not the math one. Is there a way I can change this so that quantities with units appear with a serif font just like other math, whereas the text is still sans-serif?


  Text appears in sans-serif font

  $x,2y,3z$ appears in serif font

  $\SI{1}{m}$ appears in sans-serif font, would like it to be serif

I've tried things like \sisetup{math-rm=\mathrm, text-rm=\rmfamily} or passing the detect-family option to siunitx, but no luck.

Of course I could just change the font family of the entire document to be serif, but I'd like to know whether I have another option.

  • 7
    Where are you doing the \sisetup? siunitx deliberately tests for 'all sanserif' using the \AtBeginDocument hook, so to reverse that you need to either do \sisetup after \begin{document} or use \AtBeginDocument from the preamble.
    – Joseph Wright
    Commented Aug 10, 2012 at 21:44
  • Ah, that's the issue, I had \sisetup before \begin{document}. I could accept that if you'd like to post it as an answer.
    – David Z
    Commented Aug 10, 2012 at 22:36

3 Answers 3


siunitx checks if the document font is sanserif using the \AtBeginDocument hook, and adjusts the default if it is. That reflects the fact that in most cases if people set their document all sanserif the desired outcome is that siunitx also uses sanserif.

In version three (the current release), the font setting that is affected is unit-font-command, so you want

\AtBeginDocument{\sisetup{unit-font-command = \mathrm}}

In version two, you will need to change a slightly different setting:

\AtBeginDocument{\sisetup{math-rm=\mathrm, text-rm=\rmfamily}}

(The font setup is very different between the two versions, partly driven by the desire to better support things like beamer.)


In a recent version, siunitx has also added the mode, reset-text-family, reset-text-series, and reset-text-shape options. With these, on can tell siunitx to respect the beamer settings.


\usefonttheme{structurebold}  % Only to show series changes

    \frametitle{Frame \SI{1}{\metre}}


    \frametitle{Frame \SI{2}{\metre}}

Other font settings are detailed in section 4.2 of the manual.


In the preamble of the document add this two lines:

\sisetup{detect-all = true, detect-family = true}

Afterwards, in the document body, siunitx will follow your global settings, but if you change the font in a block, then siunitx will follow those changes too. For example:

\SI{0.8393}{\metre} %global settings


Also check you are using the siunitx commands. As you typed \SI{1}{m}, but instead, it should be written as \SI{1}{\metre}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .