4

I am trying to align 2 simple equations using the align* environment:

\begin{align*}
\phi(\gedge{\tilde{v}_{i_1}}{\tilde{u}_i}) & = \phi(\gedge{\tilde{v}_{i_2}}{\tilde{u}_i}) & = \gedge{v}{u} \\
\phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_1}}) & = \phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_2}}) & = \gedge{u}{v} & \qquad\mathrm{(z\,wl.\,2)}\\
\end{align*}

unfortunately the result I am getting is horrible:

enter image description here

Why is there so much horizontal space before the second = sign?!?

Do not worry about \gedge, it is just an arrow:

% graph edge
\newcommand{\gedge}[2]{%
#1 \to #2%
}%
2
6

So you have two options,

  1. Using align

    \begin{align*}
    \phi(\gedge{\tilde{v}_{i_1}}{\tilde{u}_i}) & = \phi(\gedge{\tilde{v}_{i_2}}{\tilde{u}_i}) = \gedge{v}{u} \\
    \phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_1}}) & = \phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_2}}) = \gedge{u}{v}  \qquad\mathrm{(z\,wl.\,2)}\\
    \end{align*}
    
  2. Using alignat

    \begin{alignat*}{4}
    \phi(\gedge{\tilde{v}_{i_1}}{\tilde{u}_i}) & = \phi(\gedge{\tilde{v}_{i_2}}{\tilde{u}_i}) && = \gedge{v}{u} \\
    \phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_1}}) & = \phi(\gedge{\tilde{u}_i}{\tilde{v}_{i_2}}) && = \gedge{u}{v} & \qquad\mathrm{(z\,wl.\,2)}\\
    \end{alignat*}
    

    Result

4
  • The alignat solution should really use a double && to get the correct spacing. See for instance: Why does aligning equations not work here? Jul 9 '13 at 22:05
  • @PeterGrill or couldnt {} be placed too?
    – dustin
    Jul 9 '13 at 22:13
  • For this specific case a {} would suffice, but not a general solution as it would still be r aligned, and an l aligned is probably what is desired in this case. See question I linked to. Jul 9 '13 at 22:54
  • @PeterGrill Heiko Oberdiek added in && already.
    – dustin
    Jul 9 '13 at 23:10

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.