Originally Posted by

**William McCormick**
Is how I learned the formula for ammonia. I like it. I like it. Nice work.

Not exactly, William. If you want the formula for ammonia, you should type this:

- \mbox{NH}_3

Well, I’m glad to know you’re enjoying TeX as well.

And this brings us nicely to another topic:

**Text formatting in TeX**
TeX format raw letters of the alphabet in italics: wrapping the tags around “abc de” gives

(with the space removed). Suppose you want regular font, no italics? Well, there are at least four ways of formatting regular font in TeX. One of them, as I’ve used above, is the command \mbox. The others are \text, \textrm and \mathrm.

- \mbox{abc de}

\text{abc de}

\textrm{abc de}

\mathrm{abc de}

Notice that the typed space is ignored in the last one, \mathrm. In fact, with \mathrm, the whole input is parsed like any TeX expression, with relevant spaces added and redundant spaces removed, the sole exception being that variables are not italicized. Example:

- G=6.674\times10^{-11}\ \mathrm{m^3\:kg^{-1}\:s^{-2}} =

With the other three, what you type is parsed as plain text. If you need to format a small amout of your text as a math or math-type expression, it is handy to enclose it within a pair of dollar ($) signs:

- \textrm{Water is H$_2$O.}

In a moment, we shall see that \mbox together with $ has a very special property of its own.

To format TeX expressions in italics, use \textit or \mathit. Since letters of the alphabet are already formatted in italics by default, this will probably be used for formatting other characters, particularly numerals.

- \textit{123 45}

\mathit{123 45}

Bold is \textbf and \mathbf.

- \textibf{abc 123}

\mathbf{abc 123}

And with a bit of ingenuity, you can combine the two.

- \textbf{$\textit{123 45}$}

Finally, a word about \mbox{$…$}. This has the property that it preserves the size of whatever it is formatting. Take an example: X^X gives

. The superscripted X is slightly smaller than the other X. Suppose you want both Xs to be of the same size? Then use \mbox{$…$}!

- X^X

X^\mbox{$X$}

Note: the dollar signs can be omitted if only numerals are being formatted. This is particularly handy when you have fractions within a fraction and you don’t want TeX to make things too small to be legible:

- \frac{1}{1+\frac{1}{2}}

\frac{\mbox{1}}{\mbox{$1+\frac{\mbox{1}}{\mbox{2}} }$}

The down side, obviously, is that your expression can quickly become too complicated with too many mboxes, so this will probably be something you’ll only want to use occasionally.