16.5 Over- or under math

LaTeX provides commands for putting lines, braces, and arrows over or under math material.

\underline{math}

Underline math. For example: \underline{x+y}. The line is always completely below the text, taking account of descenders, so in \(\underline{y}\) the line is lower than in \(\underline{x}\). As of approximately 2019, this command and others in this section are robust; before that, they were fragile (see \protect).

The package ulem (https://ctan.org/pkg/uelem) does text mode underlining and allows line breaking as well as a number of other features. See also \hrulefill & \dotfill for producing a line for such things as a signature or placeholder.

\overline{math}

Put a horizontal line over math. For example: \overline{x+y}. This differs from the accent command \bar (see Math accents).

\underbrace{math}

Put a brace under math. For example: (1-\underbrace{1/2)+(1/2}-1/3).

You can attach text to the brace as a subscript (_) or superscript (^) as here:

\begin{displaymath}
  1+1/2+\underbrace{1/3+1/4}_{>1/2}+
       \underbrace{1/5+1/6+1/7+1/8}_{>1/2}+\cdots
\end{displaymath}

The superscript appears on top of the expression, and so can look unconnected to the underbrace.

\overbrace{math}

Put a brace over math. For example:
\overbrace{x+x+\cdots+x}^{\mbox{\(k\) times}}.

\overrightarrow{math}

Put a right arrow over math. For example: \overrightarrow{x+y}.

\overleftarrow{math}

Put a left arrow over math. For example: \overleftarrow{a+b}.

The package mathtools (https://ctan.org/pkg/mathtools) adds an over- and underbracket, as well as some improvements on the braces.


Unofficial LaTeX2e reference manual