0

I think this is the definition of the citecounter option on the biblatex package:

\DeclareBibliographyOption[boolean]{citecounter}[true]{%
  \ifcsdef{blx@opt@citecounter@#1}
    {\csuse{blx@opt@citecounter@#1}}
    {\blx@err@invopt{citecounter=#1}{}}}
\def\blx@opt@citecounter@true{%
  \let\blx@setcitecounter\blx@setcitecounter@global
  \let\blx@citecounter\blx@citecounter@global
  \let\abx@aux@count\blx@aux@count
  \let\abx@aux@fncount\blx@aux@fncount
  \booltrue{citetracker}}
\def\blx@opt@citecounter@context{%
  \let\blx@setcitecounter\blx@setcitecounter@context
  \let\blx@citecounter\blx@citecounter@context
  \let\abx@aux@count\blx@aux@count
  \let\abx@aux@fncount\blx@aux@fncount
  \booltrue{citetracker}}
\def\blx@opt@citecounter@false{%
  \let\blx@setcitecounter\relax
  \let\blx@citecounter\relax
  \let\abx@aux@count\@gobbletwo
  \let\abx@aux@fncount\@gobbletwo}

Then, what can I use to know whether the option was enabled?

For example:

\usepackage[style=abnt,language=english,citecounter=false]{biblatex}

\if citecounter=false
    \message{Citecounter is false^^J}

\else
    \message{Citecounter is enabled^^J}
\fi

Related:

  1. Can I count the number of times each reference is cited?
  2. How to detect whether \PassOptionsToPackage was already called?
  3. Nested \ifdefined statements
  4. Checking if certain package option is declared inside .sty
1

The quoted definition shows that \blx@citecounter is equal to \relax if and only if the citecounter feature is deactivated. So you can check for that.

One way would be

\ifcsvoid{blx@citecounter}
  {NO CITECOUNTER}
  {CITECOUNTER}

(Technically, \ifcsvoid{blx@citecounter} tests if \blx@citecounter is \relax or a parameterless macro with empty replacement, but that should be good enough here.)

If you want to stick to TeX conditionals

\makeatletter
\ifx\blx@citecounter\relax
  NO CITECOUNTER%
\else
  CITECOUNTER%
\fi
\makeatother

would also work.

0

In addition to citecounter, I can also check whether backref was set too. Given the source for the backref option on biblatex package:

\DeclareBibliographyOption[boolean]{backref}[true]{%
  \ifstrequal{#1}{true}
    {\let\blx@backref\blx@addbackref
     \let\abx@aux@backref\blx@aux@backref
     \booltrue{backtracker}}
    {\let\blx@backref\@gobble
     \let\abx@aux@backref\@gobblefive
     \boolfalse{backtracker}}}

I can check whether both citetracker and backref were set with:

\usepackage[style=abnt,language=english,backend=biber,citecounter=true]{biblatex}

\makeatletter
\ifx\blx@citecounter\relax
  \message{citecounter defined!^^J}
\else
  \message{citecounter not defined!^^J}
\fi
\makeatother

\ifcitetracker
  \message{citetracker defined!^^J}
\else
  \message{citetracker not defined!^^J}
\fi

\ifbacktracker
  \message{backref defined!^^J}
\else
  \message{backref not defined!^^J}
\fi
  • Note that the citetracker bool as tested with \ifcitetracker is activated by several options (citecounter being one of them) and need not mean that the tracking option citetracker has been enabled. – moewe Apr 8 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.