# Cases with long math equation

by JKHA   Last Updated August 14, 2019 13:23 PM

What would be the best formatting of the following align and cases where the middle case has a very long math equation.

\begin{align*}
V_{ijk}& = \begin{cases}
\dfrac{y_u+y_l}2 - \dfrac{x_u+x_l}2,& \text{if }x_u < y_l\\[15pt]
\dfrac1C \bigg[\dfrac{x_u^3-y_l^3}{6}+\dfrac{y_l^2+x_u^2}{2}x_l + (x_u-y_l)\dfrac{x_l^2}{2}+ \dfrac{y_u^2-x_u^2}{2}(x_u-x_l)& - (y_u-x_u)\dfrac{x_u^2-x_l^2}{2} \bigg],
\\[12pt]& \text{if }x_u\in\left[y_l,y_u\right]\\[15pt]
\dfrac1{x_u-x_l}\bigg[\dfrac{(y_u+y_l)^2}6 - \dfrac{y_u+y_l}2 x_l + \dfrac{x_l^2}2\bigg],& \text{otherwise}
\end{cases}
\end{align*}


The main default of this current workaround which is nearly ok, is that there is an extra space before -(y_u-x_u) that is annoying. Note that I put the second if text under second equation because it would be too width for my memoir otherwise. Please favour simpliest solutions if possible :)

Tags :

I'm pretty sure it is a duplicate. But it is also easy to solve using aligned

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
V_{ijk}& = \begin{cases} \dfrac{y_u+y_l}2 - \dfrac{x_u+x_l}2,&
\text{if }x_u < y_l
\\[15pt]
\begin{aligned}[b]
&\dfrac1C \bigg[\dfrac{x_u^3-y_l^3}{6}+\dfrac{y_l^2+x_u^2}{2}x_l
+ (x_u-y_l)\dfrac{x_l^2}{2}
\\
&+ \dfrac{y_u^2-x_u^2}{2}(x_u-x_l) -
(y_u-x_u)\dfrac{x_u^2-x_l^2}{2} \bigg]
\end{aligned},
& \text{if }x_u\in\left[y_l,y_u\right]
\\[15pt]
\dfrac1{x_u-x_l}\bigg[\dfrac{(y_u+y_l)^2}6 - \dfrac{y_u+y_l}2 x_l
+ \dfrac{x_l^2}2\bigg],& \text{otherwise}
\end{cases}
\end{align*}
\end{document}

daleif
August 14, 2019 13:00 PM

## Braces and alignment

Updated December 06, 2018 14:23 PM