# autonum does not work with eqnarray?

I always wanted to have a package like autonum. Well, it is finally here and its development is still under way, but I already have two problems:

1. It does not work with eqnarray.

2. When referencing to equation, there appears space in front of the number, e.g. ( 3).

Is that already possible to resolve or we'll have to wait?

\documentclass{article}
\usepackage{amsmath}
\usepackage{autonum}

\begin{document}

\begin{eqnarray}
a = g,\\$$a = g.$$\end{eqnarray}

$$a = g. \label{tlabel}$$

Reference to: (\ref{tlabel})

$$a = g.$$

\end{document}

-
And by autoref you mean autonum? –  Jonas Nyrup Aug 22 '12 at 12:23

It is a bug in the new package autonum. A line end in the definition of \autonum@generatePatchedReferenceGeneral is not commented. (Another candidate for unwanted white spaces is \autonum@possiblyHideNumber.)

At a quick glance I didn't find any relevant white spaces at the line end, therefore disabling the line ends helps:

\endlinechar=-1
\usepackage{autonum}
\endlinechar=13


Or a little more defensive:

\edef\RestoreEndlinechar{\endlinechar=\the\endlinechar\relax}
\endlinechar=-1 %
\usepackage{autonum}
\RestoreEndlinechar


Also there is another problem, at \begin{document} an underfull \hbox warning is printed.

Further remarks:

• The environment eqnarray is not recommended, see Kurt's answer or l2tabu

• "Autonumbering" might be useful for the writer, but it forgets the reader. The equation number help to identify the equation. Referencing inside the text is just one application. Others might want to reference an equation of your work as well, but they can't because the number is missing. Therefore all equations or at least all relevant equations should be numbered, not only the equations that are referenced in the text.

-
l2tabu is full of interesting suggestions. Good reading! –  Pygmalion Aug 22 '12 at 14:39
Thanks for directly giving the solution to the problems. I just uploaded version 0.3.1, which should fix these problems. –  Patrick Häcker Aug 25 '12 at 16:13

Well, not the answer you expect, but I would say: "Do not use eqnarray".

See the question \eqnarray vs \align for an explanation.

-
I am actively using latex for 15 years and only now I am aware of that... Thanks –  Pygmalion Aug 22 '12 at 14:40