summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-ext/ext-biblatex-aux.def
blob: 869ea690d535d5b2da798dbac63c6baac73842fc (plain)
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
\ProvidesFile{ext-biblatex-aux.def}
  [2020/03/15 v0.8d auxiliaries for extended biblatex citation style
   (MW)]

\def\extblx@requiredbiblatexversion{3.14}
\def\extblx@requiredbiblatexdate{2019/12/01}

\protected\def\extblx@info{\PackageInfo{biblatex-ext}}
\protected\def\extblx@warning{\PackageWarning{biblatex-ext}}
\protected\def\extblx@warning@noline{%
  \PackageWarningNoLine{biblatex-ext}}

\protected\def\extblx@error#1#2{\PackageError{biblatex-ext}{#1}{#2.}}

\@ifpackagelater{biblatex}{\extblx@requiredbiblatexdate}
  {}
  {\extblx@warning@noline{%
      Outdated version of biblatex detected.\MessageBreak
      Upgrade to biblatex \extblx@requiredbiblatexversion\space
      (\extblx@requiredbiblatexdate) or later.\MessageBreak
      I found '\csuse{abx@version} (\csuse{abx@date})'}}


%{<context>}{<opening delim>}{<closing delim>}
\newrobustcmd*{\DeclareOuterCiteDelims}{%
  \extblx@declareciteddelims{outer}}
\newrobustcmd*{\DeclareInnerCiteDelims}{%
  \extblx@declareciteddelims{inner}}

