[Tex/LaTex] Left-align math with fleqn inside split environment

alignamsmathequationshorizontal alignment

Below, how would I move the first math-line left so that a^2 left-aligns with where?

\documentclass{article}
\usepackage[fleqn]{amsmath}
\begin{document}
\setlength{\parindent}{0pt}

Some text
\begin{equation}
    \begin{split}
        a^2+\lambda_\phi=\phi\\ 
        \begin{aligned}
            \text{where\qquad}
            a &= \pm \sqrt{1-\cos^2\theta} \\
            \lambda_\phi &= \cos\theta\cos\phi - \sin\theta\sin\phi
        \end{aligned}
    \end{split}
\end{equation}
Some more text

\end{document}

enter image description here

Best Answer

You need to add appropriate alignment points &.

Sample output

\documentclass{article}
\usepackage[fleqn]{amsmath}
\begin{document}
\setlength{\parindent}{0pt}

Some text
\begin{equation}
    \begin{split}
        &a^2+\lambda_\phi=\phi\\ 
        &\begin{aligned}
            \text{where\qquad}
            a &= \pm \sqrt{1-\cos^2\theta} \\
            \lambda_\phi &= \cos\theta\cos\phi - \sin\theta\sin\phi
        \end{aligned}
    \end{split}
\end{equation}
Some more text

\end{document}

Additionally if you are using a version of amsmath from before 2017, the aligned starts with a thinspace, so you need to compensate with a negative thin space \!, i.e. writing

&\!\begin{aligned}

instead of just &\begin{aligned}.