LaTeX: use \textnormal instead of \textrm (or \textsf) in math

14 December, 2005 - 14:17
Categories:

If you you want to use normal text in a math environment (mathdisplay, equation,...) you should use \textnormal{} instead of \textrm{}. Apparently the latter is more popular: a google search for "latex textrm" delivers almost 25.000 hits, whereas google search for "latex textnormal" returns not more than 800 hits. The advantage of \textnormal is that the text will be typeset in the normal font of the body text. \textrm on the other hand activates a roman (serif) font. Most of the time the result of these two will be the same because the default font of the body text is a serif one in most cases. But sometimes it is not.

An example I encountered was reusing LaTeX code from an article in a LaTeX Beamer Class presentation. In a beamer presentation the default font is a sans serif one. When I reused my math expressions, I had to replace all \textrm with \textsf to adjust to this "other default". If I would have used \textnormal, there wouldn't be a problem.

For example (I like examples), consider the following LaTeX body, saved to a file textnormalexample_body.tex:

This just some normal text, and here is some math:
\begin{eqnarray*}
 \int_1^9 x dx & & \textrm{this is textrm}\\
 \sum_1^9 y    & & \textsf{this is textsf}\\
 \prod_1^9 z   & & \textnormal{this is textnormal}
\end{eqnarray*}

We use this in a simple article document:
\documentclass{article}
\begin{document}
  \input {textnormalexample_body.tex}
\end{document}

and a comparable simple beamer presentation:
\documentclass{beamer}
\begin{document}
  \begin{frame}
    \input{textnormalexample_body.tex}
  \end{frame}
\end{document}

The result of the article is:
result of the article document

The result of the beamer presentation is:
result of the beamer presention document

Note that the font of the text inside the \textnormal{..} matches the font of the body in both cases.

14 July, 2010 - 08:16

\text{} does *not* have the

Anonymous (not verified)

\text{} does *not* have the same effect as \textnormal{} with amsmath. \text will use the text style from the enclosing environment, while \textnormal will not. For example, say your theorems are italicized. \text will generate italicized text inside a math enviroment within the theorem, while \textnormal will not.

6 April, 2010 - 01:04

Awesome, this is exactly what

Daniel (not verified)

Awesome, this is exactly what I was looking for.

3 July, 2008 - 15:56

Thanks

Matt Heath (not verified)

I just used this to fix my beamer presentation. Thanks

23 January, 2006 - 14:50

With amsmath, use \text{} to

Anonymous (not verified)

With amsmath, use \text{} to do the same.

2 January, 2006 - 16:00

LaTeX.UGent.be

Peter Dedecker (not verified)

Woohoow! More LaTeX users @ UGent. Maybe I can point you to the website http://LaTeX.UGent.be. All your comments for that website are welcome! Thanks!

Post new comment

The content of this field is kept private and will not be shown publicly.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options