使用“biblatex”和“imakeidx”根据bibtex文件中的关键字建立索引

使用“biblatex”和“imakeidx”根据bibtex文件中的关键字建立索引

作为起点,有两个示例可以构建根据“作者及其书名”和“出版书名年份”分组的索引这里

我还可以找到许多在“\printbibliography”命令中使用关键字的例子,但我并不是在寻找这个。

应该是设计解决方案的基础来源,但我无法弄清楚。

如果关键词以bibtex逗号分隔的列表形式呈现,则根据关键词组织标题(及其在文档中的引用位置)。

例如,对于mybib.bib

@article{adelson1982phenomenal,
  title={Phenomenal coherence of moving visual patterns},
  author={Adelson, Edward H and Movshon, J Anthony},
  journal={Nature},
  volume={300},
  number={5892},
  pages={523},
  year={1982},
  publisher={Nature Publishing Group},
  keywords={research, experimental}
}

@article{proske2012proprioceptive,
  title={The proprioceptive senses: their roles in signaling body shape, body position and movement, and muscle force},
  author={Proske, Uwe and Gandevia, Simon C},
  journal={Physiological reviews},
  volume={92},
  number={4},
  pages={1651--1697},
  year={2012},
  publisher={American Physiological Society Bethesda, MD},
  keywords={review, experimental}
}

该索引看起来应该是这样的:

experimental
    Phenomenal coherence of moving visual patterns, <position where the paper has been cited>
    The proprioceptive senses: their roles in signaling body shape, body position and movement, and muscle force, 4, 5

review
    The proprioceptive senses: their roles in signaling body shape, body position and movement, and muscle force, 4, 5

research
    Phenomenal coherence of moving visual patterns, <position where the paper has been cited>

最后,这个答案可能有助于构建解决方案。

答案1

etoolbox关键字是一个特殊的逗号分隔字段。我们可以使用's来迭代其项目\forcsvlist

然后只需要正确获取索引子条目即可。为此,我从22-indexing-subentry.tex, 尤其\DeclareIndexFieldFormat{with:year}

唯一index:keywords的参数#1包含一个关键字。然后我们索引该关键字并添加一个带有标题的子条目(字段有两个参数:第一个用于排序,第二个用于打印输出(如果您愿意,可以格式化);如果文件中没有明确给出\mkbibindex特殊字段indextitle和,则会自动计算)。indexsorttitle.bib

citeindex被改为索引关键词。最后,需要使用 打开引用索引indexing=cite

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, indexing=cite, backend=biber]{biblatex}
\usepackage{imakeidx}
\makeindex

\DeclareIndexFieldFormat{keywords}{%
  \forcsvlist{\usebibmacro{index:keywords}}{#1}}

\newbibmacro{index:keywords}[1]{%
  \usebibmacro{index:entry}{\index}{%
    #1%
    \subentryoperator
    \mkbibindexfield
      {\thefield{indexsorttitle}}
      {\emph{\csfield{indextitle}}}}}

\renewbibmacro*{citeindex}{%
  \ifciteindex
    {\indexfield{keywords}}
    {}}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{adelson1982phenomenal,
  title    = {Phenomenal coherence of moving visual patterns},
  author   = {Adelson, Edward H. and Movshon, J. Anthony},
  journal  = {Nature},
  volume   = {300},
  number   = {5892},
  pages    = {523},
  year     = {1982},
  keywords = {research, experimental},
}

@article{proske2012proprioceptive,
  title    = {The proprioceptive senses},
  subtitle = {Their roles in signaling body shape,
              body position and movement, and muscle force},
  author   = {Proske, Uwe and Gandevia, Simon C.},
  journal  = {Physiological reviews},
  volume   = {92},
  number   = {4},
  pages    = {1651--1697},
  year     = {2012},
  keywords = {review, experimental},
}
\end{filecontents}

\addbibresource{\jobname.bib}
\addbibresource{biblatex-examples.bib}


\begin{document}
Lorem \autocite{adelson1982phenomenal,sigfridsson}
\clearpage
ipsum \autocite{proske2012proprioceptive,worman}
\clearpage
dolor \autocite{proske2012proprioceptive,adelson1982phenomenal}
\printbibliography
\printindex
\end{document}

实验>移动视觉模式的现象连贯性>1, 3//实验>本体感受>2, 3//研究>移动视觉模式的现象连贯性>1, 3//评论>本体感受>2, 3

相关内容