# Spurious horizontal space in the aligned environment

If you compile what's below, you'll observe a slight horizontal misalignment between the equations of aligned versus align. Is there a way to avoid that?

\documentclass[fleqn]{book}
\usepackage{amsmath}
\begin{document}
text
\begin{aligned} &A\\ &B \end{aligned}
text
\begin{align}
&A\\
&B
\end{align}
text
\end{document}

-

This is bizarre, but fixable. The control of the aligned environment in the amsmath package is governed by the command \start@aligned. In amsmath.sty, the start of this command resembles:

\newcommand{\start@aligned}[2]{%
\RIfM@\else
\nonmatherr@{\begin{\@currenvir}}%
\fi
\savecolumn@ % Assumption: called inside a group
\null\,%
...


The problem is the use of \null\, which adds a (spurious) \thinspace after \null, causing the misalignment. Use the etoolbox package's \patchcmd to fix/patch this. Try

...
\usepackage{etoolbox}
\makeatletter
\patchcmd{\start@aligned}{\null\,}{\null}{}{}%
\makeatother
...


in your preamble after loading amsmath:

-
thanks, I'll try that. Do you think it is a bug in the amsmath package? What about modifying it? –  pluton Aug 24 '11 at 20:15
The \patchcmd command modifies during compilation, but doesn't change it in the original file amsmath.sty. To modify this in future releases, I would suggest submitting it as a possible bug by clicking on the Technical Support address on the AMS website, or send an email to tech-support@ams.org. –  Werner Aug 24 '11 at 20:19
sounds like it is a bug. They'll try to provide a solution or at least investigate, as soon as possible, as they say. Thanks! –  pluton Aug 26 '11 at 19:43
I do not understand why they do not correct this bug? Why don't they update amsmath.sty on CTAN? Strange. –  pluton May 7 '14 at 5:13