10

In this example,

\documentclass{article}

\begin{document}

\begin{eqnarray*}
A&=&B,\\
C&=&D,\\
E&=&F,
\end{eqnarray*}

\begin{eqnarray*}
A&=&\mathord{B,}\\
C&=&\mathord{D,}\\
E&=&\mathord{F,}
\end{eqnarray*}

\end{document}

I would think that the two eqnarray*'s would come out perfectly aligned on the = signs, but instead the top eqnarray* comes out slightly to the left of the bottom one (the difference is less than 1 point). I assume this has to do with the fact that the lines in the top eqnarray* end with punctuation symbols, while the lines in the bottom eqnarray* end with ordinary symbols. Is this a known issue?

By the way, if I load the eqnarray package from here, the excessive space around the middle column is removed, but my centering issue remains.

1

1 Answer 1

13

Add \showoutput to debug this kind of thing.

In the first, because the , is in the middle of an expression there is

......\glue(\thinmuskip) 1.66663

after it but because in the second it is at the end of a {} subexpression there is no such space, so the first expression is that much wider, which when centred shifts things by half that amount, which as you say is less than a point.


On closer inspection you will see that the extra space is only added on the first two rows as the , only adds space if it is not at the end, \\ acts like {} but \end{eqnarray*} does not. Compare $B,{}$ to $B,$. this is arguably a bug in eqnarray but it would be hard to change it now.

Adding

\makeatletter
\def\foo#1!!{\def\@eqncr{\ifnum0=`{\fi}{\ifnum0=`}\fi#1}}
\expandafter\foo\@eqncr!!
\makeatother

fixes it (I think)

With a comma the spacing change is just at the end so affects the centering of the whole alignment but isn't that noticeable. With + though it is rather more obvious that the last row is different:

Perhaps we should fix this in fixltx2e....

enter image description here

\documentclass{article}

\begin{document}


\showoutput
\begin{eqnarray*}
A&=&B+\\
C&=&D+\\
E&=&F+
\end{eqnarray*}

\makeatletter
\def\foo#1!!{\def\@eqncr{\ifnum0=`{\fi}{\ifnum0=`}\fi#1}}
\expandafter\foo\@eqncr!!
\let\@seqncr=\@eqncr

\begin{eqnarray*}
A&=&B+\\
C&=&D+\\
E&=&F+
\end{eqnarray*}

\end{document}

actually I think it's OK to use simple \bgroup here so:

\def\foo#1!!{\def\@eqncr{\egroup\bgroup#1}}

rather than the special \halign trick groups.

You must log in to answer this question.

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