[tex-live] Bug in alpha.bst?

Alan Silvester mascdman at gmail.com
Sat Aug 18 05:58:22 CEST 2007


I think I have run across a Y2K-style bug in alpha.bst.  The bug.tex
and bug.bib files (see below) are a minimal example I've been able to
recreate.  The references list should have "Mar77a" and "Mar77b", but
instead the label "Mar77" is duplicated.  I've included a patch
(further below) that seems to correct this problem.

In the calc.label function, a two-digit year is appended to a
three-character key created earlier in that function.  This becomes
the label output later in a \bibitem command.  However, before
checking for duplicate labels, the style file appends a four-digit
year to the three-character key.  This longer label is then checked
for duplication.  In my example, calc.label produces the same label
for each ("Mar77"), but forward.pass compares "Mar7718" and "Mar7719"
(from my limited understanding of the code) and doesn't see the
duplication.

--Alan

===Bug.tex==================
\documentclass{article}
\begin{document}

Citation Mar77a \cite{Mar77a} and Mar77b \cite{Mar77b}

\bibliographystyle{alpha}
\bibliography{bug}
\end{document}
============================

===Bug.bib==================
@book{ Mar77a,
   author = "D. A. Marcus",
   title = "Number Fields",
   publisher = "Springer-Verlag, New York",
   year = "1977"
}

@article{ Mar77b,
   author = "A. Martin",
   title = "Solution",
   journal = "The Analyst",
   volume = "4",
   year = "1877",
   pages = "154--155"
}
============================

===Patch==================
--- alpha.bst.old        2007-08-16 22:46:15.062119127 -0600
+++ alpha.bst        2007-08-16 22:46:27.870463444 -0600
@@ -1047,7 +1047,7 @@
   year field.or.null purify$ #-1 #2 substring$
   *
   'label :=
-  year field.or.null purify$ #-1 #4 substring$
+  year field.or.null purify$ #-1 #2 substring$
   *
   sortify 'sort.label :=
 }
============================


More information about the tex-live mailing list