我有两个.bib
文件,我想获得两个单独的参考书目部分,每个部分都包含来自一个文件的参考文献。更准确地说,我有mine.bib
和external.bib
,我想mine.bib
将来自的条目放入“出版物列表”部分,将来自的条目external.bib
放入“外部参考书目”。
使用 biblatex,我发现了很多方法来获取几个参考书目来源(\addbibresource
)和几个参考书目部分(本质上,\printbibliography
用不同的参数调用几次),但我找不到根据参考书目来源进行过滤的方法。
biblatex 似乎是最佳候选者,但我并不局限于它,因此任何使用其他工具的答案都会受到欢迎。
用例是编写一份活动报告,其中我的出版物列表必须是单独的(因为它是这样评估的),但我也可以包含\cite
其他人的论文。
提前致谢。
答案1
(答案改编自仅打印一个 bib 文件。感谢@moewe 提供的原始答案以及@Ulrike Fischer 向我指出这一点。)
一个解决方案是:
- 为来自给定文件的每个条目添加关键字
- 打印参考书目时过滤此关键字
该解决方案需要biber
普通的 并且无法使用bibtex
。
完整示例:
\documentclass{article}
\usepackage{filecontents}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[backend=biber]{biblatex}
\usepackage{hyperref}
\begin{filecontents*}{self.bib}
@book{mine1,
author = {Myself},
title = {My first paper},
}
@book{mine2,
author = {Myself and My Coauthor},
title = {My second paper},
}
\end{filecontents*}
\begin{filecontents*}{external.bib}
@online{Dijk:Numbering,
author = {Edsger W. Dijkstra},
title = {Why numbering should start at zero},
editor = {Kevin Hely},
date = {1982-08-11},
url = {https://www.cs.utexas.edu/users/EWD/transcriptions/EWD08xx/EWD831.html},
urldate = {2013-08-19},
gender = {sm},
keywords = {numbering},
}
@book{priest:IntNonClassLogic,
title = {An Introduction to Non-Classical Logic},
subtitle = {From If to Is},
author = {Graham Priest},
edition = {2},
year = {2012},
isbn = {978-0-521-67026-5},
publisher = {Cambridge University Press},
location = {Cambridge},
}
\end{filecontents*}
\addbibresource{self.bib}
\addbibresource{external.bib}
% Add the keyword "self" to everything coming from self.bib.
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\perdatasource{self.bib}
\step[fieldset=keywords, fieldvalue={,self}, append]
}
}
}
\begin{document}
I wrote several papers like \cite{mine1} and \cite{mine2} and other
people did too \cite{Dijk:Numbering,priest:IntNonClassLogic}.
% Disable automatic title for \printbibliography, we'll display it
% ourselves.
\defbibheading{bibliography}[\refname]{}
\section{List of publications}
\printbibliography[keyword={self}]
\section{External bibliography}
\printbibliography[notkeyword={self}]
\end{document}
生成的 PDF 文件: