如何从单个 .bib 文件生成每章的参考书目?

如何从单个 .bib 文件生成每章的参考书目?

假设我有一个名为“references.bib”的文件,其中有三个章节,我想为每一章生成单独的参考书目,引用编号从 1 开始。假设在第 1 章中我总共使用了 3 个引用,因此在该章节中它应该能够仅显示参考书目中的那些引用,并确保每章的引用编号都从 1 开始。我该怎么做?有人可以帮帮我吗?以下是我无法做到的 MWE。

 \documentclass[a4paper,11pt]{book} 
 \usepackage[backref=true,refsegment=section,backend=bibtex]{biblatex}
 \usepackage{filecontents}
 \begin{filecontents}{references.bib}
 @book{knuth1986texbook,
   keywords = {book},
   title={The texbook},
   author={Knuth, D.E. and Bibby, D.},
   volume={1993},
   year={1986},
   publisher={Addison-Wesley}
 }
 @article{knuth1977fast,
   keywords = {article},
   title={Fast pattern matching in strings},
   author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
   journal={SIAM journal on computing},
   volume={6},
   number={2},
   pages={323--350},
   year={1977},
   publisher={SIAM}
 }

 @article{Ancey1996,
 author = {Ancey, Christophe and Coussot, Philippe and Evesque, Pierre},
 journal = {Mechanics of Cohesive-frictional Materials},
 number = {4},
 pages = {385--403},
 title = {Examination of the possibility of a fluid-mechanics treatment of dense granular flows},
 url = {http://doi.wiley.com/10.1002/(SICI)1099-1484(199610)1:4<385::AID-CFM20>3.0.CO;2-0},
 volume = {1},
 year = {1996}
 }

 @BOOK{RR73,
  author={H. Radjavi and P. Rosenthal},
  title={Invariant {Subspaces}},
  publisher={Springer-Verlag},
  address={New York},
  year={1973},
 }

 @BOOK{Aup91,
  author={B. Aupetit},
  title={A {Primer} on {Spectral} {Theory}},
  publisher={Springer-Verlag},
  address={New York},
  year={1991},
 }
 \end{filecontents}

 \begin{document}
 \chapter{Chap 1}
 Test 1 \autocite{knuth1986texbook} and test \autocite{Aup91} and last is \autocite{RR73}.
 \printbibliography[heading=subbibliography]

 \chapter{Chap 2}
 Test 3 \autocite{Ancey1996} and test 4 \autocite{knuth1986texbook} and again test 1  .
 \printbibliography[heading=subbibliography]


 \end{document}

答案1

听起来你正在寻找refsection而不是refsegment

\documentclass[a4paper,11pt]{book} 
\usepackage[backref=true,refsection=chapter,sorting=none]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{references.bib}
@book{knuth1986texbook,
 keywords = {book},
 title={The texbook},
 author={Knuth, D.E. and Bibby, D.},
 volume={1993},
 year={1986},
 publisher={Addison-Wesley}
}
@article{knuth1977fast,
 keywords = {article},
 title={Fast pattern matching in strings},
 author={Knuth, D.E. and Morris Jr, J.H. and Pratt, V.R.},
 journal={SIAM journal on computing},
 volume={6},
 number={2},
 pages={323--350},
 year={1977},
 publisher={SIAM}
}

@article{Ancey1996,
author = {Ancey, Christophe and Coussot, Philippe and Evesque, Pierre},
journal = {Mechanics of Cohesive-frictional Materials},
number = {4},
pages = {385--403},
title = {Examination of the possibility of a fluid-mechanics treatment of dense granular flows},
url = {http://doi.wiley.com/10.1002/(SICI)1099-1484(199610)1:4<385::AID-CFM20>3.0.CO;2-0},
volume = {1},
year = {1996}
}

@BOOK{RR73,
author={H. Radjavi and P. Rosenthal},
title={Invariant {Subspaces}},
publisher={Springer-Verlag},
address={New York},
year={1973},
}

@BOOK{Aup91,
author={B. Aupetit},
title={A {Primer} on {Spectral} {Theory}},
publisher={Springer-Verlag},
address={New York},
year={1991},
}
\end{filecontents}
\addbibresource{references.bib}

\begin{document}

\chapter{Chap 1}
Test 1 \autocite{knuth1986texbook} and test \autocite{Aup91} and last is \autocite{RR73}.
\printbibliography[heading=subbibliography]


\chapter{Chap 2}
Test 3 \autocite{Ancey1996} and test 4 \autocite{knuth1986texbook} and again test 1  .
\printbibliography[heading=subbibliography]


\end{document}

相关内容