Double occurrences of names in Index with biblatex
For reasons that I don't really understand, the indexing made by biblatex
issues a command of the form
\index{Strawson, Peter@Strawson, Peter}
as you can see by examining the .idx
file
\indexentry{Strawson, Peter}{1}
\indexentry{Strawson, Peter@Strawson, Peter}{1}
\indexentry{Strawson, Peter}{2}
\indexentry{Strawson, Peter@Strawson, Peter}{3}
\indexentry{Strawson, Peter}{4}
\indexentry{Strawson, Peter@Strawson, Peter}{5}
\indexentry{Strawson, Peter@Strawson, Peter}{5}
You can work around this behavior by defining
\newcommand{\nindex}[1]{\index{#1@#1}}
and using \nindex{Strawson, Peter}
in the text. After the change, here's the .idx
file I get:
\indexentry{Strawson, Peter@Strawson, Peter}{1}
\indexentry{Strawson, Peter@Strawson, Peter}{1}
\indexentry{Strawson, Peter@Strawson, Peter}{2}
\indexentry{Strawson, Peter@Strawson, Peter}{3}
\indexentry{Strawson, Peter@Strawson, Peter}{4}
\indexentry{Strawson, Peter@Strawson, Peter}{5}
\indexentry{Strawson, Peter@Strawson, Peter}{5}
and here's the index, with a single entry:
Maybe there is a workaround also on the biblatex
side, but I don't know it.
The result you are seeing has been correctly diagnosed by egreg. But there may be a simpler workaround. It's actually not down to \indexname
, as I wrongly speculated, but to the treatment of prefixes "van" "von" "de la" etc.
If biblatex
is "using prefixes" (which means it will always print Ludwig van Beethoven as Van Beethoven, Ludwig, with a capital) then it puts both a "printing" and a "sorting" entry into the index, separated by @. It does this so that it can have makeindex
sort using "van Beethoven, Ludwig", but print "Van Beethoven, Ludwig". The latter requires the addition of a LaTeX command (\MakeCapital {van}
) in the file, which would cause sorting difficulties if it was nakedly included in the index entry.
Simple Solution
You can avoid this by setting the option useprefixes=false
when loading biblatex
. That may solve your problem, unless you need "useprefixes" i.e. you have entries like "van Beethoven" which you want print "Van Beethoven" and sorted under V. In most cases in English conventions of sorting at least this will be a good solution, and probably what you want.
Not so simple solution
Alternatively, if you want to keep the "useprefixes" option, the following code tries to make sure that the additional naming (van Beethoven, Ludwig@\MakeCapital{van} Beethoven Ludwig
) only gets used when the name actually has a prefix, and therefore solves the problem in your case (but you would then need to use egreg's approach if dealing with a name that did have a prefix, i.e. you would have to ensure that your index entries for names with a prefix took the form given above).
\makeatletter
\renewcommand*{\mkbibindexname}[4]{%
\ifuseprefix
{\ifblank{#3}% no PREFIX
{\@firstofone #1% remove spurious braces
\ifblank{#4}{}{ #4}%
\ifblank{#2#3}{}{,}%
\ifblank{#2}{}{ #2}}%
{#3 % PREFIX
\@firstofone #1%removespuriousbraces
\ifblank{#4}{}{ #4}%
\ifblank{#2}{}{, #2}%
\actualoperator
\ifblank{#3}{}{\MakeCapital{#3} %
#1%
\ifblank{#4}{}{ #4}%
\ifblank{#2}{}{, #2}}}}
{\@firstofone #1% NOT "using prefix" remove spurious braces
\ifblank{#4}{}{ #4}%
\ifblank{#2#3}{}{,}%
\ifblank{#2}{}{ #2}%
\ifblank{#3}{}{ #3}}}
\makeatother