# How do I include all authors of cited works in an index of persons?

I use the splitidx package to create a special index of named persons.

\usepackage[makeindex,protected]{splitidx}
\newindex[Index of people]{person}
\setindexpreamble[person]{...}


To index people as "Surname, Given", I created two simple macros:

\newcommand{\person}[2]{\sindex[person]{#2, #1}#2}% "Given Surname" in text
\newcommand{\Person}[2]{\sindex[person]{#2, #1}#1 #2}% "Surname" only in text


This works at least for people with given and surname (unlike names such as "Plato"). Now I also want to include authors of cited works in the people index with page numbers where I cited them. The page numbers when I cited their work should be set in a different style to see whether I mentioned the person or one of its works. Any idea how to do this automatically? Simply rewriting the \cite command will not help, because it only gets the citation key as argument. I use the biblatex package for citations, maybe this helps.

-

With biblatex, you can use \DeclareIndexNameFormat for that purpose. As is stated in biblatex.def, the following arguments are passed to indexing directives for name lists:

• #1 = last name
• #2 = last name (initials)
• #3 = first name
• #4 = first name (initials)
• #5 = name prefix, a.k.a 'von part'
• #6 = name prefix (initials)
• #7 = name affix, a.k.a 'junior part'
• #8 = name affix (initials)

The biblatex option indexing=true enables indexing globally. With indexing=cite and indexing=bib you can limit the indexing to the citations or bibliography, respectively.

Here is a minimal working example:

\documentclass[english]{scrartcl}
\listfiles
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@ARTICLE{article,
author = {Nachname, Vorname},
title = {Titel des Zeitschriftenartikels},
journal = {Zeitschrift},
year = {2006},
volume = {6},
pages = {19--75}
}
@BOOK{book,
author = {Buchautor, Hans-Wilhelm},
title = {Irgendein Buch},
year = {2000}
}
\end{filecontents}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel,csquotes}

\usepackage[makeindex,protected]{splitidx}
\newindex[Index of people]{person}
\newcommand{\person}[2]{\sindex[person]{#2, #1}#2}
\newcommand{\Person}[2]{\sindex[person]{#2, #1}#1 #2}

\usepackage[
style=authortitle,
indexing=true
]{biblatex}
\bibliography{\jobname}

\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\sindex[person]}{#1}{#3}{#5}{#7}}

\begin{document}
\person{Given}{Surname}
\clearpage
\cite{article}
\clearpage
\cite{book}
\clearpage
\Person{Given}{Surname}
\clearpage
\printbibliography
\printindex*
\end{document}


Edit:
I forgot the different style of the page numbers referring to names of cited authors. For this, you will first of all need a command to print the pages in the index differently, e.g.

\newcommand*{\ii}[1]{\textit{#1}}


If you are using hyperref, this should be

\newcommand*{\ii}[1]{\textit{\hyperpage{#1}}}


Now you have to give this information to the \DeclareIndexNameFormat command. In a normal index entry, this would be simple: \index{Name|ii} (or, with splitindex, \sindex[person]{Name|ii}. But with DeclareIndexNameFormat this is not possible in a direct way, since biblatex splits up the name given in the bib file and passes it on to the given index command. Thus, the easiest solution is to define a new command which then can be used by \DeclareIndexNameFormat:

\newcommand{\xindex}[1]{\sindex[person]{#1|ii}}
\DeclareIndexNameFormat{default}{%
\usebibmacro{index:name}{\xindex}{#1}{#3}{#5}{#7}}

-
Great, thank you! I also managed to include people without given name (like "Aristotle"). The only nasty thing is a duplication of page numbers, if an author is both cited and mentioned explicitly at the same page. I suppose this cannot easily be solved in LaTeX but requires some filtering of the .idx files or some makeindex/xindy settings. –  Jakob Oct 14 '10 at 14:22