Text inside maths

When we type maths in (La)TeX, the letters from which we make up ordinary text assume a special significance: they all become single-letter variable names. The letters appear in italics, but it's not the same sort of italics that you see when you're typing ordinary text: a run of maths letters (for example "here") looks oddly "lumpy" when compared with the word written in italic text. The difference is that the italic text is kerned to make the letters fit well together, whereas the maths is set to look as if you're multiplying h by e by r by e. The other way things are odd in TeX maths typing is that spaces are ignored: at best we can write single words in this oddly lumpy font.

So, if we're going to have good-looking text in amongst maths we're writing, we have to take special precautions. If you're using LaTeX, the following should help.

The simplest is to use \mbox or \textrm:

$e = mc^2 \mbox{here we go again}$
The problem is that, with either, the size of the text remains firmly at the surrounding text size, so that
$z = a_{\mbox{other end}}$
looks quite painfully wrong.

The other simple technique, \textrm, is more promising:

$z = a_{\textrm{other end}}$
is definitely right. However, the surrounding text may not be in your roman font; if you care about matching text, you need to choose between \textrm, \textsf, and so on.

(The maths-mode instance of your roman font (\mathrm) gets the size right, but since it's intended for use in maths, its spaces get ignored - use \mathrm for upright roman alphabetic variable names, but not otherwise.)

You can correct these problems with size selectors in the text, as:

$z = a_{\mbox{\scriptsize other end}}$
which works if your surrounding text is at default document size, but gives you the wrong size otherwise.

These short cuts are (just about) OK for the "occasional" mathematician, but serious mathematics calls for a technique that relieves the typist of the sort of thought required. As usual, the AMSLaTeX system provides what's necessary - the \text command. The command is actually provided by the amstext package, but the "global" amsmath package loads it, so anyone using AMSLaTeX proper has the command available, so even joke mathematicians can write:

\usepackage{amsmath}
...
$z = a_{\text{other end}}$
and the text will be at the right size, and in the same font as surrounding text.

AMSLaTeX also makes provision for interpolated comments in the middle of one of its multi-line display structures, through the \intertext command. For example:

\begin{align}
  A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\
  A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\
  \intertext{and} A_3&=\mathcal{N}(\lambda;\omega).
\end{align}
places the text "and" on a separate line before the last line of the display. If the interjected text is short, or the equations themselves are light-weight, you may find that \intertext leaves too much space. Slightly more modest is the \shortintertext command from the mathtools package:
\begin{align}
  a =& b
  \shortintertext{or}
  c =& b
\end{align}
To have the text on the same line as the second equation, one can use the the flalign environment (from amsmath) with lots of dummy equations (represented by the double & signs):
\begin{flalign}
            && a =& b && \\
  \text{or} && c =& b &&
\end{flalign}

Comprehensive documentation of AMSLaTeX is to be found in amsldoc, in the distribution; it is also available on the web at ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf

amsldoc.tex
Distributed as part of AMSLaTeX macros/latex/required/amslatex (zip, browse)
amsmath.sty
Distributed as part of AMSLaTeX macros/latex/required/amslatex (zip, browse)
amstext.sty
Distributed as part of AMSLaTeX macros/latex/required/amslatex (zip, browse)
mathtools.sty
Distributed as part of the mh bundle macros/latex/contrib/mh (zip, browse)

This question on the Web: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=mathstext