The font type LaTeX uses in math mode is somewhat special since it is optimized for writing mathematical formulas. Letters are printed in italics, with more space left in-between, spaces are ignored. In certain cases it may be desirable to include “normal text” within an equation. There is a simple way to add “normal text” fragments in math mode.

$...\textrm{normal text}...$

Alternatively, using the `amsmath`

package:

\usepackage{amsmath}
$...\text{normal text}...$

Normal text can be added no matter which math mode you are using.

Consider the following descriptive illustration of the fraction notation, first in math mode and below in “normal text”.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
fraction&=\frac{numerator}{denominator}\\
&\\
\text{fraction}&=\frac{\text{numerator}}{\text{denominator}}
\end{align*}
\end{document}

Taking a closer look at the first two characters of “fraction” in math mode shows that LaTeX assigns them more space, giving the word a somewhat unnatural appearance.

Here is another example where switching to normal text is desirable. Any whitespace is added in “normal text” mode since math mode ignores it.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
f(x) =
\begin{cases}
0 & \text{if $x=0$,}\\
\frac{1}{x} & \text{otherwise.}
\end{cases}
\]
\end{document}

See User Guide for the amsmath Package for more details on the amsmath package.

**Addendum**

For multi-letter variables in math mode, use `\mathit{}`

to omit whitespace in-between letters. Can you see the difference?

$\mathit{def}$

Thanks for your comment João!

### Like this:

Like Loading...

*Related*

Jonas Nyrup

Instead of using eqnarray and array you should use the macros from amsmath, align and cases

tom

Ouch! My mistake. Thanks for letting me know, appreciate it! It’s fixed. Best, Tom.

João

Space left in-between exists because writing (e.g.)

`$var$`

actually means “v times a times r”. Not knowing this is the source of many ill-looking papers out there, so this could be a great opportunity to show the difference between using`$var$`

and`$\mathit{var}$`

– thus showing how to properly typeset multiletter variables.tom

Hi João,

Thank you for pointing this out. Will add it to the post.

Cheers, Tom.

alfC

(Maybe there is no point in avoiding amsmath altogether, but) if you want functionality similar to amsmath’s \text, but without loading amsmath, you can use the solution to this question: http://tex.stackexchange.com/questions/55741/is-it-possible-to-typeset-text-inside-math-without-amsmath

tom

Interesting, thanks for the link. Tom.

Dror Atariah

Why not using mathrm? Is it producing the same effect of ‘v*a*r’?

tom

Hi!

Thanks for the comment.

`\mathrm`

and`\textrm`

(or`\text`

implemented by the amsmath package) are similar, but not the same. A good discussion about the topic can be found here.Best, Tom.

Mark Lim

Thanks I like it . Useful, and it works for Beamer

Han

There is another nice discussion on \textnormal{} vs. \textrm{} (and also a little bit of \text{} in the comments} which I believe is very relevant to this post.

http://stefaanlippens.net/textnormal

tom

Thanks for the link! Tom.

Nini

I’m using the amsmath package, and I tried to use

`\text`

in mathmode within my document’s title, but it caused errors, seemingly at the`\tableofcontents`

line. I solved it by using`\rm`

instead, but do you have any idea why it would cause an error?By the way, what is the difference between

`\rm`

and`\textrm`

?tom

Hi!

Thanks for your question.

I don’t see a problem using

`\text`

in a title. Can you send a minimal working example to illustrate the error?See here for some details on the different between modal commands and text-block commands.

Cheers, Tom

Nini

Ah, I feel silly now. It wasn’t a error with

`\text`

, it was a bracket error (I hadn’t forgotten to close the bracket, the mistake wasn’t that stupid, but the bracket was in the wrong place). Sorry!Thanks for the info on

`\rm`

. Good to know it’s deprecated, I’ll stop using it.tom

No worries. Thanks for the feedback. Tom.