![使用“biblatex”和“imakeidx”根据bibtex文件中的关键字建立索引](https://linux22.com/image/399321/%E4%BD%BF%E7%94%A8%E2%80%9Cbiblatex%E2%80%9D%E5%92%8C%E2%80%9Cimakeidx%E2%80%9D%E6%A0%B9%E6%8D%AEbibtex%E6%96%87%E4%BB%B6%E4%B8%AD%E7%9A%84%E5%85%B3%E9%94%AE%E5%AD%97%E5%BB%BA%E7%AB%8B%E7%B4%A2%E5%BC%95.png)
作为起点,有两个示例可以构建根据“作者及其书名”和“出版书名年份”分组的索引这里。
我还可以找到许多在“\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}