[Tex/LaTex] ignoring vertical space due to underbraces in cases environment

amsmathspacing

In the following formula, I would like to change the rendering such that the lower end of the "cases" brace looks as if there were no underbraces. Is that possible? I already tried \smash and negative \vspaces to no avail.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newcommand\terma{\left( 1\!-\!e^{\frac{-\lambda_2^2}{2\alpha^2\lambda_3^2}}\right)}
\newcommand\termb{e^{\frac{-\lambda_1^2}{2\beta^2|\lambda_2\lambda_3|}}}
\newcommand\termc{\left( 1-e^{\frac{-\sum_i\lambda_i^2}{2c^2}}\right)}

\[
\mathcal V(\sigma)=
 \begin{cases}
     0    & \text{if $\lambda_2>0$ or $\lambda_3>0$,}\\
     \underbrace{\terma}_{A}
     \underbrace{\termb\vphantom{\terma}}_{B}
     \underbrace{\termc\vphantom{\terma}}_{C}
     &\text{else}.
 \end{cases}
\]
\end{document}

Best Answer

You can use a combination of \smash and \vphantom to get the desired effect. First we need to use a \smash to "flatten out" the contents. Then we use a \vphantom to get the brace to the correct height fir just the terms and not the underbraces. Finally we need to add an additional \vphantom in order to give the entire expression the correct height, such that following text will not be superimposed on it. In all the code would look like this:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\newcommand\terma{\left( 1\!-\!e^{\frac{-\lambda_2^2}{2\alpha^2\lambda_3^2}}\right)}
\newcommand\termb{e^{\frac{-\lambda_1^2}{2\beta^2|\lambda_2\lambda_3|}}}
\newcommand\termc{\left( 1-e^{\frac{-\sum_i\lambda_i^2}{2c^2}}\right)}
\[
\mathcal V(\sigma)=
 \begin{cases}
     0    & \text{if $\lambda_2>0$ or $\lambda_3>0$,}\\
     \vphantom{\terma}
     \smash{\underbrace{\terma}_{A}}
     \smash{\underbrace{\termb\vphantom{\terma}}_{B}}
     \smash{\underbrace{\termc\vphantom{\terma}}_{C}}
     &\text{else}.
 \end{cases}
 \vphantom{\begin{cases}
     0    & \text{if $\lambda_2>0$ or $\lambda_3>0$,}\\
     \underbrace{\terma}_{A}
     \underbrace{\termb\vphantom{\terma}}_{B}
     \underbrace{\termc\vphantom{\terma}}_{C}
     &\text{else}.
 \end{cases}}
\]
\end{document}

And the result:

case braces

Related Question