Align – Left-Justify with Align on ‘=’ in Align Environment

align

I searched the tex.stackexchange archives for an answer to this question but couldn't find one. I assume it's a common question, however.

I often want to align text similar to the poly environment in lhs2TeX. For instance:

e(x)      = x
e(M N)    = e(M) e(N)
e(λx:τ.M) = λx:τ.e(M)
e(λ_:τ.M) = λx:τ.e(M)  (x ∉ FV(M))

The solutions I see are to use a tabular environment, an eqnarray, or an align. However, align and eqnarray create columns that are too far apart, and tabular has similar, but less significant spacing problems.

Is there a simple solution to this problem? The layout is common, so I assume there is.

Best Answer

The alignat environment from amsmath can manage that.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
  \begin{alignat}{2}
    & e(x)                &&= x\\
    & e(M N)              &&= e(M) e(N)\\
    & e(\lambda x:\tau.M) &&= \lambda x:\tau.e(M)\\
    & e(\lambda\_:\tau.M) &&= \lambda x:\tau .e(M)  (x \notin FV(M))
  \end{alignat}
\end{document}