我想在我的文档中列出两个参考文献列表。但是,我希望每个参考文献在整个文档中只出现一次。
\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\bibliography{foo}
\begin{document}
\begin{refsection}
\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{mynature}.
\printbibliography[prefixnumbers=A,heading=subbibliography]
\end{refsection}
\section{Research}
\begin{refsection}
I will use the methods developed in \cite{mynature} to address
the questions raised in \cite{other}.
\printbibliography[heading=subbibliography]
\end{refsection}
\end{document}
以下是 foo.bib 的内容:
@article{mynature,
author={Ego Sum},
journal={Nature Soundbites},
title={Aardvarks are artistic},
year={2013}
}
@article{other,
author={Tu Es},
journal={Gnu Letters},
title={Gnus gnaw gnomes},
year={2014}
}
在这两个参考书目中,我只想要自然之声出现一次,并在两处引用为 [A1]。
欢迎任何建议!
答案1
您不能refsection
在这里使用,因为的内容refsections
是完全分开且彼此独立的,因此无法在它们之间“同步”标签。
这里我们可以使用refsegment
s 来代替,它们不是保存在本地,而是一起工作。
A\printbibliography
不会自动将自身限制在当前refsegment
,例如,需要使用 来指示它这样做segment=\therefsegment
。您的第一部分如下所示
\begin{refsegment}
\defbibfilter{notother}{not segment=\therefsegment}
\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}
对于第二部分,我们希望忽略来自其他部分的条目,这可以通过过滤器来实现
\defbibfilter{notother}{not segment=\therefsegment}
在第一部分中发布。
然后第二部分变成
\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,filter=notother]
\end{refsegment}
或者使用\printbibliography[heading=subbibliography, filter=notother]
仅忽略来自第一段的条目(并且不会另外限制其自身到当前段 - 在您的设置中没有区别,但在更大的文档中可能会有区别)。
平均能量损失
\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
\begin{refsegment}
\defbibfilter{notother}{not segment=\therefsegment}
\section{Previous Track Record}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}
\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,filter=notother]
\end{refsegment}
\end{document}
resetnumbers=true
您可以通过添加调用让第二个列表中的编号重新开始\printbibliography
。
另一种解决方案不需要您提前知道段的编号,而是使用参考书目类别并对其进行修改\AtEveryCitekey
并保存在本地。
\makeatletter
\newrobustcmd*{\AtEveryCitekeyLocal}{\appto\blx@hook@citekey}
\makeatother
和
\DeclareBibliographyCategory{firstsection}
然后我们在第一个段内使用\AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}}
。此分配保持本地化,以便只有此组内(即此引用段内)的引用才会添加到类别中。
\begin{refsegment}
\section{Previous Track Record}
\AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}
第二部分书目只需要过滤那些notcategory=firstsection
平均能量损失
\documentclass{article}
\usepackage[backend=biber,defernumbers=true]{biblatex}
\addbibresource{biblatex-examples.bib}
\DeclareBibliographyCategory{firstsection}
\makeatletter
\newrobustcmd*{\AtEveryCitekeyLocal}{\appto\blx@hook@citekey}
\makeatother
\begin{document}
\begin{refsegment}
\section{Previous Track Record}
\AtEveryCitekeyLocal{\addtocategory{firstsection}{\thefield{entrykey}}}
I am an acknowledged authority on aardvarks \cite{sigfridsson}.
\printbibliography[prefixnumbers=A,heading=subbibliography,segment=\therefsegment]
\end{refsegment}
\begin{refsegment}
\section{Research}
I will use the methods developed in \cite{sigfridsson} to address
the questions raised in \cite{geer}.
\printbibliography[heading=subbibliography,segment=\therefsegment,notcategory=firstsection]
\end{refsegment}
\end{document}