4

Consider

\begin{align}
u_j &= x\\
v &= x
\end{align}

Compiling this the $=$'s are going to be aligned, but the $v$ gets aligned to the end of the $u_j$, which is a bit beyond the end of the $u$ because this has a sub-index.

Question: Is there a robust way of correcting this?

4
  • 3
    v\phantom{_j} &= x. A related question: tex.stackexchange.com/questions/111722/… – Steven B. Segletes Mar 26 '14 at 19:14
  • I intended to mean by robust something that is not a tweak like this. But seen this solution made me think that there is no way for latex to know the extra space is coming from a sub-index or not. I should have though the question better. – Anna Taurogenireva Mar 26 '14 at 19:21
  • Oh, the link is interesting. – Anna Taurogenireva Mar 26 '14 at 19:22
  • The tabstackengine package can do it without a tweak: \documentclass{article} \usepackage{tabstackengine} \stackMath \begin{document} \begin{equation} \TABbinaryLeft \tabbedCenterstack[l]{ u_j &= x\\ v &= x } \end{equation} \end{document}. However, it can't (yet) number each equation separately, as does align. Also, there are some configuration commands as overhead, so unless you were to use it often, the tweak is easier for your example. – Steven B. Segletes Mar 26 '14 at 19:30
3

If you don't want to use the hphantom{} approach (which I would consider better in this specific case), then you can use the alignat environment which provides pairs of r/l alignment points:

enter image description here

Notes:

  • The first & makes the content following left aligned. Then you need to skip past the subsequent right aligned column (hence the &&) to get the x to be left aligned.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{alignat}{3}
    &u_j &&= x\\
    &v   &&= x
\end{alignat}
\end{document}

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.