citecounter
我认为这是包上的选项的定义biblatex
:
\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}
那么,我可以用什么来知道该选项是否已启用?
例如:
\usepackage[style=abnt,language=english,citecounter=false]{biblatex}
\if citecounter=false
\message{Citecounter is false^^J}
\else
\message{Citecounter is enabled^^J}
\fi
有关的:
答案1
引用的定义表明,当且仅当该功能被停用时,才\blx@citecounter
等于。因此您可以检查一下。\relax
citecounter
一种方法是
\ifcsvoid{blx@citecounter}
{NO CITECOUNTER}
{CITECOUNTER}
(从技术上讲,\ifcsvoid{blx@citecounter}
测试是否\blx@citecounter
为\relax
或具有空替换的无参数宏,但这在这里应该足够了。)
如果你想坚持使用 TeX 条件语句
\makeatletter
\ifx\blx@citecounter\relax
NO CITECOUNTER%
\else
CITECOUNTER%
\fi
\makeatother
也可以。
答案2
除了citecounter
,我还可以检查 是否也设置了。给出包上选项backref
的来源:backref
biblatex
\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}}}
我可以检查citetracker
和是否都backref
设置了:
\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