4

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

\begin{equation}
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{.}
\end{equation}

The above code produces an output as shown below:

enter image description here

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 '14 at 6:31
10

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

enter image description here

\documentclass{article} 
\usepackage{mathtools} % for 'dcases' environment
\newcommand\bri{(\mathbf{r}_i)}
\newcommand\unit[1]{\hat{\mathbf{#1}}}
\begin{document}\pagestyle{empty}
\begin{equation}
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{equation}
\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:

enter image description here

\documentclass{article} 
\usepackage{mathtools}
\newcommand\bri{(\mathbf{r}_i)}
\newcommand\unit[1]{\hat{\mathbf{#1}}}
\begin{document}\pagestyle{empty}
\begin{equation}
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{equation}
\end{document}
  • 2
    +1. Mico. I stole some code from you ;-) Hope you don't mind. :-) – user11232 Jan 14 '14 at 7:11
8

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

enter image description here

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

enter image description here

  • 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 '14 at 17:46
  • @MarioS.E. It is easy \\[3ex]. Fixed. – user11232 Jan 14 '14 at 22:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.