# Why does horizontal space after ampersand becomes less?

Why does the space after the equals sign becomes less if I use the lower code, i.e., if I put ampersand after equals sign?

\begin{align*}
A&=B
\end{align*}

\begin{align*}
A=&B
\end{align*}

-
This is a well known alignment problem. See tex.stackexchange.com/questions/159723/… . The first answer should be sufficient. –  pushpen.paul Jun 9 '14 at 22:03
@pushpen.paul My answer to that question does not cover exactly this issue. –  Torbjørn T. Jun 9 '14 at 22:13

If a binary relation such as = is used in an infix position it gets extra space [$a=b$] but of used as a prefix or suffix operator it reverts to mathord spacing compare [$=a$] and [$a=$].

The align environment is intended to be used as &= and adds a {} to the start of the second cell so that &B is typeset as {}=B to ensure that you get the \mathrel spacing.

If you need =& for a special alignment and want to keep the space use ={}&

-
Thank you for such detailed explanation! –  Zhiyuan Ding Jun 10 '14 at 0:23

While the question was about the AMS math environments, it's as good a place as any to offer the compare/contrast to the tabbing features of the tabstackengine package. While the package stacks tabbed content, by default, in text mode, an invocation of \stackMath will process arguments in math, and then a comparable alignment situation arises as David pointed out for the AMS environments.

The package provides three math padding modes, \TABbinaryRight which acts as if a {} is added to the end of each cell (this is the package default, which is the opposite of the AMS environment); \TABbinaryLeft which acts as if a {} is added to the beginning of each cell; and \TABbinary which acts as if a {} is added to the beginning and end of each cell.

The choice will affect the spacing around operators and relations, as shown in the MWE. So, as a general rule, with \TABbinaryRight as the default, one would use =& as the tabstackengine syntax to produce the "typically" desired result.

\documentclass{article}
\usepackage{tabstackengine}
\stackMath
\begin{document}
\TABbinaryRight\tabbedShortstack{A&=B=&C=&-D} (TABbinaryRight -- default)

\TABbinaryLeft\tabbedShortstack{A&=B=&C=&-D} (TABbinaryLeft)

\TABbinary\tabbedShortstack{A&=B=&C=&-D} (TABbinary)
\end{document}


-