Cases with long math equation
with \mfrac
from nccmath
and multlined
from the mathtools
package:
\documentclass{article}
\usepackage{mathtools, nccmath}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\[
V_{ijk} = \begin{cases}
\mfrac{y_u+y_l}{2} - \mfrac{x_u+x_l}{2}, &\text{if }x_u < y_l \\[3ex]
\begin{multlined}
\mfrac{1}{C} \bigg[\mfrac{x_u^3-y_l^3}{6}+\mfrac{y_l^2+x_u^2}{2}x_l
+ (x_u-y_l)\mfrac{x_l^2}{2}\\[-2ex]
+ \mfrac{y_u^2-x_u^2}{2}(x_u-x_l) - (y_u-x_u)\mfrac{x_u^2-x_l^2}{2} \biggr]
\end{multlined},
& \text{if }x_u\in [y_l,y_u ]
\\[5ex]
\mfrac{1}{x_u-x_l}\biggl[\mfrac{(y_u+y_l)^2}{6} - \mfrac{y_u+y_l}{2} x_l
+ \mfrac{x_l^2}{2}\biggr],& \text{otherwise}
\end{cases}
\]
\end{document}
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}
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}