如何在书籍类别中使用不同的 bib 文件打印不同的书目?这是示例大纲。
\documentclass{book}
\usepackage[backend=bibtex]{biblatex}
\addbibresource{file1.bib}
\addbibresource{file2.bib}
\addbibresource{file3.bib}
\begin{document}
\chapter{First}
...
...
\printbibliography{file1}
\chapter{Second}
...
...
\printbibliography{file2}
\chapter{Third}
...
...
\printbibliography{file3}
\end{document}
有可能吗?如果可以,怎么办?由于格式选项和兼容性原因,我更愿意避免使用 chapterbib 和/或 natbib。biblatex 以原生方式支持参考文献中的许多 URL。
答案1
您可以将章节保存在不同的refsection
s 中,并使用<resource>
参数将所有内容缩小到特定.bib
文件。请注意,refsection
s 是完全独立的,因此\nocite{*}
仅适用于当前章节及其相关.bib
文件。
我backend=biber,
在示例中使用了 ,因为这样只需要调用一次后端。如果您绝对必须使用 BibTeX,代码也可以使用,backend=bibtex,
但您必须在多个文件上运行 BibTeX(按照.log
文件中的说明或使用类似工具latexmk
来为您解决)。由于biblatex
的高级功能仅适用于 Biber,因此我强烈建议您考虑使用 Biber。
\documentclass[british]{book}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[backend=biber, style=authoryear]{biblatex}
\begin{filecontents}{\jobname-file1.bib}
@book{elk,
author = {Anne Elk},
title = {A Theory on Brontosauruses},
year = {1972},
publisher = {Monthy \& Co.},
location = {London},
}
\end{filecontents}
\begin{filecontents}{\jobname-file2.bib}
@article{sigfridsson,
author = {Sigfridsson, Emma and Ryde, Ulf},
title = {Comparison of methods for deriving atomic charges from the
electrostatic potential and moments},
journaltitle = {Journal of Computational Chemistry},
date = 1998,
volume = 19,
number = 4,
pages = {377-395},
doi = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
\end{filecontents}
\begin{filecontents}{\jobname-file3.bib}
@book{worman,
author = {Worman, Nancy},
title = {The Cast of Character},
date = 2002,
publisher = {University of Texas Press},
location = {Austin},
}
@book{nussbaum,
author = {Nussbaum, Martha},
title = {Aristotle's \mkbibquote{De Motu Animalium}},
date = 1978,
publisher = {Princeton University Press},
location = {Princeton},
keywords = {secondary},
}
\end{filecontents}
\addbibresource{\jobname-file1.bib}
\addbibresource{\jobname-file2.bib}
\addbibresource{\jobname-file3.bib}
\begin{document}
\newrefsection[\jobname-file1.bib]
\chapter{First}
Lorem \autocite{elk}
\nocite{*}
\printbibliography[heading=subbibliography]
\newrefsection[\jobname-file2.bib]
\chapter{Second}
Ipsum \autocite{sigfridsson}
\nocite{*}
\printbibliography[heading=subbibliography]
\newrefsection[\jobname-file3.bib]
\chapter{Third}
Dolor \autocite{worman}
\nocite{*}
\printbibliography[heading=subbibliography]
\end{document}