[texhax] NatBib-based styles and unusual year or author entries

Dan Hatton vi5u0-texhax at yahoo.co.uk
Mon Jun 4 15:28:55 CEST 2007


On Fri, 1 Jun 2007, Aditya Mahajan wrote:

> Maybe do what the FAQ suggests for such things, see
> http://www.tex.ac.uk/cgi-bin/texfaq2html?label=moren9

Thanks for the pointer.  I've now tried various permutations of the
method from the FAQ, all of which fall over with a "missing number"
error message when they encounter an ordinary four-digit year withour
an "extra" citation letter.

The solution turned out to be to use braces, as Philip suggested, to
reduce the number of tokens in the year to one:

year="{1995 (1911)}"

then edit the definition in natbib.sty to avoid putting the first
token of the year in an \ifnum:

\newcommand\NAT at parse@date{}
\def\NAT at parse@date#1#2#3#4#5#6@@{%
   \ifnum\the\catcode`#2=11\def\NAT at year{#1}\def\NAT at exlab{#2}\else
   \ifnum\the\catcode`#3=11\def\NAT at year{#1#2}\def\NAT at exlab{#3}\else
   \ifnum\the\catcode`#4=11\def\NAT at year{#1#2#3}\def\NAT at exlab{#4}\else
     \def\NAT at year{#1#2#3#4}\def\NAT at exlab{{#5}}\fi\fi\fi}

However, I suspect this might run into some kind of trouble if two
things by the same author, both of which are year-less, get cited.

-- 

Thanks again,

Dan



More information about the texhax mailing list