Take the 2-minute tour ×
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.

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
2  
There is a definition of \mathup: Is \mathrm really preferable to \text? –  Qrrbrbirlbel Oct 21 '13 at 13:14
    
Doesn't \text{} from amsmath do the trick? –  Thoge Oct 22 '13 at 14:33
1  
@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

1 Answer 1

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

Sample output

\documentclass{beamer}

\usepackage{amsmath}

\begin{document}

\begin{frame}
  \( x y \mathrm{x} \text{\textup{x}}\)
\end{frame}

\end{document}

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

\renewcommand{\rmdefault}{cmss}

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

\AtBeginDocument{%
  \SetMathAlphabet{\mathrm}{normal}{\encodingdefault}{cmss}{\mddefault}{n}
  \SetMathAlphabet{\mathrm}{bold}{\encodingdefault}{cmss}{\bfdefault}{n}}

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

 
discard

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.