Displaying text inside the math-environment

By thurnherr

By default, Latex will print text within formulas in italics, omitting white spaces. Now if you need to add normal text into a formula or even write a formula using words, you can do this with the text-command inside the math-environment:

\text{...}

Example:

\text{velocity} = \frac{\text{distance}} {\text{unit of time}}

velocity=\frac{distance}{unit of time} \to \text{velocity} = \frac{\text{distance}}{\text{unit of time}}

Btw. The “text-command” will also take care of the spaces, which would otherwise be ignored.

Note:
Spaces in the math-environment can be produced using:

  • \; for a thick space,
  • \: for a medium space,
  • \, for a thin space and
  • \! for a negative thin space.
Intertext

Using the math-environment align to display a series of equations, whole lines of text can be added in between using the “intertext”-command without affecting the alignment of the equations:

\begin{align}
...
\intertext{...}
...
\end{align}

Example:

\begin{align}
F = f_1+f_2+f_3+...+f_n
\intertext{can be written as}
\sum_1^n{f_i}
\end{align}

Tags: , , ,

2 Responses to “Displaying text inside the math-environment”

  1. Thomas Says:

    Not exactly sure how powerful \text is, but in case it doesn’t work or doesn’t do what you want, try \mbox instead. It’s just a box that, within a math environment or not, uses the font of the surrounding text.

  2. Lorenzo Says:

    It’s soooo ugly seeing variable names in formulas written without \text{} or \mbox{}… I think it’s one of the most common mistakes…

    nice post!

Leave a Reply