-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbiblatex-certrand.sty
41 lines (33 loc) · 1.07 KB
/
biblatex-certrand.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Define a "Certified Random" citation option for biblatex
% Usage:
% Add this field to your bib entry:
% author+an = {=certrand},
% Then cite as normal!
% Code here: https://tex.stackexchange.com/a/489891
\newcommand*{\ifcertrand}{\iffieldannotation{certrand}}
\newcommand*{\certrandorelse}[1]{%
\ifcertrand
{\addspace\textcircled{r}\space}
{#1}}
\DeclareDelimFormat{multinamedelim}{\certrandorelse{\addcomma\space}}
\DeclareDelimFormat{finalnamedelim}{%
\certrandorelse{%
\ifnumgreater{\value{liststop}}{2}{\finalandcomma}{}%
\addspace\bibstring{and}\space}}
\NewBibliographyString{certrandothers}
\DefineBibliographyStrings{american}{%
certrandothers = {\textcircled{r} al\adddot},
}
\renewbibmacro*{name:andothers}{%
\ifboolexpr{
test {\ifnumequal{\value{listcount}}{\value{liststop}}}
and
test \ifmorenames
}
{\ifcertrand
{\printdelim{andothersdelim}\bibstring{certrandothers}}
{\ifnumgreater{\value{liststop}}{1}
{\finalandcomma}
{}%
\printdelim{andothersdelim}\bibstring{andothers}}}
{}}