1

I am using a sans-serif font for my beamer slides but the regular serif math font for my equations. However, if I use \text{} in math mode, the sans-serif font is used. I would like to enforce that the serif font is used when using \text{}.

Here is a MWE

\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\begin{document}
\begin{frame}
I would like to make $f_\text{LO}$ look like $f_\mathrm{LO}$.
\end{frame}
\end{document}

Replace sans-serif font in math mode with serif font



Update: I found out that I should not redefine \text{} but use \textrm{} instead to use the serif font in math mode. By doing that, I can still add regular text using \text{}.

4
  • 2
    \text is as the names says for text, for math use \mathrm (or define a some meaningful wrapper command). And use braces around the subscript: f_{\mathrm{LO}}, see tex.stackexchange.com/a/342272/2388 Aug 31, 2020 at 7:15
  • @UlrikeFischer Thank you. The problem with \mathrm{} is that I manually have to add spaces and it behaves differently for hyphens. However, \textrm{} works fine
    – brnk
    Aug 31, 2020 at 7:22
  • ? There are no spaces in your example. Aug 31, 2020 at 7:24
  • @UlrikeFischer Sorry, I only realized that when I replaced \text{} with \mathrm{} in my document where I use spaces and hyphens. Thank you anyway!
    – brnk
    Aug 31, 2020 at 7:27

0

You must log in to answer this question.

Browse other questions tagged .