In a previous post (Typesetting text in math mode) I advertised the use of \mbox
to write text in mathematical formulas. This works when you are in the "standard size", but looks funny if you have subscripts because the sizes are off:
$ 50 \mbox{ apples}_{\mbox{yellow}} \times 100 \mbox{ apples}_{\mbox{red-green}} = \mbox{lots of apples}^{\mbox{to eat}} $
looks like
In these cases (and also in the standard cases but there it looks the same), you can use the command \text
which will come out in the right font size. In addition to just \text
, there is also \textbf
(bold face), \textit
(italics) and \texttt
(typewriter).
$ 50 \text{ apples}_{\text{yellow}} \times 100 \textit{ apples}_{\texttt{red-green}} = \textbf{lots of apples}^\text{to eat} $
looks like
Note: Most of the time \text
should just work in math mode without any packages, but for some distributions you need to explicitly load the package amstext or amsmath.