Text underneath an underbrace and above an overbrace in LaTeX

This tutorial teaches you how to get text underneath an underbrace and above an overbrace in LaTeX. Generally, we use \underbrace and \overbrace to get a brace under or above an equation.

In order to get text underneath an underbrace and above an overbrace you can use _ and ^.

\documentclass{article}
\begin{document}
\[
\underbrace{a+b}_{Sum \;of \;a,b} + \overbrace{m-n}^{Sub\; of\;m,b}
\]
\end{document}

Output:

text underneath an underbrace and above an overbrace.
But, you can see the above example, here the text doesn’t look good for an equation. So you can use the \text{} command provided by the amsmath package to write text. Take a look.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{a+b}_{\text{Sum of a,b}} + \overbrace{m-n}^{\text{Sub of m,b}}
\]
\end{document}

Output:

text underneath an underbrace and above an overbrace.
More examples,

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
\underbrace{a+b}_{\text{Sum of a,b}} + \overbrace{m-n}^{\text{Sub of m,b}}
\]
\[
f = \underbrace{x^3}_\text{text 1} + \overbrace{2}_\text{text 2}
\]
\[
\underbrace{u'-P(x)u^2-Q(x)u-R(x)}_{\text{$=0$, since $u$ is a particular solution.}}
\]
\end{document}

Output:

text underneath an underbrace and above an overbrace.

Leave a Reply

Your email address will not be published. Required fields are marked *