texblog

Normal text in math mode

The font type LaTeX uses in math mode is somewhat special since it is optimized for writing mathematical formulas. Letters are printed in italics, with more space left in-between, spaces are ignored. In certain cases it may be desirable to include “normal text” within an equation. There is a simple way to add “normal text” fragments in math mode.

$...\textrm{normal text}...$

Alternatively, using the amsmath package:

\usepackage{amsmath}

$...\text{normal text}...$

Normal text can be added no matter which math mode you are using.

Consider the following descriptive illustration of the fraction notation, first in math mode and below in “normal text”.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
	fraction&=\frac{numerator}{denominator}\\
	&\\
	\text{fraction}&=\frac{\text{numerator}}{\text{denominator}}
\end{align*}
\end{document}

Taking a closer look at the first two characters of “fraction” in math mode shows that LaTeX assigns them more space, giving the word a somewhat unnatural appearance.

Here is another example where switching to normal text is desirable. Any whitespace is added in “normal text” mode since math mode ignores it.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
	f(x) =
	\begin{cases}
		0 & \text{if $x=0$,}\\
		\frac{1}{x} & \text{otherwise.}
	\end{cases}
\]
\end{document}

See User Guide for the amsmath Package for more details on the amsmath package.

Addendum
For multi-letter variables in math mode, use \mathit{} to omit whitespace in-between letters. Can you see the difference?

$\mathit{def}$

Thanks for your comment João!

Exit mobile version