# Variable number of ampersands in align/alignat env

I am trying to display this equation in latex:

\begin{alignat*}{2}
\forall \, z \in \mathbb{C}, \quad  & (2z + 1 - i)(i\bar{z}+i-2)=0\\
\iff & 2z + 1 - i = 0 \quad          &&\text{ or } i\bar{z}+i-2 = 0\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{ or } \bar{z} = -i(-i+2)\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{ or } z = 1 + 2i
\end{alignat*} As you can see the alignements are correct, however the ors are aligned with the end of the first line, whereas I want it aligned just after the \quad of second line. How can I do that? Thanks

here, the right-hand side of the first line is aligned the way you want it, and it doesn't have any additional alignment points, so you can simply ignore its width. \mathrlap from mathtools is very good for this:

\documentclass{article}
\usepackage{mathtools}
\usepackage{amsfonts}
\begin{document}
\begin{alignat*}{2}
\forall \, z \in \mathbb{C}, \quad  & \mathrlap{(2z + 1 - i)(i\bar{z}+i-2)=0}\\
\iff & 2z + 1 - i = 0 \quad          &&\text{ or } i\bar{z}+i-2 = 0\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{ or } \bar{z} = -i(-i+2)\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{ or } z = 1 + 2i
\end{alignat*}
\end{document} You can just add some negative space:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{alignat*}{2}
\forall \, z \in \mathbb{C}, \quad
& (2z + 1 - i)(i\bar{z}+i-2)=0\hidewidth\\
\iff & 2z + 1 - i = 0 \quad          &&\text{or } i\bar{z}+i-2 = 0\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{or } \bar{z} = -i(-i+2)\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{or } z = 1 + 2i
\end{alignat*}

\end{document} Note that \hidewidth is not really documented in the LaTeX manual, but it's a very handy tool in alignments; it is essentially

\hspace{-1000pt plus 1fill}


so a very large negative skip, but with infinite stretchability. Thus the cell with \hidewidth will never be the widest one, but it will be filled up correctly nonetheless.

I suggest using \quad also after “or”, for symmetry:

\documentclass{article}
\usepackage{amsmath,amssymb}

\begin{document}

\begin{alignat*}{2}
\forall \, z \in \mathbb{C}, \quad
& (2z + 1 - i)(i\bar{z}+i-2)=0\hidewidth\\
\iff & 2z + 1 - i = 0 \quad          &&\text{or}\quad i\bar{z}+i-2 = 0\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{or}\quad \bar{z} = -i(-i+2)\\
\iff & z = -\frac{1}2 + \frac{1}2i   &&\text{or}\quad z = 1 + 2i
\end{alignat*}

\end{document} 