Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use biblatex with indexing option; moreover, inside the text I have some names to index, with the usual \index{} command. Since I have the same authors in the bibliography and in the text, in the Index I find two occurrences of the same name, the first one coming from text, the second one from bibliography, for example:

Homer, 27, 45, 79
Homer, 107

But it's wrong and confusing. How can I unify the names occurrences?

A minimal example:

\documentclass{article}
\usepackage{fontspec}
\usepackage[style=philosophy-verbose,scauthors=true,classical=true,%
volumeformat=romansc,indexing]{biblatex}
\usepackage{filecontents}
\usepackage{imakeidx}
\indexsetup{othercode=\footnotesize}
\makeindex[intoc=true]
\begin{filecontents*}{\jobname.bib}
@book{strawson:1966,
  author         = {Peter Strawson},
  title          = {The Bounds of Sense},
  publisher      = {Routledge},
  location       = {London},
  year           = {1966},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
De nobis ipsis silemus\footcite{strawson:1966}: De re autem, quae agitur,
petimus, as Strawson\index{Strawson, Peter} told
\newpage
De nobis ipsis silemus: De re autem, quae agitur,
petimus, as Strawson\index{Strawson, Peter} told
\newpage
De nobis ipsis silemus\footcite{strawson:1966}: De re autem, quae agitur,
petimus, as Strawson told
\newpage
De nobis ipsis silemus
De nobis ipsis silemus: De re autem, quae agitur,
petimus, as Strawson\index{Strawson, Peter} told
\newpage
De nobis ipsis silemus\footcite{strawson:1966}: De re autem, quae agitur,
petimus, as Strawson told

\printbibliography
\printindex
\end{document}

where you'll note the double occurrence of Strawson. In example.idx I read

\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}
share|improve this question
1  
Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  egreg Mar 15 at 20:20
    
the usual reason for multiple index entries is differences in spacing in the different \index{...} inputs. you can take a look at the entries in the .idx file and see how they differ, and from that, usually figure out how to make them the same so that they will combine properly. since the bibliography is generated automatically, however, you may find it necessary to follow a "style" that isn't obvious. –  barbara beeton Mar 15 at 21:18
    
I reformatted your question, particularly for the code part (select it and click on the {} button for getting syntax coloring). Thanks for the very good minimal example. –  egreg Mar 15 at 22:13

2 Answers 2

up vote 7 down vote accepted

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:

enter image description here

Maybe there is a workaround also on the biblatex side, but I don't know it.

share|improve this answer
3  
The reason is that biblatex has a field called indexname to deal with the possibility that the name (for sorting/index purposes) should be different from the name as it should be printed. The easiest workaround, if it's only a few cases, might be to make the user-entered index entries match biblatex rather than the other way round, just as you have suggested. –  Paul Stanley Mar 15 at 22:41
    
the workaround from egreg works fine! @ Paul Stanley "to make the user-entered index entries": do you mean a manual index? –  user41063 Mar 15 at 22:49
    
Exactly. Egreg's suggestion is (no surprise!) effective. I was just trying to explain/justify the biblatex behavior which makes it necessary. –  Paul Stanley Mar 15 at 22:56

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
share|improve this answer
    
Thanx for your new solutions. At present, the "simple way" works, for in my index I've no names with prefix. Now going to sleep (here is 1.15am), tomorrow I'll consider the second way. –  user41063 Mar 16 at 0:19
    
Even if you have names with prefixes, the simple solution will work fine, so long as you are happy with "Beethoven, Ludwig van" (sorted as Beethoven) rather than "Van Beethoven, Ludwig" (sorted as van). –  Paul Stanley Mar 16 at 8:25
    
Maybe it's possible to solve on biblatex side by \DeclareIndexNameFormat macro, even if the manual is very brief about it –  user41063 Mar 16 at 12:17
    
Yes you can do this with \DeclareIndexNameFormat. The information you need is in biblatex.def which is where this is defined. It essentially calls the macro Paul Stanley mentions above so you can redefine it and simplify it a lot if you don't want the default behaviour. The default also deals with spurious spaces so that the index looks like the names it gets but doesn't mess up sorting with different variants with spaces, hence the x@x format for everything. –  PLK Mar 16 at 14:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.