重复索引或冗余(或两者)?

重复索引或冗余(或两者)?

令人难以置信的是,经过多年的 LaTeXing 之后,我竟然变得如此菜鸟,但是......事情是这样的:我想要一个自动名称索引,以便将 biblatex 条目和我手动输入的其他内容合并在一起。

我编写了您在 MWE 中看到的代码。它运行良好,但当我进行编译时,我收到一条“未定义索引文件”消息,就像我复制了某些内容或...不知道。

还请注意,目前我没有在 aux 文件上再次运行 makeindex。

我想有一种方法可以清理我的代码,但首先我想了解发生了什么。有人能帮忙吗?

% !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}

答案1

在 MWE 的设置中实际上有两个索引

  1. 名为nomi访问的\index[nomi]{...}
  2. 以及使用 访问的“标准”索引\index{...}

您没有明确使用后者,也没有将其设置为使用,但仍然使用biblatex将标题写入该索引。如果您根本不想索引标题,您可能应该使用\indexfield{indextitle}citeindex

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

如果您希望将标题放在单独的索引中,请选择

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

不要重新定义citeindex

使用最新的biblatex名称格式可以缩短为

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

要在参考书目中索引作者和编辑者,请尝试

\renewbibmacro*{bibindex}{%
  \ifbibindex
    {\indexnames{author}%
     \indexnames{editor}%
     %\indexfield{indextitle}%<--- you still don't want to index the title to avoid the warning.
    }
    {}}

相关内容