LaTeX provides commands for making overlines or underlines, or putting braces over or under some material.
\underline{text} Underline text. Works inside math mode, and outside. The line is always completely below the text, taking account of descenders, so in \(\underline{y}\) the line is lower than in \(\underline{x}\). This command is fragile (see \protect).
Note that the package ulem does text mode underlining and allows line breaking as well as a number of other features. See the documentation on CTAN. See also \hrulefill & \dotfill for producing a line, for such things as a signature.
\overline{text} Put a horizontal line over text. Works inside math mode, and outside. For example, \overline{x+y}. Note that this differs from the command \bar (see Math accents).
\underbrace{math} Put a brace under math. For example, this (1-\underbrace{1/2)+(1/2}-1/3) emphasizes the telescoping part. Attach text to the brace by using 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, as with \overbrace{x+x+\cdots+x}^{\mbox{\(k\) times}}. See also \underbrace.
The package mathtools adds an over- and underbrace, as well as some improvements on the braces. See the documentation on CTAN.
© 2007–2018 Karl Berry
Public Domain Software
http://latexref.xyz/Over_002d-and-Underlining.html