根据问题:
- 使用 biblatex 时,如何在参考书目中显示第 ... 页上的未引用和被引用 i 次?,
- 如何检测 \PassOptionsToPackage 是否已被调用?
- 如何检测 biblatex 上是否启用了 citecounter 选项?
我构建了以下示例:
但我希望它使用点来分隔我新引用的条目,而不是使用逗号。例如,而不是:
Visited on: 17 Feb. 2018, cited one time on page 1.
我想看看:(......\/.....
这里是点,不是逗号)
Visited on: 17 Feb. 2018. Cited one time on page 1.
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@mvbook{assis08,
author = {Machado de Assis},
title = {Obra completa em quatro volumes},
year = {2008},
editor = {Aluizio Leite and Ana Lima Cecilio and Heloisa Jahn},
editortype = {organizer},
edition = {2},
volumes = {4},
publisher = {Nova Fronteira},
location = {Rio de Janeiro},
series = {Biblioteca luso-brasileira. Série brasileira brasileira brasiled},
urlaccessdate = {2018-02-17},
}
@book{koma-scrguien,
author = {Markus Kohm},
edition = {2017-04-13},
howpublished = {\url{http://mirrors.ibiblio.org/CTAN/.../scrguien.pdf}},
publisher = {Online Material; \url{https://www.ctan.org/pkg/koma-script}},
title = {The Guide KOMA -Script},
urlaccessdate = {2017-08-28},
year = {2017},
}
\end{filecontents*}
\PassOptionsToPackage{brazil,main=english,spanish,french}{babel}
\documentclass[12pt,a4paper,english]{abntex2}
\usepackage[utf8]{inputenc}
\usepackage{csquotes}
\selectlanguage{english}
\usepackage[
style=abnt,repeatfields=true,backend=biber,backref=true,citecounter=true]{biblatex}
\pdfstringdefDisableCommands{\let\uppercase\relax}
\addbibresource{\jobname.bib}
\makeatletter
\newcommand{\biblatexcitedntimes}{\autocap{c}ited \arabic{citecounter} times}
\newcommand{\biblatexcitedonetime}{\autocap{c}ited one time}
\newcommand{\biblatexcitednotimes}{\autocap{n}o citation in the text}
\@ifpackageloaded{babel}{\@ifpackagewith{babel}{brazil}{\addto\captionsbrazil{%
\renewcommand{\biblatexcitedntimes}{\autocap{c}itado \arabic{citecounter} vezes}
\renewcommand{\biblatexcitedonetime}{\autocap{c}itado uma vez}
\renewcommand{\biblatexcitednotimes}{\autocap{n}enhuma citação no texto}
}}{}}{}
\makeatother
\ifx\blx@citecounter\relax
\message{Is citecounter defined? NO!^^J}
\else
\message{Is citecounter defined? YES!^^J}
\ifbacktracker
\message{Is backtracker defined? YES!^^J}
\renewbibmacro*{pageref}
{
\iflistundef{pageref}
{\printtext{\biblatexcitednotimes}}
{%
\printtext
{%
\ifnumgreater{\value{citecounter}}{1}
{\biblatexcitedntimes}
{\biblatexcitedonetime}
}%
\setunit{\addspace}%
\ifnumgreater{\value{pageref}}{1}
{\bibstring{backrefpages}\ppspace}
{\bibstring{backrefpage}\ppspace}%
\printlist[pageref][-\value{listtotal}]{pageref}%
}%
}
\DefineBibliographyStrings{brazil}
{
backrefpage = {na página},
backrefpages = {nas páginas},
}
\DefineBibliographyStrings{english}
{
backrefpage = {on page},
backrefpages = {on pages},
}
\else
\message{Is backtracker defined? NO!^^J}
\fi
\fi
\begin{document}
Citing \cite{assis08}.
Citing \cite{koma-scrguien}.
\printbibliography
\end{document}
相关问题:
答案1
如果我今天早上在我完全更新的 MikTeX 机器上运行你的 MWE,我会得到一个句号,pageref
就像你希望的那样。根据\listfiles
我的biblatex-abnt
版本 3.4
abnt.bbx 2018-11-17 v3.4 ABNT BibLaTeX citation style
通常(例如在标准样式中)之前的标点符号pageref
由 控制\bibpagerefpunct
。因此,如果你想更改标点符号,你只需说
\renewcommand*{\bibpagerefpunct}{\addcomma\space}
这在旧版本中有效,biblatex-abnt
并且在未来的版本中将再次有效https://github.com/abntex/biblatex-abnt/pull/55。
当前发布的 3.4 版本biblatex-abnt
使用\setunit*{\bibpagerefpunct}
where\setunit{\bibpagerefpunct}
更为合适,因此通常会删除此标点符号而采用标准\newunitpunct
。
作为一种临时措施,您可以\setunit{\bibpagerefpunct}
直接将其包含在您的pageref
重新定义中(我通常不推荐这样做,但是因为biblatex-abnt
目前这样做并且它似乎是最短的解决方法,所以您应该没问题)。
\ifx\blx@citecounter\relax
\message{Is citecounter defined? NO!^^J}
\else
\message{Is citecounter defined? YES!^^J}
\ifbacktracker
\message{Is backtracker defined? YES!^^J}
\renewbibmacro*{pageref}
{\printunit{\bibpagerefpunct}% I'd have preferred \setunit,
% but \printunit covers more edge cases
\iflistundef{pageref}
{\printtext{\biblatexcitednotimes}}
{%
\printtext
{%
\ifnumgreater{\value{citecounter}}{1}
{\biblatexcitedntimes}
{\biblatexcitedonetime}%
}%
\setunit{\addspace}%
\ifnumgreater{\value{pageref}}{1}
{\bibstring{backrefpages}\ppspace}
{\bibstring{backrefpage}\ppspace}%
\printlist[pageref][-\value{listtotal}]{pageref}%
}%
}
\DefineBibliographyStrings{brazil}
{
backrefpage = {na página},
backrefpages = {nas páginas},
}
\DefineBibliographyStrings{english}
{
backrefpage = {on page},
backrefpages = {on pages},
}
\else
\message{Is backtracker defined? NO!^^J}
\fi
\fi
使用此代码\bibpagerefpunct
应该可以按预期工作。