How to left align text inside a gathered equation environment

I am currently trying to add an equation to my thesis and due to the length of it I would like to use short hand to split the equation up. What I would like to achieve is a equation with two line breaks, followed by a left aligned where, and the other equations under one gathered environment with the equation number aligned to the top line. I have achieved most of this but I cannot get the "where" line left aligned in a gathered environment, I have tried \intertext and it doesn't appear to work when using gathered. Any suggestions?

$$\label{eq:triclinic(hkl)} \begin{gathered}[t] \frac{1}{d^2} = \frac{1}{V^2} (S_{11}h^2 + S_{22} k^2 + S_{33} \ell^2 + 2S_{12}hk + 2S_{23}k\ell + 2S_{13}h\ell)\\~\\ \text{where}\\~\\ V = abc \sqrt{1 - cos^2(\alpha) - cos^2(\beta) - cost^2(\gamma) + 2cos(\alpha) cos(\beta) cos(\gamma)}\\ S_{11} = b^2c^2sin^2(\alpha)\\ S_{22} = a^2c^2sin^2(\beta)\\ S_{33} = a^2 b^2 sin^2 (\gamma)\\ S_{12} = abc^2 (cos(\alpha) cos(\beta) - cos(\gamma))\\ S_{23} = a^2bc (cos(\beta) cos(\gamma) - cos(\alpha)\\ S_{13} = ab^2c (cos(\gamma) cos(\alpha) - cos(\beta)\\ \end{gathered}$$

• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – dexteritas Aug 30 '18 at 16:06
• welcome to tex.se! your question is not "overleaf" specific, so i delete its tag. try to use gather only. – Zarko Aug 30 '18 at 16:06

You can set this in an align and use \notag to remove any equation numbers for equations you don't need numbered:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

Original equation
$$\begin{gathered}[t] \frac{1}{d^2} = \frac{1}{V^2} (S_{11}h^2 + S_{22} k^2 + S_{33} \ell^2 + 2S_{12}hk + 2S_{23}k\ell + 2S_{13}h\ell)\\~\\ \text{where}\\~\\ V = abc \sqrt{1 - cos^2(\alpha) - cos^2(\beta) - cost^2(\gamma) + 2cos(\alpha) cos(\beta) cos(\gamma)}\\ S_{11} = b^2c^2sin^2(\alpha)\\ S_{22} = a^2c^2sin^2(\beta)\\ S_{33} = a^2 b^2 sin^2 (\gamma)\\ S_{12} = abc^2 (cos(\alpha) cos(\beta) - cos(\gamma))\\ S_{23} = a^2bc (cos(\beta) cos(\gamma) - cos(\alpha)\\ S_{13} = ab^2c (cos(\gamma) cos(\alpha) - cos(\beta)\\ \end{gathered}$$

Proposed improvement
\begin{align}
\frac{1}{d^2} &= \frac{1}{V^2} \bigl( S_{11}h^2 + S_{22} k^2 + S_{33} \ell^2 + 2S_{12}hk + 2S_{23}k\ell + 2S_{13}h\ell \bigr) \\
\shortintertext{where}
V &= a b c \sqrt{1 - \cos^2(\alpha) - \cos^2(\beta) - \cos^2(\gamma) + 2 \cos(\alpha) \cos(\beta) \cos(\gamma)} \notag \\
S_{11} &= b^2 c^2 \sin^2(\alpha) \notag \\
S_{22} &= a^2 c^2 \sin^2(\beta) \notag \\
S_{33} &= a^2 b^2 \sin^2 (\gamma) \notag \\
S_{12} &= a b c^2 \bigl( \cos(\alpha) \cos(\beta) - \cos(\gamma) \bigr) \notag \\
S_{23} &= a^2 b c \bigl( \cos(\beta) \cos(\gamma) - \cos(\alpha) \bigr) \notag \\
S_{13} &= a b^2 c \bigl( \cos(\gamma) \cos(\alpha) - \cos(\beta) \bigr) \notag
\end{align}

\end{document}

• You missed some cos’s. ;-) I’d also remove all those parentheses since angles in trigonometric functions don’t need them. – Ruixi Zhang Aug 30 '18 at 16:40
• @RuixiZhang: Thanks for identifying the missing \cos's. I've left the brackets in there because this might be personal preference. – Werner Aug 30 '18 at 16:52

I propose this layout:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{align}
\frac{1}{d^2} &= \frac{1}{V^2} \bigl( S_{11}h^2 + S_{22} k^2 + S_{33} \ell^2 + 2S_{12}hk + 2S_{23}k\ell + 2S_{13}h\ell \bigr) \\
\intertext{where \quad\begin{array}[t]{|l@{}} V = a b c \sqrt{1 - \cos^2\alpha - \cos^2\beta - \cos^2\gamma + 2 \cos\alpha \cos\beta \cos\gamma} \\[1ex] \begin{aligned}[t] S_{11} &= b^2 c^2 \sin^2\alpha \qquad & S_{12} &= a b c^2 \bigl( \cos\alpha \cos\beta - \cos\gamma \bigr) \\ S_{22} &= a^2 c^2 \sin^2\beta & S_{23} &= a^2 b c \bigl( \cos\beta \cos\gamma - \cos\alpha \bigr)\\ S_{33} &= a^2 b^2 \sin^2 \gamma & S_{13} &= a b^2 c \bigl( \cos\gamma \cos\alpha - \cos\beta \bigr) \end{aligned} \end{array}} \notag
\end{align}

\end{document}


There is no need to have everything in a single display:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\label{eq:triclinic(hkl)} \frac{1}{d^2} = \frac{1}{V^2} ( S_{11}h^2 + S_{22} k^2 + S_{33} \ell^2 + 2S_{12}hk + 2S_{23}k\ell + 2S_{13}h\ell )$$
where
\begin{align*}
V      &= abc \sqrt{
1 - \cos^2(\alpha) - \cos^2(\beta) - \cos^2(\gamma) +
2\cos(\alpha) \cos(\beta) \cos(\gamma)
}\\
S_{11} &= b^2c^2\sin^2(\alpha)\\
S_{22} &= a^2c^2\sin^2(\beta)\\
S_{33} &= a^2b^2\sin^2(\gamma)\\
S_{12} &= abc^2 (\cos(\alpha) \cos(\beta) - \cos(\gamma))\\
S_{23} &= a^2bc (\cos(\beta) \cos(\gamma) - \cos(\alpha)\\
S_{13} &= ab^2c (\cos(\gamma) \cos(\alpha) - \cos(\beta)
\end{align*}

\end{document}


You might use gather* in the bottom display (no trailing \\, beware), if you prefer.

Use \cos and \sin for the trig functions.