![当 biblatex 中没有更多引用时,“从今以后引用为...”](https://linux22.com/image/339329/%E5%BD%93%20biblatex%20%E4%B8%AD%E6%B2%A1%E6%9C%89%E6%9B%B4%E5%A4%9A%E5%BC%95%E7%94%A8%E6%97%B6%EF%BC%8C%E2%80%9C%E4%BB%8E%E4%BB%8A%E4%BB%A5%E5%90%8E%E5%BC%95%E7%94%A8%E4%B8%BA...%E2%80%9D.png)
在这个例子中,即使没有更多引用,也会写上简写介绍“此后引用为...”。我更希望只有那些实际重复的引用才得到“此后”并被列入简写列表中。
\documentclass{article}
\usepackage[style=verbose]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}
Baz.\autocite{kant:kpv}
\printshorthands
\printbibliography
\end{document}
通过这个例子我得到
我希望仅获取 KpV 今后的信息,并且不让 KU 出现在缩写列表中。
答案1
第一个问题(对于仅引用一次的项目,没有“从今以后引用为……”)已经解决这里。
第二个问题(未引用任何项目,仅在“缩写”中列出一次)已得到处理这里(这个问题可能被认为是重复的吗?)。
编辑:基于这些,我的解决方案如下(按照moewe的建议,我改变了之前的解决方案,使其更优雅):
\documentclass{article}
\usepackage[style=verbose,backend=biber,citecounter=true]{biblatex} % option citecounter=true added
\addbibresource{biblatex-examples.bib}
\addbibresource{blref.bib}
% Set threshold to 1
\newcommand{\SHthreshold}{1}
% Redefinition of shorthandintro
\savebibmacro{shorthandintro}
\renewbibmacro*{shorthandintro}{%
\ifnumgreater{\value{citecounter}}{\SHthreshold}%
{\restorebibmacro{shorthandintro}%
\usebibmacro{shorthandintro}}%
{}}
% Consider only items cited more than threshold-value times for Abbreviations list
\defbibcheck{shorthand}{%
\iffieldundef{shorthand}%
{\skipentry}%
{\ifnumgreater{\value{citecounter}}{\SHthreshold}%
{}%
{\skipentry}}}
\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}
Baz.\autocite{kant:kpv}
\printshorthands
\printbibliography
\end{document}
为了完整性,我还保留了我以前的解决方案:
\documentclass{article}
\usepackage[style=verbose,citecounter=true]{biblatex} % option citecounter=true added
\addbibresource{biblatex-examples.bib}
\addbibresource{blref.bib}
% Set threshold to 1
\newcommand{\SHthreshold}{1}
\renewbibmacro*{cite:full}{%
\usebibmacro{cite:full:citepages}%
\printtext[bibhypertarget]{%
\usedriver
{\DeclareNameAlias{sortname}{default}}
{\thefield{entrytype}}}%
% \usebibmacro{shorthandintro}}% DELETED
\ifnumgreater{\value{citecounter}}{\SHthreshold}{% NEW
\usebibmacro{shorthandintro}% NEW
}{% NEW
}% NEW
}% NEW
% Category with citecounter > 1
\DeclareBibliographyCategory{allowshorthand}
\AtEveryCitekey{%
\ifnumgreater{\value{citecounter}}{\SHthreshold}{%
\addtocategory{allowshorthand}{\thefield{entrykey}}%
}{%
}%
}
\begin{document}
Foo.\autocite{kant:kpv}
Bar.\autocite{kant:ku}
Baz.\autocite{kant:kpv}
\printshorthands[category=allowshorthand] % option category=allowshorthand added
\printbibliography
\end{document}