I want to use author index with natbib. An example below (with the fix of the author index package) does not work. The fix of Index both authors and subjects with authorindex and makeindex does not work either (with \cite the .idx and .ind files are empty and \aicite gives "Paragraph ended before \@citex was complete.")
\documentclass{article}
\usepackage{natbib}
\usepackage{authorindex}
\let\cite=\aicite
\makeatletter
% natbib.cfg (copy/pasted from authorindex 2005/03/22 user manual)
\AtBeginDocument{%
\@ifpackageloaded{authorindex}{%
\ifNAT@numbers
\let\org@@citex\NAT@citexnum
\else
\let\org@@citex\NAT@citex
\fi
\def\@citex[#1][#2]#3{%
\typeout{indexing: [#1][#2]{#3}}%
\org@@citex[#1][#2]{#3}%
\@aicitey{#3}}%
\renewcommand\NAT@wrout[5]{%
\if@filesw{%
\let\protect\noexpand\let~\relax
\immediate\write\@auxout{\string\aibibcite{#5}{#1}}%
\immediate\write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}%
\fi}}{}}
\renewcommand\NAT@index{\@bsphack\begingroup
\def~{\string~}\@wrindex{\NAT@myidxtxt}}
\newcommand\NAT@myidxtxt{\NAT@name}
\makeatother
\begin{document}
Infinite descent \cite{Fermat1659-DescInf}
\bibliographystyle{plain}
\bibliography{\jobname}
\printauthorindex
\end{document}
xeLatex, bibtex, xeLatex, xeLatex works without authorindex
the following lines being commented out:
%%%\usepackage{authorindex}
%%%\let\cite=\aicite
%%%\printauthorindex
xeLatex produces the following error with authorindex after
\cite{Fermat1659-DescInf}:
Runaway argument?
]{Fermat1659-DescInf}\@aicitey {Fermat1659-DescInf}
./authorindex-natbib.tex:27: Paragraph ended before \@citex was complete.
<to be read again>
\par
l.27
%%% File authorindex-natbib.bib %%%
@unpublished{Fermat1659-DescInf,
author = {De Fermat, Pierre},
title = {Relation des nouvelles d\'ecouvertes en la science des nombres},
month = {August },
year = 1659,
note = {Lettre \`a {Pierre de Carcavi}},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%