[Tex/LaTex] Conflicting multi-line underbrace labels

braceslabelsmath-mode

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?

enter image description here

Thank you very much.

Best Answer

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:

enter image description here

\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}