224

I am looking to do something of the following:

formula with underbrace

To get text underneath the underbrace. Is it involving \stackrel or some sort of similar command?

2 Answers 2

262

The amsmath package provides \text{<stuff>} that typesets <stuff> in text mode, while still respecting the relative font size:

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\[
\underbrace{u'-P(x)u^2-Q(x)u-R(x)}_{\text{=0, since~$u$ is a particular solution.}}
\]
\end{document}

Underbrace with text

For example, if you want to scale the font in the \underbrace, you could use (say) \underbrace{...}_{\text{\normalfont ...}}:

Underbrace with normal sized font

Although the spacing is different, math expressions (regardless of its simplicity) are usually better typeset in math mode. Consequently, you could also use \text{$=0$, since...} as suggested by @Gonzalo.


Other bracing commands also exist and is provided by the mathtools package. For example, the following example illustrates the use of \underbracket:

\documentclass{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\begin{document}
\[
\underbracket{u'-P(x)u^2-Q(x)u-R(x)}_{\text{=0, since~$u$ is a particular solution.}}
\]
\end{document}

Underbracket as provided by mathtools

Modifying the width and depth/height is also possible using \underbracket[<width>][<depth>]{<stuff>} or \overbracket[<width>][<height>]{<stuff>}.

4
  • 17
    It would be better to use \text{$=0$, since...}. Sep 30, 2011 at 18:56
  • 2
    Thought about it, but it didn't match the spacing supplied by the OP. I'll leave it for interpretation of the user.
    – Werner
    Sep 30, 2011 at 19:01
  • What can be done if the text is long and we want to continue in the next line under the formula?
    – Amin
    Mar 13, 2021 at 7:21
  • @Katatonia: One option is to use \substack. See Expression under summation on multiple lines (duplicate).
    – Werner
    Mar 14, 2021 at 20:57
43

In addition to the \underbrace and \underbracket commands provided by the amsmath and mathtools packages, respectively, I think it's also worth knowing about the \undercbrace command, provided by the mtpro2 package, to generate a "curly" underbrace that can be up to 10cm (4 inches) wide.

The downside of using the mtpro2 package -- other than the fact that it's not entirely free, but is available at a very reasonable cost -- is that it uses a "Times Roman"-style font rather than the Computer Modern font. Of course, the non-use of Computer Modern needn't be a downside at all. :-)

The following MWE illustrates how the mtpro2 curly underbrace differs from the "regular" or "straight" underbrace provided by the amsmath package.

\documentclass{article}
\usepackage{amsmath,times,mtpro2} %% times package needed only to load TNR text font
\begin{document}
\[
\undercbrace{u'-P(x)u^2-Q(x)u-R(x)}_{\text{$=0$ since~$u$ is a particular solution.}}
\]

\[
\underbrace{u'-P(x)u^2-Q(x)u-R(x)}_{\text{$=0$ since~$u$ is a particular solution.}}
\]
\end{document}

enter image description here

4
  • 1
    Thanks Mico, that a new package I'm going to look into that I have not wandered in yet. Useful to know info.
    – night owl
    Oct 1, 2011 at 23:03
  • 1
    @nightowl - There are two reasons (in my mind) for becoming familiar with the MathTime Pro package. First, when Times New Roman (TNR) is scaled down to script- and scriptscript-sizes, the glyphs look downright skinny, making TNR's use for heavy-duty math typesetting rather problematic. Second, TNR's "big" sum and integrals symbols are also rather unattractive. MathTime Pro provides well-proportioned large operators and has two optical sizes below "regular" text size, making its math output very legible. Its "curly" big vertical and horizontal braces are nice but probably not as crucial...
    – Mico
    Oct 2, 2011 at 0:18
  • Mico, so to get it straight with mtpro2 package. The use for it is when using very large sized math operators such as summations or integral signs and things such as this, correct?
    – night owl
    Oct 3, 2011 at 3:37
  • @nightowl: I'd say that if you need to use a TNR text font, there are (at least) two very good reasons for considering the mtpro2 package rather than, say, matptmx or txfonts, for matching math fonts: (a) good-looking "large" math operators and (b) special designs for characters for first- and second-order subscripts to avoid anorexic-looking glyphs.
    – Mico
    Oct 3, 2011 at 10:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .