[Tex/LaTex] Aligning Multiple Columns in an Equation

alignequations

I have the following equation:

\documentclass[a4paper,oneside]{scrbook}
\usepackage{amsmath}

\begin{document}

\begin{equation*}
    \begin{aligned}
        X & = A * A * \Big( A * A * A * A
        &   + AA * AA \\
        &&  + AA * AA \\
        &&  + AA * AA & \Big)
        \\
        &  + B * B * \Big( B * B
        &  + BB * BB \\
        && + BB * BB \\
        && + BB * BB & \Big)
        \\
        &  + C * C * \Big( C * C * C * C * C * C
        &  + CC * CC \\
        && + CC * CC \\
        && + CC * CC & \Big)
        \\
        &  + D * D + D * D \\
        &  + D * D + D * D
    \end{aligned}
\end{equation*}

\end{document}

How it looks

I'd like to have the double-characters AA BB CC to be aligned more to the left like in the CC example (but even there is a small gap).
I'd like to have it in one equation, so it will have one number assigned to it. I tried it for almost 5h to do it on my own, but nevertheless what I did, I wasn't able to align it properly within the equation.

How to align this?

Best Answer

Here is a solution using aligned inside of align environments. The split is only needed in order to get one vertically centred label on the right. If you want to have it on the first line, you will have to get rid of this and \notag all lines but the first (or last).

% arara: pdflatex

\documentclass[a4paper,oneside]{scrbook}
\usepackage{amsmath}

\begin{document}    
\begin{align}
    \begin{split}
        X &= \begin{aligned}[t]
        A * A * \Bigl( A * A * A * A &+ AA * AA \\
        &+ AA * AA \\
        &+ AA * AA\Bigr)\\  
        \end{aligned}\\
        &\hphantom{={}}\begin{aligned}[t]
        {}+ B * B * \Bigl( B * B &+ BB * BB \\
        &+ BB * BB \\
        &+ BB * BB\Bigr)
        \end{aligned}\\
        &\hphantom{={}}\begin{aligned}[t]
        {}+ C * C * \Bigl( C * C * C * C * C * C &+ CC * CC \\
        &+ CC * CC \\
        &+ CC * CC\Bigr)
        \end{aligned}\\
        &\hphantom{={}}+ D * D + D * D \\
        &\hphantom{={}}+ D * D + D * D
    \end{split}
\end{align} 
\end{document}

enter image description here