When typesetting the below annotated equation my summations are being typeset as inline maths rather than display maths.
- If I wrap the sum and subscript with
\smashoperator{}
then they are typeset correctly as display math again. - I've tried multiple outermost wrappers for the array of arrays,
\begin{equation}
,\begin{align}
starred and unstarred,\[ ... \]
,\begin{gather}
.
I'm aware of the existance of the \displaystyle
macro, I don't want to set it globally if at all posible, I have inline maths elsewhere in my document. In all honesty I'd like to find out what I'm doing wrong and fix that rather than stick a macro in there to fix my poor tex-ing).
I compile my document with LuaLaTeX
, MWE follows.
\documentclass[a4paper]{book}
\usepackage{mathtools}
\usepackage{lipsum}
\begin{document}
\lipsum[1]
\begin{equation}
\begin{array}{ll} % array to ensure the force field and the braces are aligned, as the non-bonded terms are a little wider than the bonded.
\begin{array}{rcl} % bonded terms.
U &=& \sum_{\text{bonds},\, i} K_{b,i} \left( b_i - b_{0,i} \right)^2 \\
&+& \sum_{\text{angles},\, i} K_{\theta,i} \left( \theta_i - \theta_{0,i} \right)^2 \\
&+& \sum_{\text{dihedrals},\, i}%
K_{\phi,i} \left( 1 - \cos\left( n\phi_i - \phi_{0,i} \right) \right) \\
&+& \sum_{%
\substack{\text{improper},\, i\\ \text{dihedrals}}%
} K_{\omega,i} \left( \omega_i - \omega_{0,i} \right)^2 \\
\end{array}%
& \left. \vphantom{% Phantom content to make brace correct size. \left. \right\} Havent worked when across two columns in array...
\begin{array}{rcl}
U &=& \sum_{\text{bonds},\, i} K_{b,i} \left( b_i - b_{0,i} \right)^2 \\
&+& \sum_{\text{angles},\, i} K_{\theta,i} \left( \theta_i - \theta_{0,i} \right)^2 \\
&+& \sum_{\text{dihedrals},\, i}%
K_{\phi,i} \left( 1 - \cos\left( n\phi_i - \phi_{0,i} \right) \right) \\
&+& \sum_{%
\substack{\text{improper},\, i\\ \text{dihedrals}}%
} K_{\omega,i} \left( \omega_i - \omega_{0,i} \right)^2 \\
\end{array}
}%
\right\} \text{bonded} \\
\begin{array}{rcl} % non-bonded terms.
\hphantom{U} &+& \sum_{\text{atoms},\, i,j} \epsilon_{ij}%
\left[%
\left(%
\frac{ r^{min}_{ij} } { r_{ij} }%
\right)^{12}%
-2 \left(%
\frac{ r^{min}_{ij} }{ r_{ij} }%
\right)^6%
\right] \\
&+& \sum_{\text{atoms},\, i,j}%
\frac{1}{4\pi\epsilon_0\epsilon_r}\frac{q_i q_j}{ r_{ij} }
\end{array}%
& \left. \vphantom{% Phantom content to make brace correct size. \left. \right\} Havent worked when across two columns in array...
\begin{array}{rcl} % non-bonded terms.
\phantom{U} &+& \sum_{\text{atoms},\, i,j} \epsilon_{ij}%
\left[%
\left(%
\frac{ r^{min}_{ij} } { r_{ij} }%
\right)^{12}%
-2 \left(%
\frac{ r^{min}_{ij} }{ r_{ij} }%
\right)^6%
\right] \\
&+& \sum_{\text{atoms},\, i,j}%
\frac{1}{4\pi\epsilon_0\epsilon_r}\frac{q_i q_j}{ r_{ij} }
\end{array}
}%
\right\} \text{non-bonded}
\end{array}
\end{equation}
\lipsum[2-3]
\end{document}
array
package and do\begin{array}{rc>{\displaystyle}l}
array
to define new column types for elsewhere in the document. I'm not attached to the array environment here, just the alignment I've achieved with it. If another suggestion comes up without using\begin{array}
I'll look at that too.