使用 Biblatex 和 Imakeidx 创建位置索引

使用 Biblatex 和 Imakeidx 创建位置索引

我想将我的参考书目的“地址”字段发送到索引(不是默认索引)我的代码不起作用:

% !BIB TS-program = biber
% !BIB program = biber
% !TEX encoding = UTF-8 Unicode
% !TeX TS-program = xelatexmk

\begin{filecontents}{archivio.bib}

@book{Dol2,
    Address = {Moskwa},
    Author = {Philip Döllinger},
    Publisher = {Sinodal'naja tip.},
    Title = {Sistematičeskoe opisanie rukopisej moskovskoj Sinodal'noj (patriaršej) biblioteki},
    Year = {1894}}


\end{filecontents}

\documentclass[A4, 11pt, twoside, openany]{book}

\usepackage{fontspec}
\usepackage{polyglossia}                        % Per le sillabazioni
    \setmainlanguage{italian}

%%%%%%%%%%%%%%%%%%%COMANDI DI BILIOGRAFIA%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[style=verbose-ibid,indexing=true]{biblatex}
\addbibresource{archivio.bib}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%INDICI%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{imakeidx}
\makeindex[name=luoghi, title=Luoghi]


\DeclareIndexFieldFormat{address}{%
\usebibmacro{index:entry}{\index[luoghi]}{%
       \thefield{address}\subentryoperator%
       \mkbibindexfield{\thefield{address}}{\emph{#1}}}}

\begin{document}
\cite{Dol2}


\printindex[luoghi]

\end{document}

答案1

  1. address只是 的别名location。内部biblatex address不存在 ,它被locationBiber 重新映射到 。因此,除了.bib文件中的其他地方address都必须是location

  2. location( address) 不是普通字段,而是列表字段。这意味着您不能使用\DeclareIndexFieldFormat,而需要\DeclareIndexListFormat

  3. biblatex仅当您明确指示它索引该字段时才会索引该字段。通常索引是通过 bibmacrosbibindex和进行的citeindex,因此您需要将 添加\indexlist{location}到这些 bibmacros 中(取决于您是否希望索引引文和/或参考书目条目;bibmacros 的原始定义可以在 中找到biblatex.defbibindex位于 ll. 2354-2358 [在 v3.14 中]citeindex在 ll. 2305-2309 [在 v3.14 中])。

您还可以使用 bibmacro index:field(尽管它的名字不同,但它也可以用于列表) 简化实际索引格式。

\documentclass[a4paper, 11pt, twoside, openany]{book}

\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{italian}

\usepackage[style=verbose-ibid,indexing=true]{biblatex}

\usepackage{imakeidx}
\makeindex[name=luoghi, title=Luoghi]

\DeclareIndexListFormat{location}{%
  \usebibmacro{index:field}{\index[luoghi]}{#1}{\emph{#1}}}

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\indexnames{labelname}%
     \indexfield{indextitle}%
     \indexlist{location}}
    {}}

\renewbibmacro*{bibindex}{%
  \ifbibindex
    {\indexnames{labelname}%
     \indexfield{indextitle}%
     \indexlist{location}}
    {}}

\begin{filecontents}[force]{\jobname.bib}
@book{Dol2,
  address   = {Moskwa},
  author    = {Philip Döllinger},
  publisher = {Sinodal'naja tip},
  title     = {Sistematičeskoe opisanie rukopisej moskovskoj Sinodal'noj (patriaršej) biblioteki},
  year      = {1894},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\cite{Dol2}

\printindex[luoghi]
\end{document}

莫斯科, 1

相关内容