0

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}},
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  • \@citex has three arguments but authorindex assumes two in its own code. Are you stuck with natbib or would you consider to switch to biblatex/biber? See here for an example of an index: tex.stackexchange.com/questions/377983/… – Ulrike Fischer Oct 7 '17 at 18:12
  • It worked well with biblatex/bibte, hyperref, and indextools for multiple indexes EXCEPT that \begin{refsection} ... \printbibliography[heading=subbibliography]\end{refsection} produces NO BIBLIOGRAPHY at all! – PCofNYC Oct 9 '17 at 14:58
  • Did you run biber? What does the .blg-file say? – Ulrike Fischer Oct 9 '17 at 15:02
  • tex.stackexchange.com/questions/128196/problem-with-refsection says biber solves the problem and it does! – PCofNYC Oct 9 '17 at 15:03