[Tex/LaTex] Equivalent of \mathup for upright text in math mode


To insert text in mathmode, there are a couple of commands:

  • \mathrm for Roman script,
  • \mathbf for bold weight,
  • \mathit for italic shape,
  • \mathsf for the sans serif variant,

and so on. Now, sometimes I would like to have some math entities typeset upright (see for example How to best typeset "special" constants (complex unit i, Euler's number e,…)?).
I understand that \mathrm sets the text in Roman and upright, but in some cases I do not want serifs (e.g., in presentations). The command \mathup does not seem to exist.

What is recommended way to set upright text in math mode?

Best Answer

I guess what you are seeing is the following when you use \mathrm with a serif font:

Sample output




  \( x y \mathrm{x} \text{\textup{x}}\)


There are two ways to fix this: one fairly drastic option is to put


but this may feed through to places you are not expecting. An alternative is to replace the two relevant definitions from beamerbasefont.sty by


in your preamble. In the beamer style file {cmss} is {\rmdefault}.

Applied to the above example, either method gives you:

Second sample