[Tex/LaTex] aligning equals as well as plus signs

align

From this question we know that aligning the equal signs in

A = B = C
D = E = F

is done by using alignat, not align.

If we have instead

A = W + M = C
B = i + \iota = D

how can the equal signs as well as the + signs be aligned?

Best Answer

The important rule for all *align* environments is rlrlrlrl…, meaning that alternating columns are left-, right-, left-, right-, …-aligned.

Such basic question as you posted can be easily written in many ways (#1 = #2, #3 = #4):

Code (MWE)

\documentclass{article}
\usepackage{amsmath}
\begin{document}


\begin{alignat*}{3} % #1
A & = W & {}+{} & M     && = C \\
B & = i & {}+{} & \iota && = D
\end{alignat*}
\begin{alignat*}{3} % #2
A & = W && {} + M     && = C \\
B & = i && {} + \iota && = D
\end{alignat*}

\begin{alignat*}{3} % #3
A & ={} & W +{} & &     M & = C \\
B & =   & i +{} & & \iota & = D
\end{alignat*}
\begin{alignat*}{3} % #4
A & ={} & W & +{} &     M & = C \\
B & =   & i & +{} & \iota & = D
\end{alignat*}
\end{document}

Output

Left-aligned (#1 and #2)

left aligned (#1 and #2)

Right-aligned (#3 and #4)

right aligned (#3 and #4)

Related Question