[Tex/LaTex] aligning split equation

alignequations

I am new to Latex 😉
I split my equation like this:

\begin{equation}
\begin{split}
    \tilde{m}=P\tilde{M} \\
    \quad = K(R^1R^2R^3t) \begin{pmatrix} X \\ Y \\ 0 \\ 1 \end{pmatrix} \\
    \quad= K(R^1R^2t)\begin{pmatrix} X \\ Y \\ 1 \end{pmatrix} \\
    \quad= H \begin{pmatrix} X \\ Y \\ 1 \end{pmatrix} 
\end{split}
\end{equation}

which gives me this:

but, actually, I want it to be aligned like this:

How do I align them so it looks like the right side is always aligned?
Thanks

Best Answer

You just need to set an ampersand as alignment marker before the equal sign:

\begin{equation}
\begin{split}
    \tilde{m}&= P\tilde{M} \\
             &= K(R^1R^2R^3t) \begin{pmatrix} X \\ Y \\ 0 \\ 1 \end{pmatrix} \\
             &= K(R^1R^2t)\begin{pmatrix} X \\ Y \\ 1 \end{pmatrix} \\
             &= H \begin{pmatrix} X \\ Y \\ 1 \end{pmatrix} 
\end{split}
\end{equation}
Related Question