8

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{equation}
\begin{aligned}
&A\\
&B
\end{aligned}
\end{equation}
text
\begin{align}
&A\\
&B
\end{align}
text
\end{document}

1 Answer 1

7

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:

Corrected aligned and align environments of amsmath

4
  • thanks, I'll try that. Do you think it is a bug in the amsmath package? What about modifying it?
    – pluton
    Aug 24, 2011 at 20:15
  • 2
    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 [email protected].
    – Werner
    Aug 24, 2011 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, 2011 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, 2014 at 5:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .