3

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}

\begin{equation}
a = g.
\label{tlabel}
\end{equation}

Reference to: (\ref{tlabel})

\begin{equation}
a = g.
\end{equation}

\end{document}
David Carlisle
  • 757,742
Pygmalion
  • 6,387
  • 4
  • 34
  • 68

2 Answers2

6

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

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

Mensch
  • 65,388
6

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 this 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.

Mensch
  • 65,388
Heiko Oberdiek
  • 271,626