# Cases with long math equation

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}
\end{document}

• Wow impressive! With x_u\in\left[y_l,y_u\right] that is above what I expected – JKHA Aug 14 at 13:38
• Upvote for to share \mfrac and \multlined, as these are new to me.... – MadyYuvi Aug 14 at 13:38
• @JKHA, oh this automatic replacement of left[ with \biggl[ ... corrected now – Zarko Aug 14 at 14:56

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}  • I thought it would be less readable wrapping my second equation, but probably I was wrong – JKHA Aug 14 at 13:02 • @JKHA it is pretty standard and it does fint on the paper. BTW: next time please provide a full minimal example including document class and minimal preamble like I do above. It makes it a lot faster for others to help you. – daleif Aug 14 at 13:07 • All right, I'll do it! – JKHA Aug 14 at 13:15 My suggestion is not to use cases, because it increases the interline spaces also inside nested alignments. Using multlined for the long middle equation does the job. \documentclass{article} \usepackage{amsmath,mathtools} \begin{document} \begin{equation*} V_{ijk} = \left\{ \begin{aligned} & \dfrac{y_u+y_l}2 - \dfrac{x_u+x_l}2, && \text{if }x_u < y_l \\[2ex] & \begin{multlined}[b] \dfrac{1}{C} \biggl[ \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} \biggr], \end{multlined} && \text{if }x_u\in [y_l,y_u] \\[2ex] & \dfrac{1}{x_u-x_l}\biggl[ \dfrac{(y_u+y_l)^2}6 - \dfrac{y_u+y_l}2 x_l + \dfrac{x_l^2}2 \biggr], && \text{otherwise} \end{aligned} \right. \end{equation*} \end{document}  Avoid code such as \frac1C that's hard to read and to maintain. Also note \biggl and \biggr instead of the unqualified \bigg. Also avoid align for single equations (which this is an example of). • "because it increases the interline spaces also inside nested alignments". Sure? Yesterday's conversation was quite about this point: aligned does not care about being inside cases. Am I misunderstanding the statement? – campa Aug 14 at 15:37 • @campa Uhm, that's quite bizarre indeed, but I guess multlined is affected. – egreg Aug 14 at 15:40 • Ah, good point, I missed that you were using multlined. – campa Aug 14 at 15:44 Here's a solution that employs a dcases* environment instead of the cases environment. The d in dcases denotes "display style"; this means, among other things, that one can write \frac instead of \dfrac in order to get "large" fraction terms. Note that I've removed unnecessary \left and \right directives. \documentclass{article} \usepackage{mathtools} % for 'dcases*' environment \begin{document} \[ V_{ijk} = \begin{dcases*} \frac{y_u+y_l}{2} - \frac{x_u+x_l}{2}\,, &if x_u < y_l\\[1ex] \begin{aligned}[b] &\frac{1}{C} \biggl[ \frac{x_u^3-y_l^3}{6}+\frac{y_l^2+x_u^2}{2}x_l + (x_u-y_l)\frac{x_l^2}{2}\\ &\quad + \frac{y_u^2-x_u^2}{2}(x_u-x_l) - (y_u-x_u)\frac{x_u^2-x_l^2}{2} \,\biggr]\,, \end{aligned} &if x_u\in[y_l,y_u] \\[1ex] \frac{1}{x_u-x_l} \biggl[ \frac{(y_u+y_l)^2}{6} - \frac{y_u+y_l}{2} x_l + \frac{x_l^2}{2} \,\biggr]\,, & otherwise \end{dcases*}
\end{document}