以前也问过类似的问题,但我的问题略有不同:
\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}
上述代码产生如下所示的输出:
第二种情况的描述不在中间。我该如何解决这个问题?另外,我应该使用\left[
...\right]
而不是[
... ]
。但是,这会产生错误。
答案1
您可以将长表达式放在结构中的第二个求和符号后面array
。
\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}
如果您希望将第二个“案例”分成两行,您可以执行以下操作;请注意使用\phantom{-}
来排列两个求和符号:
\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
您也可以使用aligned
。我借鉴了\smash
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}
同样的方法也适用于两行。再次借用 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}