Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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%
}%
share|improve this question
    
With align, you need only one &. If you want to use multiple alignment spots, you can use the alignat environment. –  dustin Jul 9 '13 at 21:46
    
related, if not exactly the same: Why does aligning equations not work here? –  barbara beeton Jul 9 '13 at 21:49
add comment

1 Answer

up vote 6 down vote accepted

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

share|improve this answer
    
The alignat solution should really use a double && to get the correct spacing. See for instance: Why does aligning equations not work here? –  Peter Grill 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. –  Peter Grill Jul 9 '13 at 22:54
    
@PeterGrill Heiko Oberdiek added in && already. –  dustin Jul 9 '13 at 23:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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