5

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*}
2
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 ={}&

0
1

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}

enter image description here

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.