我想创建一个包含两个章节的文档。第一章之后应该有一个参考书目。下一章应该能够引用前一章的内容,但只显示参考书目中的新内容,从第一个参考书目的下一个数字开始。
例子:
第 1 章
Fu 是由 Bar [1] 完成的。早期版本...
参考书目
[1] Bar 等,Doning the Fu第 2 章 - Fu 与 Herp 的结合
[1] 中所描述的 Doning Fu 忽略了 Derp [2] 所指出的 Herp 的优点。因此......
参考书目
[2] Derp 等,使用 Herp 的优势
请不要过多讨论这是否是一个友好使用的想法,这不是我自己的要求:)
答案1
使用refsegment
将继续为您进行标签编号。要在一个子书目中打印参考文献(这会让大多数读者感到沮丧),您可以跟踪每个参考文献的延续编号,refsegment
并跳过标签小于该编号的任何项目。
下面的示例中使用了默认排序方案,但可以更改。要获得正确的标签编号,此方法需要使用 进行几次额外的传递latex
。biblatex
每当需要另一次传递时,都会向您发送一条消息。
\documentclass{report}
\usepackage[sorting=none,style=numeric,refsegment=chapter,defernumbers=true]{biblatex}
\usepackage{filecontents}
\defbibheading{subbibliography}{%
\section*{Bibliography}}
\makeatletter
% Overall entry counter
\csnumgdef{blx@entrycount}{0}
\AtEveryBibitem{%
\csnumgdef{blx@entrycount}{\csuse{blx@entrycount}+1}}
% Continued from this label number
\appto{\newrefsegment}{%
\csnumgdef{blx@entrycount@\the\c@refsegment}{\csuse{blx@entrycount}+1}}
% Skip entries with label numbers less than the continued number
\defbibcheck{onlynew}{%
\ifnumless{\thefield{labelnumber}}{\csuse{blx@entrycount@\the\c@refsegment}}
{\skipentry}
{}}
\makeatother
\begin{filecontents}{\jobname.bib}
@Book{companion,
author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
date = {1994}}
@Article{gillies,
author = {Gillies, Alexander},
title = {Herder and the Preparation of Goethe's Idea of World Literature},
journaltitle = {Publications of the English Goethe Society},
volume = {9},
date = {1933},
pages = {46--67}}
@Article{bertram,
author = {Bertram, Aaron and Wentworth, Richard},
title = {Gromov invariants for holomorphic maps on Riemann surfaces},
journaltitle = {J.~Amer. Math. Soc.},
volume = {9},
number = {2},
date = {1996},
pages = {529--571}}
@Book{poetics,
author = {Aristotle},
editor = {Lucas, D. W.},
title = {Poetics},
series = {Clarendon Aristotle},
publisher = {Clarendon Press},
location = {Oxford},
date = {1968}}
@Book{rhetoric,
author = {Aristotle},
editor = {Cope, Edward Meredith},
commentator = {Cope, Edward Meredith},
title = {The Rhetoric of Aristotle with a commentary by the late Edward Meredith Cope},
volumes = {3},
publisher = {Cambridge University Press},
date = {1877}}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\chapter{First}
\cites{companion}{rhetoric}
\printbibliography[segment=\therefsegment,check=onlynew,heading=subbibliography]
\chapter{Second}
\cites{companion}{bertram}{poetics}
\printbibliography[segment=\therefsegment,check=onlynew,heading=subbibliography]
\chapter{Third}
\cites{companion}{bertram}{gillies}{rhetoric}
\printbibliography[segment=\therefsegment,check=onlynew,heading=subbibliography]
\end{document}
第一章的结果:
第二:
第三:
答案2
由于接受答案中的代码不再适用于较新版本的biblatex
(如biblatex:连续参考编号,无重复),下面是更新后的版本,应该可以再次使用。
该答案是从我对链接问题的回答中逐字复制的。
我建议使用以下希望更稳定的解决方案。对于每个条目,它会记录refsegment
它被引用的第一个条目。onlynew
然后过滤器只需要检查这个条目refsegment
的数字是否小于当前的数字refsegment
。
\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\makeatletter
\AtEveryCitekey{%
\ifcsundef{blx@entry@refsegment@\the\c@refsection @\thefield{entrykey}}
{\csnumgdef{blx@entry@refsegment@\the\c@refsection @\thefield{entrykey}}{\the\c@refsegment}}
{}}
\defbibcheck{onlynew}{%
\ifnumless{0\csuse{blx@entry@refsegment@\the\c@refsection @\thefield{entrykey}}}{\the\c@refsegment}
{\skipentry}
{}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,worman}
\printbibliography[segment=\therefsegment,check=onlynew]
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,geer,nussbaum}
\printbibliography[segment=\therefsegment,check=onlynew]
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,geer,pines,worman}
\printbibliography[segment=\therefsegment,check=onlynew]
\end{document}
这是一个同样适用于 的解决方案\nocite
。由于 没有 的\AtEveryCitekey
等价词,因此\nocite
我们必须挂接到内部命令。
\documentclass{article}
\usepackage[defernumbers=true]{biblatex}
\makeatletter
\def\blx@citation@entry#1#2{%
\blx@bibreq{#1}%
\ifinlist{#1}\blx@cites
{}
{\listgadd{\blx@cites}{#1}}%
\blx@auxwrite\@mainaux{}{\string\abx@aux@cite{#1}}%
\ifinlistcs{#1}{blx@segm@\the\c@refsection @\the\c@refsegment}
{}
{\listcsgadd{blx@segm@\the\c@refsection @\the\c@refsegment}{#1}}%
\blx@auxwrite\@mainaux{}{\string\abx@aux@segm{\the\c@refsection}%
{\the\c@refsegment}%
{\detokenize{#1}}}%
\ifcsundef{blx@entry@refsegment@\the\c@refsection @#1}
{\csnumgdef{blx@entry@refsegment@\the\c@refsection @#1}{\the\c@refsegment}}
{}%
\blx@ifdata{#1}
{}
{\ifcsdef{blx@miss@\the\c@refsection}
{\ifinlistcs{#1}{blx@miss@\the\c@refsection}
{}
{\blx@logreq@active{#2{#1}}}}
{\blx@logreq@active{#2{#1}}}}}
\defbibcheck{onlynew}{%
\ifnumless{0\csuse{blx@entry@refsegment@\the\c@refsection @\thefield{entrykey}}}{\the\c@refsegment}
{\skipentry}
{}}
\makeatother
\addbibresource{biblatex-examples.bib}
\begin{document}
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,worman}
\printbibliography[segment=\therefsegment,check=onlynew]
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,geer,nussbaum}\nocite{knuth:ct:a}
\printbibliography[segment=\therefsegment,check=onlynew]
\newrefsegment
refsegment \therefsegment:
\cite{sigfridsson,geer,pines,worman}\nocite{knuth:ct:a,knuth:ct:b}
\printbibliography[segment=\therefsegment,check=onlynew]
\end{document}