Adding text in math mode in LaTeX

Posted: 4th December 2011 by Tim in LaTeX
Tags: , , , , , ,

Occasionally you’ll want to add some text to a maths equation in LaTeX. By default, any text is written in italics, and white space is ignored. The solution is quite simple; put the text in a \text{...} block like so:

$$x = \sqrt{x^2} \text{ : where $x$ is positive}$$

As you can see, you can also add math symbols from within the text block. This works from within any math mode; single dollar signs, double dollar signs, equation blocks and so on. Too easy.