In the following piece of code

[x \mapsto s]x &= s \\
[x \mapsto s]y &= y \qquad \text{als } y\neq x \\
[x \mapsto s](\la{y}t_1) &= \la{y}[x \mapsto s]t_1 \qquad \text{als } y \neq x \text{ en   } y \not \in FV(s) \\
[x \mapsto s](t_1 \; t_2)&= ([x \mapsto s]t_1)\;([x \mapsto s]t_2)

I am currently only aligning on the = sign. Is it however also possible to align on more than one place in the environment? I would also like the \text to be aligned, as wel as the begining of each new line.


Multiple alignment points with no gap between expressions is obtained using the alignat environment from amsmath. The following MWE illustrates that:

enter image description here




  &[x \mapsto s]x &&= s && \\
  &[x \mapsto s]y &&= y \qquad &&\text{als } y\neq x \\
  &[x \mapsto s](\lambda(y)t_1) &&= \lambda(y)[x \mapsto s]t_1 \qquad &&\text{als } y \neq x \text{ en   } y \not \in FV(s) \\
  &[x \mapsto s](t_1 \; t_2)&&= ([x \mapsto s]t_1)\;([x \mapsto s]t_2) &&


I've taken the liberty to convert the unknown \la{<arg>} macro to \lambda(<arg>).

Consider reading Herbert's mathmode document. It illustrates the various "alignment environments" of amsmath clearly. Specifically, see section 25 align environments, p 43 onward.

  • great! will give it a read, also my apologies for the unknown macro, you converted it correctly, – codd May 20 '12 at 14:35
  • 1
    One doesn't even need alignat: the simple align can do the same, but it adds spacing as it thinks correct, which might not be what the user wants. – egreg May 20 '12 at 14:37
  • egreg: could you elaborate? Because spacing would be nice, I currently forced it using \qquad... – codd May 20 '12 at 14:38
  • 1
    @codd: See @_barbarabeeton's answer. – Werner May 20 '12 at 17:31
  • @Servaes: Thanks. The mathmode stub on CTAN puts the "package" down as obsolete (hence the link change). – Werner Oct 13 '16 at 12:05

using just align would be done like this:

\usepackage{amsmath}% http://ctan.org/pkg/amsmath
  [x \mapsto s]x &= s \\
  [x \mapsto s]y &= y &&\text{als } y\neq x \\
  [x \mapsto s](\lambda(y)t_1) &= \lambda(y)[x \mapsto s]t_1 &&\text{als } y \neq x \text{ en   } y \not \in FV(s) \\
  [x \mapsto s](t_1 \; t_2) &= (x \mapsto s]t_1)\;([x \mapsto s]t_2)

this gives the following result:

display with multiple alignment points

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.