Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

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

share|improve this answer
    
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
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 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.