# Left-justify with align on “=” in align environment

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.

-

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}

-
This works great; thanks for the response. – danportin Feb 7 '11 at 2:56

You could use an array:

\documentclass{article}
\begin{document}
$\begin{array}{ll} 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{array}$
\end{document}


If the spacing is too far apart, use @ separators for the column specifications, e.g., \begin{array}{l@{\,}l}

-

According to the manual, the lhsTeX poly environment uses the polytable package internally. So I maybe that package provides the table format you are looking for.

-