如何使用点分隔我的新参考书目条目?

如何使用点分隔我的新参考书目条目?

根据问题:

  1. 使用 biblatex 时,如何在参考书目中显示第 ... 页上的未引用和被引用 i 次?
  2. 如何检测 \PassOptionsToPackage 是否已被调用?
  3. 如何检测 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. biblatex \newblock 和 \finentry 不插入指定的标点符号
  2. biblatex:将 backrefpages 移至句点之后
  3. 自定义 biblatex 样式的指南
  4. 如果存在 multicitedelim 则删除 finentrypunct
  5. 如何删除每个参考书目条目末尾的句号?

答案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应该可以按预期工作。

相关内容