2

It's incredible how noob can I be after years of LaTeXing, but... Here's the thing: I want an automatic Index of Names in which to merge biblatex entries and other stuff I put in manually.

I wrote the code you see in the MWE. It works fine, but when I go compiling I get a «Undefined index file» message like I were duplicating something or... don't know.

Note also that at the moment I am not running again makeindex on the aux file.

I suppose there is a way to clean my code but first of all I would like to understand what's going on. Could anyone help?

% !TEX TS-program = XeLaTeX
% !TEX encoding = UTF-8 Unicode

\begin{filecontents}{archivio.bib}

@incollection{Rae:Rap,
    Author = {Gilbert Raes},
    Booktitle = {La S. Sindone. Ricerche e studi della commissione di esperti nominata dall'Arcivescovo di Torino},
    Editor = {P. Caramello},
    Pages = {79-83},
    Series = {Supplemento Rivista diocesana torinese},
    Title = {Rapport d'analyse},
    Year = {1976}}


\end{filecontents}

\documentclass[11pt, openany]{book}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguages{latin, english, french}

\usepackage[]{csquotes}
\usepackage{xpatch}
\usepackage[style=verbose-trad2,
            language=auto,
            ibidpage=true,
            autolang=other,
            useprefix=true,
            giveninits=true,
            indexing=cite,
            dateabbrev=false,
            backend=biber,
        ]{biblatex}

\addbibresource{archivio.bib}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\usepackage{imakeidx}
\makeindex[name=nomi, intoc=true, title=Indice dei nomi]

\DeclareIndexNameFormat{default}{%          % Just authors and editors, no titles
\nameparts{#1}%
\usebibmacro{index:name}%
{\index[nomi]}%
{\namepartfamily}%
{\namepartgiveni}%
% {}% L1
% {}% L2
{\namepartprefix}% generates spurious space L3
{\namepartsuffix}% generates spurious space L4
}

\begin{document}


I am citing \cite[]{Rae:Rap}\\

But I want to add also John Smith\index[nomi]{Smith, J.} to my index of names.

\printindex[nomi]       % Indice dei nomi   
\end{document}
  • Mhhh. This works for me. I get both "Raes, G." and "Smith, J." in the index. Have you made sure you are running all involved tools often enough. I have latexmk taking care of that. You probably need at least (in that order) LaTeX, Biber, LaTeX, (LaTeX), makeindex, LaTeX, (LaTeX). – moewe Mar 12 '18 at 15:31
  • Just double-checked the necessary compilation step. On my MikTeX installation XeLaTeX can run makeindex automatically with imakeidx. So inly needed XeLaTeX, Biber, XeLaTeX, XeLaTeX. – moewe Mar 12 '18 at 15:43
  • It works fine for me too, but I got a message in the log saying: «Package imakeidx Warning: Undefined index file `"Prova Indici"' on input line 58.». “Prova Indici” is the name I gave to my tex file, and line 58 is the one citing via Biblatex. – Teodoro Mar 12 '18 at 16:42
2

In the setup of your MWE there are actually two indices

  1. The one named nomi accessed by \index[nomi]{...}
  2. and the "standard" index accessed with \index{...}.

You don't use the latter explicitly and don't set it up for use, but biblatex still writes the titles to that index with \indexfield{indextitle} in citeindex. If you don't want to index the titles at all, you should probably suppress that with

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\indexnames{labelname}}
    {}}

If you want the titles in a separate index, go for

\DeclareIndexFieldFormat{indextitle}{%
  \usebibmacro{index:title}{\index[titles]}{#1}}

and don't redefine citeindex.

With an up-to-date biblatex the name format can be shortened to

\DeclareIndexNameFormat{default}{%
  \usebibmacro{index:name}
    {\index[nomi]}
    {\namepartfamily}
    {\namepartgiveni}
    {\namepartprefix}
    {\namepartsuffix}}

To index both author and editor in the bibliography, try

\renewbibmacro*{bibindex}{%
  \ifbibindex
    {\indexnames{author}%
     \indexnames{editor}%
     %\indexfield{indextitle}%<--- you still don't want to index the title to avoid the warning.
    }
    {}}
  • Amazing, now everything is clear. I particulary appreciate when you explain why things work, or don't. A final question, but just if you have time: is there a way to put in the just created default index of names the editors too (even the ones in books with authors)? Perhaps you could add it to your previous answer, it would be a great example of index customisation. – Teodoro Mar 13 '18 at 8:40
  • 1
    @Teodoro That should be possible (haven't checked), but I don't think it makes sense with indexing=cite as you don't get to see the editor's name on that page. It might make sense if the bibliography entries were indexed as well. – moewe Mar 13 '18 at 8:53
  • Got it, let's switch to indexing=true. In my specific case, incidentally, it's the same since I have in my bibliography just entries that I cited at least once. Is there a "simple" way to put in the [nomi] index also the editors? – Teodoro Mar 16 '18 at 13:18
  • @Teodoro It's not really the same. If you have true there will be an index entry that points to the bibliography, with citing there will not be one pointing there. – moewe Mar 16 '18 at 14:17
  • 1
    @Teodoro The thing is that the editor is only shown on the first citation, if you cite the same work again later, the editor is not shown. If the editor is the indexed for that page as well (even though it is never shown there!), I would find that odd. Anyway, I indeed think it would be better if you asked a new question about that. – moewe Mar 18 '18 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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