我使用 BibLaTeX 来处理我的参考书目,并且我希望在引用同一作品并具有相同编号的每一页的脚注中放置参考文献。我还希望能够在同一页上多次引用同一作品。后者可以通过使用代码来自 Joseph Wright 的博客。但是,它只在脚注中引用了一次。
答案1
TeX.SE 上有许多关于 Joseph 的引用风格的帖子。其中之一询问是否将限制\ifciteseen
在当前页面。可接受的解决方案需要过多的 LaTeX 运行才能编译,并且不对脚注进行排序。
\sfcite
以下文档中定义的新引用命令解决了这些限制。它还可以正确处理labelnumber
前缀和简写。
\documentclass{article}
\usepackage[style=numeric-comp,sorting=none,citetracker,pagetracker=page]{biblatex}
\usepackage[colorlinks]{hyperref}
\makeatletter
% user-level citation command
\DeclareCiteCommand{\sfcite}[\cbx@superscript]
{\usebibmacro{cite:init}%
\let\multicitedelim\supercitedelim
\iffieldundef{prenote}{}{\BibliographyWarning{Ignoring prenote argument}}%
\iffieldundef{postnote}{}{\BibliographyWarning{Ignoring postnote argument}}}
{\usebibmacro{citeindex}%
\usebibmacro{cite:super:foot}%
\usebibmacro{cite:comp}}
{}
{\usebibmacro{cite:dump}}
% save instcount, save key and last inline instcount if seen first on page
\newbibmacro*{cite:super:foot}{%
\xdef\cbx@key{\thefield{entrykey}}%
\ifsamepage{\value{instcount}}{\csuse{cbx@instcount@\cbx@key}}{}{%
\listxadd{\cbx@savelist}{\cbx@key}%
\ifnumequal{\value{cbx@inst@lastonpage}}{0}{%
\defcounter{cbx@inst@iter}{\value{instcount}}%
\loop\ifnum\value{cbx@inst@iter}>0
\ifsamepage{\value{instcount}}{\value{cbx@inst@iter}}
{\ifcsundef{blx@fnpage@\number\numexpr\value{cbx@inst@iter}}
{\setcounter{cbx@inst@lastonpage}{\value{cbx@inst@iter}}}{}%
\stepcounter{cbx@inst@iter}}
{\setcounter{cbx@inst@iter}{0}}%
\repeat}{}}%
\csnumgdef{cbx@instcount@\cbx@key}{\value{instcount}}}
\let\cbx@savelist\@empty
\newcounter{cbx@inst@iter}
\newcounter{cbx@inst@lastonpage}
\setcounter{cbx@inst@lastonpage}{0}
\newrobustcmd*{\cbx@superscript}[1]{%
\global\toggletrue{cbx@sfcite}
\mkbibsuperscript{#1}%
\cbx@footnote%
\global\togglefalse{cbx@sfcite}}
\newtoggle{cbx@sfcite}
\AtEveryCitekey{%
\ifciteseen{}{\csnumgdef{cbx@instcount@\thefield{entrykey}}{-1}}%
\iftoggle{cbx@sfcite}{}{\cbx@footnote}}
\AtEveryBibitem{\cbx@footnote}
\AtEveryLositem{\cbx@footnote}
% defer citation footnotes to last inline reference instance on page
\newrobustcmd*{\cbx@footnote}{%
\ifboolexpr{ not test {\ifdefempty{\cbx@savelist}}
and test {\ifnumequal{\value{instcount}}{\value{cbx@inst@lastonpage}}} }
{\cbx@sortlist@init%
\let\do\cbx@do
\dolistloop{\cbx@sortlist}%
\global\let\cbx@savelist\@empty
\setcounter{cbx@inst@lastonpage}{0}}{}}
% print footnotes in 'sorting' order
\def\cbx@do#1{%
\ifinlist{#1}{\cbx@savelist}
{\begingroup
\blx@resetdata
\blx@getrefcontext{#1}%
\blx@getdata@cite{#1}%
\blx@setoptions@type\abx@field@entrytype
\blx@setoptions@entry
\blx@execute
\blx@beglang
\iffieldundef{shorthand}
{\gdef\@thefnmark{\printfield{labelprefix}\printfield{labelnumber}}}
{\gdef\@thefnmark{\printfield{shorthand}}}%
\gappto\@thefnmark{\blx@initunit}%
\ifhyperref
{\H@@footnotetext{\blx@driver\abx@field@entrytype}}
{\@footnotetext{\blx@driver\abx@field@entrytype}}%
\blx@endlang
\endgroup}
{}}
% access internal list of sorted entry keys
\def\cbx@sortlist@init{%
\global\letcs{\cbx@sortlist}
{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}}
\let\cbx@sortlist\@empty
\makeatother
\addbibresource{biblatex-examples.bib}
\renewcommand*{\thefootnote}{\fnsymbol{footnote}}
\begin{document}
\null\vfill\noindent
New citation.\sfcite{companion}
New and recurrent citations.\sfcite{kant:ku,companion}
Vanilla footnote with citation.\footnote{Following \textcite{companion}...}
\clearpage
\null\vfill\noindent
New citation.\sfcite{ctan}
Recurrent citations from previous and current pages.\sfcite{companion,ctan}
\clearpage
\printbibliography
\end{document}
以下是第一页的引用:
第二:
引用脚注的打印将延迟到当前页面上的最后一个内联引用、速记条目列表或参考书目项目。如果文档还包含常规脚注,这可能会造成限制,但可以使用类似 的包来解决manyfoot
。