0

Based on the questions:

  1. How to show Not cited and Cited i times on pages ..., in the bibliography when using biblatex?,
  2. How to detect whether \PassOptionsToPackage was already called?
  3. How to detect whether the option citecounter was enabled on biblatex?

I build the following example:

enter image description here

But I would like for it to use a dot to separate my new cited entry, instead of using a comma. For example, instead of:

Visited on: 17 Feb. 2018, cited one time on page 1.

I would like to see: ......\/..... (dot here, not comma)

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}

Related questions:

  1. biblatex \newblock and \finentry don't insert specified punctuation
  2. biblatex: move backrefpages to after the period
  3. Guidelines for customizing biblatex styles
  4. Remove finentrypunct if multicitedelim is in place
  5. How to remove the full stop at the end of each bibliography entry?

1 Answer 1

1

If I run your MWE on my fully updated MikTeX machine this morning I get a full stop before the pageref info as you hoped. According to \listfiles my biblatex-abnt is at version 3.4

abnt.bbx    2018-11-17 v3.4 ABNT BibLaTeX citation style

Usually (in the standard styles for example) the punctuation before pageref is controlled by \bibpagerefpunct. So if you wanted to change the punctuation you would just say

\renewcommand*{\bibpagerefpunct}{\addcomma\space}

This worked in older versions of biblatex-abnt and will work again in future versions with https://github.com/abntex/biblatex-abnt/pull/55.

The current release version 3.4 of biblatex-abnt uses \setunit*{\bibpagerefpunct} where \setunit{\bibpagerefpunct} would be more appropriate and therefore usually drops this punctuation in favour of the standard \newunitpunct.

As a temporary measure you could include the \setunit{\bibpagerefpunct} directly in your pageref redefinition (I usually don't recommend this, but since biblatex-abnt does it at the moment and it seems the shortest workaround, you should be fine).

\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

With this code \bibpagerefpunct should work as expected.

8
  • Thank you for being so thorough!
    – user
    Nov 13, 2019 at 2:12
  • moewe, I tried using this fix, but it still using a comma instead of dot.
    – user
    Nov 13, 2019 at 2:35
  • @user I assume you tried the last code block and did not update or get abnt.bbx from the link? In that case it might help to replace \setunit{\bibpagerefpunct}% with \printunit{\bibpagerefpunct}%, but that is a long shot. As I said, with an up-to-date system the MWE from the question (without modifications) shows periods as you hoped, so it is hard to investigate what is going on at your end not knowing your package versions and additional changes that might be happening. If at all possible and viable (i.e. not before a tight deadline) I recommend an update.
    – moewe
    Nov 13, 2019 at 6:27
  • moewe, Yes. I did not update the abnt.bbx file. I use Debian 9 with TexLive 2016. For a deadline, I can update my current version of abnt.bbx by manually download it and replacing my TexLive 2016 file. Other than that, I just would like to keep the document working out of the box when someone else also compiles it with some old version of abnt.tex. When I get home, I will try your new suggestion.
    – user
    Nov 13, 2019 at 16:23
  • moewe, I tried adding \setunit{\bibpagerefpunct}, but it did not worked neither. If you can look into, I use biblatex {2016/12/05} version{3.7} and abnt.cbx, 2017/07/28 v3.1.
    – user
    Nov 14, 2019 at 2:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .