Biblatex 和 imakeidx 创建作者、术语和标题的索引

Biblatex 和 imakeidx 创建作者、术语和标题的索引

我想创建一个作者索引, 一个标题索引术语索引使用biblatex和。indexing=citeimakeidx

然而,我只得到了一个作者索引

我的 MWE 是:

\documentclass{memoir}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman,english]{babel}

\usepackage[style=authoryear-icomp,indexing,indexing=cite,backend=biber]{biblatex}
\bibliographystyle{alpha}
\bibliography{\jobname}

% add authors, editors, etc to list of authors
\renewbibmacro*{citeindex}{%
  \ifboolexpr{ test {\ifciteindex} and not test {\iffootnote} }
    {\indexnames{labelname}}{}}

\usepackage[xindy]{imakeidx}
\makeindex
\makeindex[name=term,title=Index of Terms,columns=2]

\begin{document}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
  @book{Knu86,
    author = {Knuth, Donald E.},
    year = {1986},
    title = {The \TeX book},
  }
\end{filecontents}

\begin{document}

This \index[term]{book} is great! \cite{Knu86}

\printbibliography

\renewcommand{\indexname}{Index of Authors}
\printindex
\printindex[term]

\end{document}

通常indexing会给出包含作者和标题的索引。Indexing=cite只有作者。在我的示例中,获取三个索引的最简单方法是什么?

答案1

灵感来自使用 biblatex 进行索引 - 如何过滤出索引作者的出版物标题?你可以尝试

\documentclass{article}
\usepackage[T1]{fontenc} 
\usepackage[ngerman]{babel}
\usepackage{csquotes}
\usepackage[indexing=cite, backend=biber, style=authoryear-icomp]{biblatex}
\usepackage[xindy]{imakeidx}
\makeindex
\makeindex[program=texindy, name=nameindex, title = Index of names]
\makeindex[program=texindy, name=titleindex, title = Index of titles]

\DeclareIndexNameFormat{default}{%
  \usebibmacro{index:name}
    {\index[nameindex]}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}

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

\renewbibmacro*{citeindex}{%
  \ifboolexpr{ test {\ifciteindex} and not test {\iffootnote} }
    {\indexnames{labelname}%
      \indexfield{indextitle}}{}}

\addbibresource{biblatex-examples.bib}
\addbibresource{\jobname.bib}
\begin{document}
\cite{geer,worman,sigfridsson,cicero}
\index{foo}

\printbibliography
\printindex[nameindex]
\printindex[titleindex]
\printindex
\end{document}

相关内容