%{<inner/outer>}{<cite context>}{<opening delim>}{<closing delim>}
\def\extblx@declareciteddelims#1#2#3#4{%
  \csdef{extblx@citedelim@#2@#1@open}{#3}%
  \csdef{extblx@citedelim@#2@#1@close}{#4}}

%{<context>}
\newrobustcmd*{\UndeclareOuterCiteDelims}{%
  \extblx@undeclareciteddelims{outer}}
\newrobustcmd*{\UndeclareInnerCiteDelims}{%
  \extblx@undeclareciteddelims{inner}}

%{<inner/outer>}{<cite context>}
\def\extblx@undeclareciteddelims#1#2{%
  \csundef{extblx@citedelim@#2@#1@open}%
  \csundef{extblx@citedelim@#2@#1@close}}

%{<alias>}{<cite context>}
\newrobustcmd*{\DeclareOuterCiteDelimsAlias}{%
  \@ifstar
    {\extblx@declareciteddelims@alias@i{outer}}
    {\extblx@declareciteddelims@alias{outer}}}
\newrobustcmd*{\DeclareInnerCiteDelimsAlias}{%
  \@ifstar
    {\extblx@declareciteddelims@alias@i{inner}}
    {\extblx@declareciteddelims@alias{inner}}}

%{<inner/outer>}{<alias>}{<cite context>}
\def\extblx@declareciteddelims@alias#1#2#3{%
  \csdef{extblx@citedelim@#2@#1@open}{%
    \csuse{extblx@citedelim@#3@#1@open}}%
  \csdef{extblx@citedelim@#2@#1@close}{%
    \csuse{extblx@citedelim@#3@#1@close}}}
\def\extblx@declareciteddelims@alias@i#1#2#3{%
  \csletcs{extblx@citedelim@#2@#1@open}{extblx@citedelim@#3@#1@open}%
  \csletcs{extblx@citedelim@#2@#1@close}{extblx@citedelim@#3@#1@close}}

% declare \mk...delim commands
\newrobustcmd*{\RegisterCiteDelims}[2]{%
  \ifcsundef{mk#1#2delims}
    {}
    {\extblx@error
       {Command \expandafter\string\csname mk#1#2delims\endcsname\space
        already defined}
       {biblatex-ext needs to define this command for the citation
        delimiter feature,\MessageBreak
        but \expandafter\string\csname mk#1#2delims\endcsname\space
        is already defined.\MessageBreak
        I don't want to overwrite the existing definition to avoid
        breaking your document.\MessageBreak
        If you force compilation despite the error, the command will be
        overwritten\MessageBreak
        with potentially catastrophic consequences}}%
  \protected\csdef{mk#1#2delims}##1{%
    \begingroup
      \blx@blxinit
      \blx@setsfcodes
      \csuse{extblx@citedelim@#2@#1@open}%
      ##1%
      \csuse{extblx@citedelim@#2@#1@close}%
    \endgroup}}

\RegisterCiteDelims{outer}{cite}
\RegisterCiteDelims{outer}{parencite}
\RegisterCiteDelims{outer}{supercite}
\RegisterCiteDelims{outer}{textcite}
\RegisterCiteDelims{outer}{footcite}
\RegisterCiteDelims{outer}{footcitetext}
\DeclareOuterCiteDelimsAlias{footcite}{footcitetext}

\RegisterCiteDelims{inner}{cite}
\RegisterCiteDelims{inner}{parencite}
\RegisterCiteDelims{inner}{supercite}
\RegisterCiteDelims{inner}{textcite}
\RegisterCiteDelims{inner}{footcite}
\RegisterCiteDelims{inner}{footcitetext}
\DeclareInnerCiteDelimsAlias{footcite}{footcitetext}

\newrobustcmd*{\mkextblxsupercite}[1]{%
  \mkbibsuperscript{%
    \mkoutersupercitedelims{#1}}}
\newrobustcmd*{\mkextblxfootcite}[1]{%
  \mkbibfootnote{%
    \mkouterfootcitedelims{#1}}}
\newrobustcmd*{\mkextblxfootcitetext}[1]{%
  \mkbibfootnotetext{%
    \mkouterfootcitetextdelims{#1}}}

% smartcite is special
% According to the docs it is like \parencite in a footnote and
% \footcite in the body.
% To mirror that as closely as possible, we need to change the
% delimiter context. The delimcontext is set in the pre-code, it is too
% late to detect a footnote at that point (since we will have started
% the footnote ourselves with \mkbibfootnote from the body), so we
% need to do it earlier.
\newrobustcmd*{\mksmartcite}[1]{%
  \iffootnote
    {\mkouterparencitedelims{%
       \def\extblx@thisdelimcontext{parencite}%
       #1}}
    {\mkextblxfootcite{%
       \def\extblx@thisdelimcontext{footcite}%
       #1}}}

%% Compatibility with older biblatex-ext
% Legacy names

% Compability for versions <= 0.3
% Changes were made for v0.4 2018-06-10.
\def\extblx@deprecate@delimcommand@robust#1#2{%
  \protected\csedef{#1}{%
    \noexpand\extblx@warning{%
      \expandafter\string\csname#1\endcsname\space is deprecated.
      \MessageBreak
      Use \expandafter\string\csname#2\endcsname\space (with s) instead.
      \MessageBreak
      Using \expandafter\string\csname#2\endcsname}%
  \expandonce{\csname#2\endcsname}}}

\extblx@deprecate@delimcommand@robust{DeclareOuterCiteDelim}
  {DeclareOuterCiteDelims}
\extblx@deprecate@delimcommand@robust{DeclareInnerCiteDelim}
  {DeclareInnerCiteDelims}
\extblx@deprecate@delimcommand@robust{UndeclareOuterCiteDelim}
  {UndeclareOuterCiteDelims}
\extblx@deprecate@delimcommand@robust{UndeclareInnerCiteDelim}
  {UndeclareInnerCiteDelims}
\extblx@deprecate@delimcommand@robust{DeclareOuterCiteDelimAlias}
  {DeclareOuterCiteDelimsAlias}
\extblx@deprecate@delimcommand@robust{DeclareInnerCiteDelimAlias}
  {DeclareInnerCiteDelimsAlias}

\newrobustcmd*{\extblx@create@mkcitedelim}{%
  \extblx@warning{%
    '\string\extblx@create@mkcitedelim' is deprecated.\MessageBreak
    Use '\string\RegisterCiteDelims' instead.\MessageBreak
    Using '\string\RegisterCiteDelims'}
  \RegisterCiteDelims}

% Some very rudimentary backwards warning code for old names
% this only warns, it can't salvage anything.
% Can/should this be removed in the future?
\AtEndDocument{%
  \ifcsundef{abx@ffd@*@bbx:introcite}
    {}
    {\extblx@warning@noline{%
       Field format 'bbx:introcite' defined.\MessageBreak
       The format has been renamed to 'bbx@introcite'.\MessageBreak
       This could mean that you are using the old name\MessageBreak
       which does not work any more.\MessageBreak
       No effort is made to switch to the new name.\MessageBreak
       Please use 'bbx@introcite' instead}}%
  \ifcsundef{abx@ffd@*@bbx:introcitelabeldate}
    {}
    {\extblx@warning@noline{%
       Field format 'bbx:introcitelabeldate'\MessageBreak
       defined.\MessageBreak
       The format has been renamed to\MessageBreak
       'bbx@introcitelabeldate'.\MessageBreak
       This could mean that you are using the old name\MessageBreak
       which does not work any more.\MessageBreak
       No effort is made to switch to the new name.\MessageBreak
       Please use\MessageBreak'bbx@introcitelabeldate'\MessageBreak
       instead}}%
  \ifcsundef{blx@delimcontextalias@bbx:introcite}
    {}
    {\extblx@warning@noline{%
       Delimiter context 'bbx:introcite' detected.\MessageBreak
       The context has been renamed to 'bbx@introcite'.\MessageBreak
       This could mean that you are using the old name\MessageBreak
       which does not work any more.\MessageBreak
       No effort is made to switch to the new name.\MessageBreak
       Please use 'bbx@introcite' instead}}%
  \ifcsundef{extblx@citedelim@bbx:introcite@inner@open}
    {}
    {\extblx@warning@noline{%
       Opening inner delimiter 'bbx:introcite' found.\MessageBreak
       The delimiters have been renamed to\MessageBreak
       'bbx@introcite'.\MessageBreak
       This could mean that you are using the old name\MessageBreak
       which does not work any more.\MessageBreak
       No effort is made to switch to the new name.\MessageBreak
       Please use 'bbx@introcite' instead}}%
  \ifcsundef{extblx@citedelim@bbx:introcite@inner@close}
    {}
    {\extblx@warning@noline{%
       Closing inner delimiter 'bbx:introcite' found.\MessageBreak
       The delimiters have been renamed to\MessageBreak
       'bbx@introcite'.\MessageBreak
       This could mean that you are using the old name\MessageBreak
       which does not work any more.\MessageBreak
       No effort is made to switch to the new name.\MessageBreak
       Please use 'bbx@introcite' instead}}%
}

% Compatibility with older biblatex

% \DeclareBiblatexOption (biblatex 3.13)
% we emulate \DeclareBiblatexOption only as far as we need it
% i.e. with scope 'global,type,entry' hard-coded
% we'll see for how long this is viable
\ifcsundef{DeclareBiblatexOption}
  {\newcommand*{\extblx@DeclareBiblatexOption}[1]{%
     \ifstrequal{#1}{global,type,entry}
       {\ifundef\extblx@warn@emulate@declarebiblatexoption
          {\global\let\extblx@warn@emulate@declarebiblatexoption\@empty
           \extblx@warning@noline{%
             Using biblatex-ext emulation of\MessageBreak
             \string\DeclareBiblatexOption\MessageBreak
             The scope argument 'global,type,entry' is hard-\MessageBreak
             coded and can't be changed.\MessageBreak
             Please update to biblatex 3.13 or above.\MessageBreak
             This warning can be silenced by defining\MessageBreak
             \string\extblx@warn@emulate@declarebiblatexoption}}
          {}}
       {\extblx@error
         {Emulation of \string\DeclareBiblatexOption\space only%
          \MessageBreak
          supports hard-coded scope argument\MessageBreak
          'global,type,entry'.\MessageBreak
          Update to biblatex 3.13 or above to use the real\MessageBreak
          definition instead of a cheap imitation}
         {This isn't actually \string\DeclareBiblatexOption,
          it is only the biblatex-ext\MessageBreak
          emulation.\MessageBreak
          The scope 'global,type,entry' is hard-coded and can't be changed.%
          \MessageBreak
          If you force compilation despite this error, 'global,type,entry'%
          \MessageBreak
          will be assumed.\MessageBreak
          That may cause further errors or undesirable and unexpected
          behaviour.\MessageBreak
          Update to biblatex 3.13 or above to use the real definition%
          \MessageBreak
          instead of a cheap imitation.\MessageBreak
          This emulation may be removed in a future version of biblatex-ext}}%
     \extblx@DeclareBiblatexOption@i}
   \newcommand*{\extblx@DeclareBiblatexOption@i}[2][boolean]{%
     \@ifnextchar[%]
      {\extblx@DeclareBiblatexOption@ii[#1]{#2}}
      {\extblx@DeclareBiblatexOption@iii[#1]{#2}}}
   \def\extblx@DeclareBiblatexOption@ii[#1]#2[#3]#4{%
     \DeclareBibliographyOption[#1]{#2}[#3]{#4}%
     \DeclareTypeOption[#1]{#2}[#3]{#4}%
     \DeclareEntryOption[#1]{#2}[#3]{#4}}
   \def\extblx@DeclareBiblatexOption@iii[#1]#2#3{%
     \DeclareBibliographyOption[#1]{#2}{#3}%
     \DeclareTypeOption[#1]{#2}{#3}%
     \DeclareEntryOption[#1]{#2}{#3}}%
   \let\DeclareBiblatexOption\extblx@DeclareBiblatexOption}
  {}

\endinput
%
% This file is part of the biblatex-ext bundle.
% biblatex-ext is released under the LaTeX Project Public License v1.3c
% or later.
%
% A complete list of files included in that package can be found in
% README.md or - failing that - in ext-standard.bbx.
%
% Official releases of this package are on CTAN
%   https://www.ctan.org/pkg/biblatex-ext
% development takes place on GitHub
%   https://github.com/moewew/biblatex-ext
%