I'm having a lot of troubles in aligning some terms in a complicated equation. This is probably a semi-trivial thing, but I don't get it (fssshhht!). Here's a MWE to show my problem:
\documentclass[11pt,letterpaper,twoside]{book}
\usepackage[total={6in,10in},left=1.5in,top=0.5in,includehead,includefoot]{geometry}
\usepackage{nccmath,amsmath}
\usepackage{amsfonts}
\usepackage{mathtools}
\begin{document}
\begin{gather*}
A + B + C + D \\[1ex]
\begin{aligned}
&= CAT &&+ BB + CC + DD + EE
\begin{split}
&&- a - b - c - d \\
&&- e - f + g \\
&&+ h - k
\end{split} \\[1ex]
&= FOOD,
\end{aligned}
\end{gather*}
\end{document}
The FOOD term should be aligned with the CAT term (from their equal sign), while the BB, a, e and h term should be aligned (from their front sign). Currently, this code gives a mess! What am I doing wrong here?
I tried the alignat
environment, but it's worst. My troubles come from the last line, which should be aligned with the second line. Without the last line, this would be a trivial task (no need of the split
environment)!