How can I place text under a bracket\brace that isn't all one line
You could place the text in the second argument of \underbrace
in a \parbox
whose width is set to the width of the first argument of \underbrace
. However, doing this manually can be tedious. Especially if you have several expressions like the one shown in your posting, it's a good idea to set up a dedicated macro to take care of the formatting chores. In the following example, this macro is called \bigbrace
.
\documentclass{article}
\usepackage{amsmath,ragged2e}
\newlength\mylen
\newcommand\bigbrace[2]{%
\settowidth\mylen{$\displaystyle #1$}
\underbrace{#1}_{\parbox{\mylen}{\scriptsize\Centering #2}}}
\begin{document}
\[
\bigbrace{203948x^{3}+209204024x^2-18909345x}{How can I place a text
that isn't on one long line, but aligned underneath the brace?}
\]
\end{document}
With stackengine
for manual line breaks, or defining a \boxedunderbrace
command, based on the eqparbox
package for an automatic line break: the text is placed in a \parbox
of width equal to the formula width. It requires a tag as an optional argument (M
by default) so as to differentiate multiple uses of \boxedunderbrace
s. Two compilations are necessary.
\documentclass{article}
\usepackage{amsmath,ragged2e}
\usepackage[usestackEOL]{stackengine}
\usepackage{eqparbox}
\newcommand\boxedunderbrace[3] [M] {\underbrace{\eqmakebox[#1]{$\displaystyle#2$} }_{\scriptsize\parbox{\eqboxwidth{#1}}{\centering#3}}}
\begin{document}
\[
\underbrace{203948x^{3}+209204024x^2-18909345x}_{\scriptsize\Centerstack{How can
I place a text that isn't on one long\\ line, but aligned underneath
the brace?}}
\]
\[
\boxedunderbrace[M]{203948x^{3}+209204024x^2-18909345x}{How can
I place a text that isn't on one long line, but aligned underneath the brace?}
\]
\end{document}