# Conflicting multi-line underbrace labels

Sometimes a \makebox gives nice underbrace, sometimes multiline version with \parbox works. But how to combine two multiline-underbrace-equation-labels side by side and make them look good?

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}
\usepackage{enumitem}

\begin{document}

\begin{align*}
MR &\stackrel{!}{=} MC \\
&\Leftrightarrow \underbrace{\overline{p}_x = \frac{r}{1-\alpha}}_{\text{\makebox[0pt]{MR from production of intermediate good} } } \stackrel{!}{=} \underbrace{\frac{\partial Y}{\partial K} = (1-\alpha) \cdot \frac{Y}{K}}_{\text{\parbox{15em}{marg. rental cost (opp. costs!) due \\ to perfect competition on \underline{goods market}}}}
\end{align*}

\end{document}


Just using two \parbox and adjust their size to the formular does not look good! There's resulting 3-4 linebreaks. I hope to get the text in maximum two lines.

(1) makebox gives nice spread under the formula (2) parbox enables multiline text

How to combine both features?

Thank you very much.

• Try \parbox{0.3\linewidth}{<content>} for both and remove the forced linebreak \\. – azetina Apr 10 '15 at 14:39
• The solutions with 2 \parboxes spreads the formula very much. I then can read the labels but the math looks horrible :/ – Mac Apr 10 '15 at 14:42
• Try the mathtools command \clap in the form \clap{\footnotesize\parbox{0.2\linewidth}{<content>}} – azetina Apr 10 '15 at 14:54
• :( unfortunately I did not manage to load mathtools yet .. some people recommended it. Don't know how to install it manually (TexnicCenter doesn't do it on its own). – Mac Apr 10 '15 at 14:56
• Mathtools now working, each single text looks nice with \clap{\footnotesize\parbox{0.3\linewidth} ... but those text boxes are still overlapping. – Mac Apr 11 '15 at 11:07

If you hide the widths then you get over-printing without warning. I'm not sure it really works to have so much text in an underbrace, but a couple of suggestions:

\documentclass[15pt, a4paper]{scrartcl}
\usepackage{amsmath,amssymb}
\usepackage{enumitem}

\begin{document}

this
\begin{align*}
MR &\stackrel{!}{=} MC \\
&\Leftrightarrow
\underbrace{\overline{p}_x = \frac{r}{1-\alpha}}_{\text{\shortstack{MR from\\ production of\\ intermediate good}}}
\stackrel{!}{=}
\underbrace{\frac{\partial Y}{\partial K} = (1-\alpha) \cdot \frac{Y}{K}}_{\text{\shortstack{marg. rental cost\\ (opp. costs!)\\ due to perfect\\ competition on \underline{goods market}}}}
\end{align*}

or this
\begin{align*}
MR &\stackrel{!}{=} MC \\
&\Leftrightarrow
\underbrace{\overline{p}_x = \frac{r}{1-\alpha}}_{\dagger}
\stackrel{!}{=}
\underbrace{\frac{\partial Y}{\partial K} = (1-\alpha) \cdot \frac{Y}{K}}_{\ddagger}
\end{align*}

$\dagger$: $MR$ from production of intermediate good.

$\ddagger$: Marg. rental cost (opp. costs!) due to perfect competition on \underline{goods market}

\end{document}

• What's the difference between \shortstack and \substack? – Manuel Apr 10 '15 at 15:21
• @Manuel hort isn't ub ? \shortstack is defined in the latex format and is text \substack is defined in amsmath and is math. Same as difference between array and tabular. – David Carlisle Apr 10 '15 at 15:24
• Maybe the workaround with placeholders is best :) – Mac Apr 11 '15 at 11:11