TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
\mathsf? See this. – Jubobs Oct 20 '13 at 13:15
@Jubobs I would not want to have sanf serif script in a serif environment. I really only want to have \upshape. – Nico Schlömer Oct 21 '13 at 13:05
There is a definition of \mathup: Is \mathrm really preferable to \text? – Qrrbrbirlbel Oct 21 '13 at 13:14
@Thoge Quoting from tex.stackexchange.com/q/98008: "As has been said, \text is for text, and will change depending on the surrounding font. But math symbols in a document should always look the same: The meaning of a symbols also depends on the font used. So you should not use \text for mathematical symbols.". – Nico Schlömer Oct 23 '13 at 12:44
What about \newcommand{\mathup}[1]{\text{\textup{#1}}}? This works for me. – Wauzl Aug 7 '14 at 7:35

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 expacting. An alternative is to replace the two relevant definitions from beamerbasefont.sty by


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

On the above example, either method gives you:

Second sample

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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