我想.bib
使用 打印文件中的剩余条目biblatex
,也就是说,我有一组大量的条目,我使用对 的各种调用将它们打印在文档中的多个位置\printbibliography
,然后我想通过打印尚未打印的任何引用来结束。所需的解决方案不应依赖于条目.bib
本身,也就是说,重点不是必须浏览条目并添加关键字或类似内容。
我目前无法使用的解决方案是\AtEveryBibitem
将打印的条目放入一个类别中,以便能够打印尚未属于此类别的所有条目。当然,这种策略只起到了一半的作用,因为它最终会陷入震荡,未分类的条目每隔一次就会被归入该类别,因为\AtEveryBibItem
在打印这些条目时也会运行 (因此,如果\AtEveryBibitem
可以在最后一次调用之前以某种方式重置该语句,\printbibliography
那将是一个解决方案)。
梅威瑟:
\documentclass{article}
\usepackage{biblatex}
\begin{filecontents}{mybib.bib}
@article{ref1,
author = {Guyon, Isabelle and Elisseeff, Andr\'{e}},
journal = {The Journal of Machine Learning Research},
pages = {1157--1182},
title = {{An introduction to variable and feature selection}},
volume = {3},
year = {2003}
}
@book{ref2,
author = {Michel Goossens and Frank Mittelbach and Alexander Samarin},
title = {The LaTeX Companion},
year = {1993},
publisher = {Addison-Wesley},
address = {Reading, Massachusetts}
}
@inproceedings{ref3,
author = {Conf Author},
title = {Conf Title},
year = {2040},
keywords = {confpaper}
}
\end{filecontents}
\addbibresource{mybib.bib}
\DeclareBibliographyCategory{printed}
\AtEveryBibitem{\addtocategory{printed}{\thefield{entrykey}}}
\begin{document}
\nocite{*} % The .bib file contains several hundreds of entries
\printbibliography[title={Journal articles},type=article]
\printbibliography[title={Conference papers},keyword=confpaper]
% Many other bibliographies are printed using various \printbibliography statements
% And now the entries that have never been printed should be printed
\printbibliography[title={Uncategorized},notcategory=printed]
\end{document}
答案1
使用\AtEveryBibitem
不起作用,因为 s 是在biblatex
文档\bibitem
开头加载的,而不是在打印参考文献列表时加载的(例如\printbibliography
)。另一种方法是向打印记录的指令添加一个钩子。一种选择是在 bib 宏中插入有关类别的信息,finentry
该宏在指令末尾调用以显示 bib 记录。此外,我们可以在打印其他 bib 记录时添加切换以关闭该功能。
\newtoggle{categorise} % load the etoolbox package, \usepackage{etoolbox}
\DeclareBibliographyCategory{printed}
\renewbibmacro{finentry}{%
\iftoggle{categorise}
{\addtocategory{printed}{\thefield{entrykey}}
{}
}%
\finentry
}
然后
\nocite{*} % The .bib file contains several hundreds of entries
\toggletrue{categorise}
\printbibliography[title={Journal articles},type=article]
\printbibliography[title={Conference papers},keyword=confpaper]
% Many other bibliographies are printed using various \printbibliography statements
% And now the entries that have never been printed should be printed
\togglefalse{categorise}
\printbibliography[title={Uncategorized},notcategory=printed]
使用 MWE 可得出