-
Notifications
You must be signed in to change notification settings - Fork 4
/
publist.cbx
167 lines (148 loc) · 4.98 KB
/
publist.cbx
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
% publist.cbx, biblatex citation style by Juergen Spitzmueller
% requires biblatex >= 3.4
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
%
% This work has the LPPL maintenance status "maintained".
%
% This Current Maintainer of this work is Jürgen Spitzmüller.
%
% This work consists of the file publist.cbx and publist.bbx.
%
%
% This is a simple portmanteau file that just loads the standard
% "numeric" citation style. This file is provided to allow the loading
% of biblatex-publist via the "style=" (alternatively to "bibstyle=")
% option.
%
% Please send suggestions and bug reports to
% https://github.com/jspitz/biblatex-publist
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\bpl@version{2.13}
\def\bpl@rdate{2024/08/21}
\ProvidesFile{publist.cbx}[\bpl@rdate\space v.\bpl@version\space
biblatex citation style (JSP)]
\RequireCitationStyle{numeric}
\DeclareCiteCommand{\citesecitem}
{\defcounter{maxnames}{999}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\usebibmacro{bpl:cite:secitem}}
{\multicitedelim}
{\usebibmacro{postnote}}
\DeclareCiteCommand*{\citesecitem}
{\defcounter{maxnames}{999}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\usebibmacro{bpl:cite:secitem}%
\usebibmacro{bpl:cite:secitemsec}%
}
{\multicitedelim}
{\usebibmacro{postnote}}
\newbibmacro*{bpl:cite:secitem}{%
\ifcsdef{bpl@itemnumber:\thefield{entrykey}}%
{\mkbibbrackets{\csuse{bpl@itemnumber:\thefield{entrykey}}}}%
{\textbf{\mkbibbrackets{???}}}%
}
\newcommand*\secitemsecref[1]{%
\mkbibparens{\bibstring{section}\addnbspace\ref{refsection:#1}}%
}
\newbibmacro*{bpl:cite:secitemsec}{%
\ifcsdef{bpl@itemsec:\thefield{entrykey}}%
{\addspace\secitemsecref{\csuse{bpl@itemsec:\thefield{entrykey}}}}%
{}%
}
\DeclareCiteCommand{\citeitem}
{\defcounter{maxnames}{999}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\usebibmacro{bpl:cite:extern}}
{\multicitedelim}
{\usebibmacro{postnote}}
\newbibmacro*{bpl:cite:extern}{%
\printtext[bibhyperref]{%
\printfield{labelprefix}%
\usebibmacro{bpl:cite:labelnumber}%
\ifbool{bbx:subentry}
{\printfield{entrysetcount}}
{}}}
\newbibmacro*{bpl:cite:labelnumber}{%
\printtext[labelnumberwidth]{\mkrefdesc{\thefield{labelnumber}}}%
}
\newcommand*\itemrangesep{\bibrangedash}
\newcommand*\citeitemrange[2]{%
\citeitem{#1}\itemrangesep\citeitem{#2}%
}
\NewDocumentCommand\citesecitemrange{s m m}
{%
\IfBooleanTF{#1}%
{\ifcsdef{bpl@itemsec:#2}%
{\ifcsdef{bpl@itemsec:#3}%
{\ifcsequal{bpl@itemsec:#2}{bpl@itemsec:#3}%
{\citesecitem{#2}\itemrangesep}%
{\citesecitem*{#2}\,\itemrangesep\,}%
\citesecitem*{#3}}%
{\citesecitem*{#2}\itemrangesep\citesecitem*{#3}}%
}%
{\citesecitem{#2}\itemrangesep\citesecitem*{#3}}%
}%
{\citesecitem{#2}\itemrangesep\citesecitem{#3}}%
}
% Manual way to adjust numbering
\csdef{bpl@secstartshift}{0}
\newcommand*\shiftciteitem[1]{\csdef{bpl@secstartshift}{#1}}
% Print labelnumber as actual number, plus item total
% and probably a manual shift value
\newrobustcmd{\mkrefdesc}[1]{%
\number\numexpr#1+\csuse{bpl@itemtotal}+\csuse{bpl@secstartshift}\relax%
}
\providebool{@bpl@reversenum}
\providebool{@bpl@numberreset}
\providebool{plnumgroup}
\AtEndOfPackage{%
\if@bpl@reversenum
\newcounter{prevcrefsection}%
\renewrobustcmd{\mkrefdesc}[1]{%
\ifbool{@bpl@numberreset}{%
% Print the labelnumber as the total number of entries in the
% current refsection, minus the actual labelnumber, plus one
\ifbool{plnumgroup}{%
\number\numexpr\csuse{bpl@itemtotal}-#1+1%
+\csuse{bpl@secstartshift}\relax%
}{%
\ifcsdef{bpl@secitems:\therefsection}{%
\number\numexpr\csuse{bpl@secitems:\therefsection}-#1+1%
+\csuse{bpl@secstartshift}\relax%
}{%
\number\numexpr\csuse{bpl@itemtotal}-#1+1%
+\csuse{bpl@secstartshift}\relax%
}%
}%
}{%
% Use decreasing counter
\setcounter{prevcrefsection}{\therefsection}%
\addtocounter{prevcrefsection}{-1}%
\ifcsdef{bpl@items:\theprevcrefsection}{%
\number\numexpr\csuse{bpl@itemtotal}-#1+1%
-\csuse{bpl@items:\theprevcrefsection}%
+\csuse{bpl@secstartshift}\relax%
}{%
\number\numexpr\csuse{bpl@itemtotal}-#1+1%
+\csuse{bpl@secstartshift}\relax%
}%
}%
}%
\fi%
}
%%
\endinput