\documentclass{minimal}
\usepackage{amsmath}
\newcommand*{\op}[1]{\operatorname{#1}}
\begin{document}
\begin{align*}
\noalign{$\quad \op{f} * \op{r} = \op{c}_{\op{f}*\op{r}} (x_1,...,x_k) = (\op{f}(a_1,...,a_k), \op{r}(b_1,...,b_k))$}
&\text{if } x_i=(x^{\op{f}}_i,x^{\op{r}}_i), &\text{then } a_i=x^{\op{f}}_i \in \mathcal{S}, b_i=x^{\op{r}}_i \in (\mathcal{A}^*)^*, &1 \leq i \leq k\\
&\text{if } x_i \in \mathcal{A}^*, &\text{then } a_i=b_i=x_i, &1 \leq i \leq k
\end{align*}
\end{document}
Obviously, "then" should be aligned, too. What am I doing wrong?
I also tried it with aligned
and {alignat*}{2}
, but it's not correct there either.
Best Answer
You need to use a double
&&
:The reason is that the
align
andalignat
environment both provide pairs ofrl
aligned equations. So if you want al
eft aligned point you need to skip over ther
ight aligned point.If you want to control the spacing in between the columns, then use the
alignat
in which case you need to manually add the space. Here I have added a\quad
for the spacing spacing:As requested in the comments, here is an alternate use of
align
which ensures that the start of the last two lines is aligned with the first=
of the first line.Notes:
\phantom{{}={}}
was used to ensure that the last two lines are aligned to the text to the right of the=
. The additional{}
in the\phantom
is used to ensure proper spacing is applied around the=
. We could also have use\hphantom{}
instead, but both will yield identical result in this case.rlap
was used so that the right hand sides is not going to have an effect on the alignment of the subsequent rows.Code: