16 Math formulas

Produce mathematical text by putting LaTeX into math mode or display math mode (see Modes). This example shows both.

The wave equation for \( u \) is
\begin{displaymath}
  \frac{\partial^2u}{\partial t^2} = c^2\nabla^2u
\end{displaymath}
where \( \nabla^2 \) is the spatial Laplacian and \( c \) is constant.

Math mode is for inline mathematics. In the above example it is invoked by the starting \( and finished by the matching ending \). Display math mode is for displayed equations and here is invoked by the displaymath environment. Note that any mathematical text whatever, including mathematical text consisting of just one character, is handled in math mode.

When in math mode or display math mode, LaTeX handles many aspects of your input text differently than in other text modes. For example,

contrast x+y with \( x+y \)

in math mode the letters are in italics and the spacing around the plus sign is different.

There are three ways to make inline formulas, to put LaTeX in math mode.

\( mathematical material \)
$ mathematical material $
\begin{math} mathematical material \end{math}

The first form is preferred and the second is quite common, but the third form is rarely used. You can sometimes use one and sometimes another, as in \(x\) and $y$. You can use these in paragraph mode or in LR mode (see Modes).

To make displayed formulas, put LaTeX into display math mode with either:

\begin{displaymath}
  mathematical material
\end{displaymath}

or

\begin{equation}
  mathematical material
\end{equation}

(see displaymath, see equation). The only difference is that with the equation environment, LaTeX puts a formula number alongside the formula. The construct \[ math \] is equivalent to \begin{displaymath} math \end{displaymath}. These environments can only be used in paragraph mode (see Modes).

The American Mathematical Society has made freely available a set of packages that greatly expand your options for writing mathematics, amsmath and amssymb (also be aware of the mathtools package that is an extension to, and loads, amsmath). New documents that will have mathematical text should use these packages. Descriptions of these packages is outside the scope of this document; see their documentation on CTAN.


Unofficial LaTeX2e reference manual