Centering, linebreaks and raggedright in underbrace text in mathmode
For a column this narrow, I think manual linebreaks work better. Then you don't have to specify an arbitrary column width (such as 2cm
). In addition, using a \makebox[0pt]
box allows for the underset text to not disturb the equation spacing (though the underbrace itself does a bit)
\documentclass{article}
\usepackage{amsmath,stackengine}
\setstackEOL{\\}
\newcommand{\sometext}{Given the conditions we impose}
\begin{document}
\[
x \underbrace{=}_{%
\makebox[0pt]{\tiny\Longunderstack[l]{Given the\\conditions\\we impose}}
}y
\]
\end{document}
With a little more work, you could restore the natural math spacing of the =
sign, though perhaps this is not important.
\documentclass{article}
\usepackage{amsmath,stackengine}
\setstackEOL{\\}
\newcommand\undertext[3][3pt]{%
\mathrel{\stackengine{#1}{$#2$}{$\underbrace{}_{%
\makebox[0pt]{\tiny\Longunderstack[l]{#3}}}$}{U}{c}{F}{T}{L}}%
}
\begin{document}
\[
x \undertext{=}{Given the\\conditions\\we impose} y
\]
\end{document}
An approximative and rudimental solution. but it works. It is possible to fit the space between x
and y
fixing \hspace{-.5cm}
.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\[
x\hspace{-.5cm}\underbrace{=}_{\mbox{\tiny{\begin{tabular}{cc} Given the\\conditions\\we impose\end{tabular}}}}\hspace{-.45cm}y
\]
\end{document}