# Breaking equations in cases environment

Similar questions have been asked before, but my problem is a little different:

$$E_K \approx \begin{cases} - \sum\limits_{i = 1}^{N} K_1 \bri \left( \mathbf{m \bri} \cdot \unit{u} \bri \right)^2 V_i & \text{(Uniaxial)} \\ \sum\limits_{i = 1}^{N} [ K_1 \bri \left( m_x^2 \bri m_y^2 \bri + m_y^2 \bri m_z^2 \bri + m_x^2 \bri m_z^2 \bri \right) \\ \qquad + K_2 m_x^2 \bri m_y^2 \bri m_z^2 \bri ] Vi & \text{(Cubic)} \end{cases} \text{.}$$


The above code produces an output as shown below:

The description of the second case is not in the middle. How do I fix this? Also, I should have used \left[...\right] instead of [...]. But, that produces an error.

-
It produces an error because they are not on the same line. Use \bigl[...\bigr] instead. –  karlkoeller Jan 14 at 6:31

You can also use aligned. I borrowed the \smash idea from Mico.

\documentclass{article}
\usepackage{amsmath}
\newcommand*{\bri}{(\mathbf{r}_{i})}
\newcommand*{\unit}[1]{\hat{\mathbf{#1}}}
\begin{document}
E_K \approx \begin{cases} - \sum\limits_{i = 1}^{N} K_1 \bri \left( \mathbf{m \bri} \cdot \unit{u} \bri \right)^2 V_i & \text{(Uniaxial)} \\ \begin{aligned} &\smash[b]{\sum\limits_{i = 1}^{N}} \big[ K_1 \bri \big( m_x^2 \bri m_y^2 \bri + m_y^2 \bri m_z^2 \bri \\ &\qquad{}+ m_x^2 \bri m_z^2 \bri \big) \\ &\qquad{}+ K_2 m_x^2 \bri m_y^2 \bri m_z^2 \bri \big] Vi\end{aligned}& \text{(Cubic)} \end{cases}
\end{document}


Same thing works for two lines also. Again borrowing from Mico:

\documentclass{article}
\usepackage{amsmath}
\newcommand\bri{(\mathbf{r}_i)}
\newcommand\unit[1]{\hat{\mathbf{#1}}}
\begin{document}\pagestyle{empty}
E_K \approx \begin{cases} - \displaystyle\sum\limits_{i = 1}^{N} K_1 \bri \bigl[ \mathbf{m \bri} \cdot \unit{u} \bri \bigr]^2 V_i & \text{(Uniaxial)} \\[3ex] \begin{aligned} &\phantom{{}-}\smash[b]{\sum_{i = 1}^{N}} \bigl[ K_1 \bri \bigl( m_x^2 \bri m_y^2 \bri + m_y^2 \bri m_z^2 \bri \\[1ex] &\qquad{}+ m_x^2 \bri m_z^2 \bri \bigr) + K_2 m_x^2 \bri m_y^2 \bri m_z^2 \bri \bigr] V_i \end{aligned}& \text{(Cubic)} \end{cases}
\end{document}


-
I like the space @Mico has managed to set between the two capital sigmas. Do you think you can fix it to look like Mico's? –  Mario S. E. Jan 14 at 17:46
@MarioS.E. It is easy \\[3ex]. Fixed. –  Harish Kumar Jan 14 at 22:19

You could place the long expression following the second summation symbol in an array structure.

\documentclass{article}
\usepackage{mathtools} % for 'dcases' environment
\newcommand\bri{(\mathbf{r}_i)}
\newcommand\unit[1]{\hat{\mathbf{#1}}}
\begin{document}\pagestyle{empty}
$$E_K \approx \begin{dcases} - \sum_{i = 1}^{N} K_1 \bri \bigl( \mathbf{m \bri} \cdot \unit{u} \bri \bigr)^2 V_i & \text{(Uniaxial)} \\ \begin{array}{l} \displaystyle \smash[b]{\sum_{i = 1}^{N}} \Bigl[ K_1 \bri \bigl( m_x^2 \bri m_y^2 \bri \\ \qquad{}+ m_y^2 \bri m_z^2 \bri + m_x^2 \bri m_z^2 \bri \bigr) \\ \qquad{}+ K_2 m_x^2 \bri m_y^2 \bri m_z^2 \bri \Bigr] V_i \end{array}& \text{(Cubic)} \end{dcases}$$
\end{document}


If you want the second "case" to be split across just two lines, you could do something like the following; note the use of \phantom{-} to line up the two summation symbols:

\documentclass{article}
\usepackage{mathtools}
\newcommand\bri{(\mathbf{r}_i)}
\newcommand\unit[1]{\hat{\mathbf{#1}}}
\begin{document}\pagestyle{empty}
$$E_K \approx \begin{dcases} - \sum_{i = 1}^{N} K_1 \bri \bigl[ \mathbf{m \bri} \cdot \unit{u} \bri \bigr]^2 V_i & \text{(Uniaxial)} \\ \begin{array}{@{}l} \displaystyle \phantom{{}-} \sum_{i = 1}^{N} \bigl[ K_1 \bri \bigl( m_x^2 \bri m_y^2 \bri + m_y^2 \bri m_z^2 \bri \\ \qquad{} + m_x^2 \bri m_z^2 \bri \bigr) + K_2 m_x^2 \bri m_y^2 \bri m_z^2 \bri \bigr] V_i \end{array}& \text{(Cubic)} \end{dcases}$$
\end{document}

-
+1. Mico. I stole some code from you ;-) Hope you don't mind. :-) –  Harish Kumar Jan 14 at 7:11