How to change the natbib \biblabel to have authoryear label instead of number?
The author of the natbib
package, Patrick Daly, kindly provided a solution that worked very well for me (but might require testing/modifications for other situations).
In order to use the redefinition of \NAT@biblabel
that I have tried, \@lbibitem
needs to be changed. The following definitions of \@lbibitem
and \NAT@biblabel
can be put in a separate file, called natbib.cfg
. This will be loaded by natbib
as the very last thing if it is present. Alternatively, it can be included in the LaTeX document preamble (with \makeatletter
… \makeatother
).
\def\@lbibitem[#1]#2{%
\if\relax\@extra@b@citeb\relax\else
\@ifundefined{br@#2\@extra@b@citeb}{}{%
\@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}%
}%
\fi
\@ifundefined{b@#2\@extra@b@citeb}{%
\def\NAT@num{}%
}{%
\NAT@parse{#2}%
}%
\def\NAT@tmp{#1}%
\expandafter\let\expandafter\bibitemOpen\csname NAT@b@open@#2\endcsname
\expandafter\let\expandafter\bibitemShut\csname NAT@b@shut@#2\endcsname
\@ifnum{\NAT@merge>\@ne}{%
\NAT@bibitem@first@sw{%
\@firstoftwo
}{%
\@ifundefined{NAT@b*@#2}{%
\@firstoftwo
}{%
\expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
\@secondoftwo
}%
}%
}{%
\@firstoftwo
}%
{%
\global\advance\c@NAT@ctr\@ne
\@ifx{\NAT@tmp\@empty}{\@firstoftwo}{%
\@secondoftwo
}%
{%
\expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%
\global\NAT@stdbsttrue
}{}%
\bibitem@fin
% \item[\hfil\NAT@anchor{#2}{\NAT@num}]%
\item[\hfil\NAT@anchor{#2}{\citealp{#2}}]% <<<<<< Changed here
\global\let\NAT@bibitem@first@sw\@secondoftwo
\NAT@bibitem@init
}%
{%
\NAT@anchor{#2}{}%
\NAT@bibitem@cont
\bibitem@fin
}%
\@ifx{\NAT@tmp\@empty}{%
\NAT@wrout{\the\c@NAT@ctr}{}{}{}{#2}%
}{%
\expandafter\NAT@ifcmd\NAT@tmp(@)(@)\@nil{#2}%
}%
}%
\renewcommand\NAT@biblabel[1]{[#1]}