2

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*}

enter image description here

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

2

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}

output of example code

1

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}

enter image description here

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}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.