# Generating an author index with author names only, not dates, using natbib

I'm generating an author index using natbib, makeidx, and \citep and \citet in the document, with \citeindextrue. This works, but the author entries are of the form:

Hegselmann (2001), 142, 190

Hegselmann (2012), 55, 190

What I would like to appear is just:

Hegselmann, 55, 142, 190

The natbib documentation makes an elliptic reference (page 16) to: "The form of the index entries is set by the internal \NAT@idxtxt, which can be redefined by hackers if wanted (in the natbib.cfg file please). By default, it prints the short author list plus date or number in the current parenthesis style and citation mode."

I have tried '\renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar}' in the natbib.cfg file, but this doesn't seem to work (index entries are unchanged).

What should I be doing?

-
Welcome to TeX.sx! A tip: If you indent lines by 4 spaces or enclose words in backticks , they'll be marked as code, as can be seen in my edit. You can also highlight the code and click the "code" button (with "{}" on it). –  hpesoj626 Nov 3 '12 at 11:47
Can you add a minimal working example (MWE) that illustrates your problem? It is considered a lot better to put in some code that will compile, as it makes it a lot easier for us to copy it into our text editor and work with it, and see exactly what it is you are trying to do. –  hpesoj626 Nov 3 '12 at 11:48

NAT@idxtxt is redefined each time a cite is generated, so I suggest you change NAT@index to use something like NAT@myidxtxt. In the preamble you can write:

\makeatletter
\renewcommand\NAT@index{\@bsphack\begingroup
\def~{\string~}\@wrindex{\NAT@myidxtxt}}
\newcommand\NAT@myidxtxt{\NAT@name}
\makeatother

-
Welcome to TeX.SX! –  mafp May 30 '13 at 15:05

The reason that your redefinition of \NAT@idxtxt does not work is that natbib sets this definition at \begin{document}, so your earlier definition is overwritten. Hence we need an end run for the latest definition, using \AtBeginDocument.

\documentclass{article}

\usepackage{makeidx}
\usepackage{natbib}

\makeindex
\citeindextrue

\makeatletter
\newcommand{\setNATidxtxt}{%
\renewcommand\NAT@idxtxt{\NAT@name}
}
\makeatother
\AtBeginDocument{\setNATidxtxt}

\begin{document}
\citet{StGu92}

\printindex

\bibliographystyle{chicago}
\bibliography{test}
\end{document}


Note that I also removed the \NAT@spacechar` from your definition, as this was used in the original definition to separate names and year.

-