publ-ini.mkxl /size: 72 Kb    last modification: 2021-10-28 13:51
1
%D \module
2
%D [ file=publ-ini,
3
%D version=2013.05.12,
4
%D title=\CONTEXT\ Publication Support,
5
%D subtitle=Initialization,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
% TODO: some clf_ can be public implementers instead
15 16
% TODO: s! vs v! for default and neutral key/values
17
% todo: too many refs in list
18 19
% TODO A.-B. Foo (dash as connector, see JMH)
20 21
% todo: no need for all these %'s
22 23
% todo: tagging
24
% todo: we cannot use 'default' as this wipes metadata names (maybe no longer do that)
25
% todo: \v!cite => \s!cite
26
% todo: interface with (ml)bibtex (export -> call -> import)
27
% todo: check if 'all' etc are ok ... either use list or use other criterium
28
% todo: \the\everysetupbtxciteplacement probably too often
29 30
% \definecolor[btx:field] [darkred]
31
% \definecolor[btx:crossref][darkblue]
32
% \definecolor[btx:key] [darkgreen]
33
% \definecolor[btx:todo] [darkyellow]
34 35
%D We operate on several axis:
36
%D
37
%D \startitemize[packed]
38
%D \startitem we can have several databases (or combinations) \stopitem
39
%D \startitem we can add entries to them if needed (coded in tex) \stopitem
40
%D \startitem we can have several lists each using one of the databases \stopitem
41
%D \startitem we can render each list or citation independently \stopitem
42
%D \stopitemize
43
%D
44
%D We assume that the rendering of a list entry is consistent in a document,
45
%D although one can redefine properties if needed. Adding more granularity would
46
%D complicate the user interface beyond comprehension.
47 48
\writestatus
{
loading
}
{
ConTeXt
Publication
Support
/
Initialization
}
49 50
\registerctxluafile
{
publ
-
dat
}
{
}
51
\registerctxluafile
{
publ
-
ini
}
{
}
52
\registerctxluafile
{
publ
-
sor
}
{
}
53
\registerctxluafile
{
publ
-
aut
}
{
}
54
\registerctxluafile
{
publ
-
usr
}
{
}
55
\registerctxluafile
{
publ
-
oth
}
{
}
% this could become an option
56
\registerctxluafile
{
publ
-
fnd
}
{
}
% new method (for the moment only local)
57
\registerctxluafile
{
publ
-
jrn
}
{
}
58
\registerctxluafile
{
publ
-
reg
}
{
}
59
\registerctxluafile
{
publ
-
tra
}
{
}
% has more general helpers too
60 61
\unprotect
62 63
\startcontextdefinitioncode
64 65
%D These are currently not interfaced.
66 67
\definesystemconstant
{
btx
}
68 69
\definesystemconstant
{
btxset
}
70
\definesystemconstant
{
btxref
}
71
\definesystemconstant
{
btxint
}
72
\definesystemconstant
{
btxltx
}
73
\definesystemconstant
{
btxrtx
}
74
\definesystemconstant
{
btxatx
}
75
\definesystemconstant
{
btxbtx
}
76
\definesystemconstant
{
btxspc
}
77
\definesystemconstant
{
btxlst
}
78
\definesystemconstant
{
btxcom
}
79 80
\defineinterfacevariable
{
btxcite
}
{
btxcite
}
81
\defineinterfacevariable
{
btxlist
}
{
btxlist
}
82
\defineinterfacevariable
{
btxrendering
}
{
btxrendering
}
83 84
\definelabelclass
[
btxlabel
]
[
2
]
85 86
\clf_definelabels
{
btxlabel
}
{
btx
}
\s!false
\relax
87 88
% It is not that trivial to come up with a proper organization of setup
89
% and control commands for publications. This is because we have complex
90
% inline as well as extensive list rendering. The rules are partially
91
% driven by somewhat archaic bibtex specifications and evolving journal
92
% (or field) specific demands. The logic in the standards is often so
93
% complex that it looks like manual rendering is assumed. But, we want to
94
% automate the process as much as possible.
95
%
96
% Another complication is that in manuals we want to demonstrate different
97
% properties of the implementation and therefore we need a way to handle
98
% independent standards, databases, etc. This has resulted in the following
99
% organization:
100
%
101
% - general setup (rather minimal)
102
% - list setup (rendering)
103
% - cite setup
104
% - dataset setup
105
%
106
% The rendering is mostly driven by setups. In there we can call for fields
107
% in the database but also for virtual fields or combinations.
108 109
% The main rendering style (standard driven).
110 111
%D We assume that a specification is global or used grouped. It doesn't make much sense
112
%D to split between cite and list here as it only complicates matters (timing) and is
113
%D not clear either.
114 115
\mutable
\let
\currentbtxspecification
\empty
116
\mutable
\let
\currentbtxspecificationfallback
\empty
117 118
\installmacrostack
\currentbtxspecification
119
\installmacrostack
\currentbtxspecificationfallback
120 121
\permanent
\protected
\def
\startbtxrenderingdefinitions
[
#
1
]
%
122
{
\unprotect
123
\push_macro_currentbtxspecification
124
\edef
\currentbtxspecification
{
#
1
}
}
125 126
\permanent
\protected
\def
\stopbtxrenderingdefinitions
127
{
\pop_macro_currentbtxspecification
128
\protect
}
129 130
\permanent
\protected
\def
\loadfoundpublicationfile
#
1
#
2
% name foundname / not a user command
131
{
\input
{
#
2
}
}
132 133
\permanent
\protected
\def
\loadbtxdefinitionfile
[
#
1
]
{
\clf_btxloaddefinitionfile
{
#
1
}
}
% can be public implementer
134
\permanent
\protected
\def
\loadbtxreplacementfile
[
#
1
]
{
\clf_btxloadreplacementfile
{
#
1
}
}
% can be public implementer
135 136
\protected
\def
\publ_specification_push
#
1
%
137
{
\push_macro_currentbtxspecification
138
\push_macro_currentbtxspecificationfallback
139
\edef
\currentbtxspecification
{
#
1
}
%
140
\edef
\currentbtxspecificationfallback
{
\namedbtxparameter
\currentbtxspecification
\c!default
}
%
141
\ifx
\currentbtxspecificationfallback
\currentbtxspecification
142
\let
\currentbtxspecificationfallback
\empty
143
\fi
144
\clf_btxsetspecification
{
\currentbtxspecification
}
}
145 146
\protected
\def
\publ_specification_pop
147
{
\pop_macro_currentbtxspecificationfallback
148
\pop_macro_currentbtxspecification
149
\clf_btxsetspecification
{
\currentbtxspecification
}
}
150 151
\protected
\def
\publ_specification_set
#
1
% beware: is global
152
{
\edef
\currentbtxspecification
{
#
1
}
%
153
\edef
\currentbtxspecificationfallback
{
\namedbtxparameter
\currentbtxspecification
\c!default
}
%
154
\ifx
\currentbtxspecificationfallback
\currentbtxspecification
155
\let
\currentbtxspecificationfallback
\empty
156
\fi
157
% has to be done explicitly: \loadbtxdefinitionfile[\currentbtxspecification]%
158
\ifempty
\currentbtxspecification
159
% we set default at the end
160
\else
161
\clf_btxsetspecification
{
\currentbtxspecification
}
%
162
\fi
}
% todo: ,true == also load
163 164
\installcorenamespace
{
btx
}
165 166
\installswitchcommandhandler
\??btx
{
btx
}
\??btx
167 168
% because we have lots of setups we provide a checker for sloppy users
169 170
\protected
\def
\btx_check_chain
#
1
#
2
#
3
%
171
{
\doifelsesomething
{
#
3
}
172
{
\writestatus
{
btx
#
1
}
{
defining
\space
"
#
2
"
\space
as
\space
descendant
\space
of
\space
"
#
3
"
}
% we're in definition regime (no space)
173
\definebtx
[
#
2
]
[
#
3
]
}
174
{
\writestatus
{
btx
#
1
}
{
defining
\space
"
#
2
"
}
%
175
\definebtx
[
#
2
]
}
}
176 177
% \protected\def\btxcheckdefine#1#2{\doifelsecommandhandler\??btx{#1}\donothing{\btx_check_chain{define}{#1}{#2}}}
178
% \protected\def\btxchecksetup #1#2{\doifelsecommandhandler\??btx{#1}\donothing{\btx_check_chain {setup}{#1}{#2}}}
179 180
\permanent
\protected
\def
\btxcheckdefine
#
1
{
\doifelsecommandhandler
\??btx
{
#
1
}
\gobbleoneargument
{
\btx_check_chain
{
define
}
{
#
1
}
}
}
% {#2}
181
\permanent
\protected
\def
\btxchecksetup
#
1
{
\doifelsecommandhandler
\??btx
{
#
1
}
\gobbleoneargument
{
\btx_check_chain
{
setup
}
{
#
1
}
}
}
% {#2}
182 183
% for the moment experimental:
184 185
\permanent
\protected
\def
\btxenableautodefine
186
{
\prependtoks
187
\clf_checkinterfacechain
{
\currentbtx
}
{
btxcheckdefine
}
%
188
\to
\everydefinebtx
189
\prependtoks
190
\ifnum
\btxsetupmode
=
\doingrootsetupnamed
191
\clf_checkinterfacechain
{
\currentbtx
}
{
btxchecksetup
}
%
192
\fi
193
\to
\everysetupbtx
194
\let
\btxenableautodefine
\relax
}
195 196
\appendtoks
197
\ifnum
\btxsetupmode
=
\doingrootsetuproot
198
\publ_specification_set
{
\btxparameter
\c!specification
}
%
199
\orelse
\ifnum
\btxsetupmode
=
\doingrootsetupnamed
200
\doifelsecommandhandler
\??btx
\currentbtx
201
{
\publ_specification_set
{
\btxparameter
\c!specification
}
}
%
202
{
}
% maybe a warning
203
\fi
204
\to
\everysetupbtx
205 206
\appendtoks
207
\ifnum
\btxsetupmode
=
\doingrootsetuproot
208
\edef
\currentbtxdataset
{
\clf_btxsetdataset
{
\btxparameter
\c!dataset
}
{
\currentbtxdataset
}
}
%
209
\fi
210
\to
\everysetupbtx
211 212
\appendtoks
213
\publ_specification_set
{
\btxparameter
\c!specification
}
%
214
\to
\everyjob
215 216
\permanent
\protected
\def
\startusingbtxspecification
[
#
1
]
%
217
{
\publ_specification_push
{
#
1
}
}
218 219
\permanent
\protected
\def
\stopusingbtxspecification
220
{
\publ_specification_pop
}
221 222
% \setupbtxlist[alternative=paragraph,width=auto,distance=\emwidth]
223
% \setupbtxlist[alternative=paragraph,width=auto,distance=\emwidth,margin=2em] % useless
224
% \setupbtxlist[alternative=paragraph,width=fit,distance=\emwidth]
225
% \setupbtxlist[alternative=paragraph,width=fit,distance=\emwidth,margin=2em]
226 227
% here starts the bib stuff
228 229
\installcorenamespace
{
btxdataset
}
230
\installcorenamespace
{
btxrendering
}
231
\installcorenamespace
{
btxregister
}
232
\installcorenamespace
{
btxcommand
}
233
\installcorenamespace
{
btxrenderingdefinition
}
234 235
\installcommandhandler
\??btxdataset
{
btxdataset
}
\??btxdataset
236
\installcommandhandler
\??btxregister
{
btxregister
}
\??btxregister
237
\installcommandhandler
\??btxrendering
{
btxrendering
}
\??btxrendering
238 239
\permanent
\protected
\def
\setbtxparameterset
#
1
#
2
%
240
{
\edef
\currentbtx
241
{
\ifcsname
\??btx
\currentbtxspecification
:
#
1
:
#
2
:
\s!parent
\endcsname
242
\currentbtxspecification
:
%
243
\orelse
\ifempty
\currentbtxspecificationfallback
244
\orelse
\ifcsname
\??btx
\currentbtxspecificationfallback
:
#
1
:
#
2
:
\s!parent
\endcsname
245
\currentbtxspecificationfallback
:
%
246
\fi
#
1
:
#
2
}
}
247 248
\permanent
\protected
\def
\setbtxparametersetroot
#
1
%
249
{
\edef
\currentbtx
250
{
\ifcsname
\??btx
\currentbtxspecification
:
#
1
:
\s!parent
\endcsname
251
\currentbtxspecification
:
#
1
%
252
\orelse
\ifempty
\currentbtxspecificationfallback
253
\orelse
\ifcsname
\??btx
\currentbtxspecificationfallback
:
#
1
:
\s!parent
\endcsname
254
\currentbtxspecificationfallback
:
#
1
%
255
\fi
}
}
256 257
\permanent
\protected
\def
\setbtxrendering
258
{
\edef
\currentbtxrendering
259
{
\ifcsname
\??btx
\currentbtxspecification
:
\s!parent
\endcsname
260
\currentbtxspecification
261
\orelse
\ifempty
\currentbtxspecificationfallback
262
\orelse
\ifcsname
\??btx
\currentbtxspecificationfallback
:
\s!parent
\endcsname
263
\currentbtxspecificationfallback
264
\fi
}
}
265 266
\permanent
\protected
\def
\setbtxlist
% maybe simplify this one, always list=rendering?
267
{
\edef
\currentbtxlist
268
{
\ifcsname
\??btx
\currentbtxrendering
:
\s!parent
\endcsname
269
\currentbtxrendering
270
\orelse
\ifcsname
\??btx
\currentbtxspecification
:
\s!parent
\endcsname
271
\currentbtxspecification
272
\orelse
\ifempty
\currentbtxspecificationfallback
273
\orelse
\ifcsname
\??btx
\currentbtxspecificationfallback
:
\s!parent
\endcsname
274
\currentbtxspecificationfallback
275
\fi
}
%
276
\edef
\currentlist
{
\s!btx
:
\currentbtxlist
}
}
277 278
\tolerant
\permanent
\protected
\def
\usebtxdataset
[
#
1
]
#
*
[
#
2
]
#
*
[
#
3
]
%
279
{
\begingroup
280
\getdummyparameters
[
\c!specification
=
\currentbtxspecification
,
#
3
]
%
281
\ifparameter
#
2
\or
282
\clf_btxusedataset
283
specification
{
\dummyparameter
\c!specification
}
%
284
dataset
{
#
1
}
%
285
filename
{
#
2
}
%
286
\relax
287
\orelse
\ifparameter
#
1
\or
288
\clf_btxusedataset
289
specification
{
\dummyparameter
\c!specification
}
%
290
dataset
{
\v!default
}
%
291
filename
{
#
1
}
%
292
\relax
293
\fi
294
\endgroup
}
295 296
\definebtxdataset
297
[
\v!default
]
298
% [\c!language=] % nothing set so use current
299 300
% \usebtxdataset
301
% [default]
302
% [mybibs.bib]
303 304
%D These can be overloaded in the traditional module so we go \type {\frozen}
305
%D instead of \type {\permanent}.
306 307
\frozen
\let
\stoppublication
\relax
308 309
\frozen
\tolerant
\protected
\def
\startpublication
[
#
1
]
#
*
[
#
2
]
%
310
{
\begingroup
311
\catcode
\commentasciicode
\othercatcode
312
\ifparameters
313
\expandafter
\publ_set_publication_default
314
\or
315
\expandafter
\publ_set_publication_checked
316
\or
317
\expandafter
\publ_set_publication_indeed
318
\fi
{
#
1
}
{
#
2
}
}
319 320
\def
\publ_set_publication_default
#
1
#
2
%
321
{
\publ_set_publication_indeed
\v!default
{
#
1
}
}
322 323
\def
\publ_set_publication_checked
#
1
#
2
%
324
{
\doifelseassignment
{
#
1
}
325
{
\publ_set_publication_indeed
\v!default
{
#
1
}
}
326
{
\publ_set_publication_indeed
{
#
1
}
{
}
}
}
327 328
\def
\publ_set_publication_indeed
#
1
#
2
#
3
\stoppublication
329
{
\clf_btxaddentry
{
#
1
}
{
#
2
}
{
\detokenize
{
#
3
}
}
%
330
\endgroup
331
\ignorespaces
}
332 333
% commands
334 335
\permanent
\protected
\def
\btxcommand
#
1
%
336
{
\ifcsname
\??btxcommand
#
1
\endcsname
337
\expandafter
\publ_command_yes
338
\else
339
\expandafter
\publ_command_nop
340
\fi
{
#
1
}
}
341 342
\newtoks
\t_btx_cmd
343
\newbox
\b_btx_cmd
344 345
\t_btx_cmd
{
\global
\setbox
\b_btx_cmd
\hpack
{
\clf_btxcmdstring
}
}
346 347
\aliased
\let
\btxcmd
\btxcommand
348 349
\def
\publ_command_yes
#
1
%
350
{
\csname
\??btxcommand
#
1
\endcsname
}
351 352
\def
\publ_command_nop
#
1
%
353
{
\ifcsname
#
1
\endcsname
354
\showmessage
\m!publications
{
1
0
}
{
#
1
,
#
1
}
%
355
\gletcsname
\??btxcommand
#
1
\expandafter
\endcsname
\csname
#
1
\endcsname
356
\orelse
\ifcsname
\utfupper
{
#
1
}
\endcsname
357
\showmessage
\m!publications
{
1
0
}
{
#
1
}
{
\utfupper
{
#
1
}
}
%
358
\gletcsname
\??btxcommand
#
1
\expandafter
\endcsname
\csname
\utfupper
{
#
1
}
\endcsname
359
\else
360
\showmessage
\m!publications
{
1
1
}
{
#
1
}
%
361
\setugvalue
{
\??btxcommand
#
1
}
{
\underbar
{
\tttf
#
1
}
}
%
362
\fi
363
\publ_command_yes
{
#
1
}
}
364 365
\permanent
\protected
\def
\definebtxcommand
#
1
% {body} #1..#n{body}
366
{
\setuvalue
{
\??btxcommand
\csstring
#
1
}
}
%
367 368
% access
369 370
\let
\currentbtxtag
\empty
371
\let
\currentbtxdataset
\v!default
372 373
\permanent
\protected
\def
\setbtxentry
[
#
1
]
% or maybe btxsetentry
374
{
\edef
\currentbtxtag
{
\clf_btxsetentry
{
\currentbtxdataset
}
{
#
1
}
}
}
375 376
% \let\btxsetdataset\setbtxdataset
377
% \let\btxsetentry \setbtxentry
378 379
% todo: no need for the currents as we can keep them at the lua end so we will have
380
%
381
% \btxfield : current
382
% \btxspecificfield : dataset,tag,key
383 384
% todo we can pick up the current's at the lua end (implementers)
385 386
%permanent\def\btxfield #1{\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}}
387
%permanent\def\btxdetail #1{\clf_btxdetail {\currentbtxdataset}{\currentbtxtag}{#1}}
388
%permanent\def\btxflush #1{\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}}
389
%permanent\def\btxdirect #1{\clf_btxdirect {\currentbtxdataset}{\currentbtxtag}{#1}}
390
\permanent
\def
\btxfieldname
#
1
{
\clf_btxfieldname
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
391
\permanent
\def
\btxfieldtype
#
1
{
\clf_btxfieldtype
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
392
\permanent
\def
\btxfoundname
#
1
{
\clf_btxfoundname
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
393
\permanent
\def
\btxfoundtype
#
1
{
\clf_btxfoundtype
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
394
\permanent
\def
\btxauthorfield
#
1
{
\clf_btxauthorfield
\currentbtxauthorindex
{
#
1
}
}
395
\permanent
\def
\btxdoifelse
#
1
{
\clf_btxdoifelse
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
396
\permanent
\def
\btxdoif
#
1
{
\clf_btxdoif
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
397
\permanent
\def
\btxdoifnot
#
1
{
\clf_btxdoifnot
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
398 399
\aliased
\let
\btxsetup
\fastsetup
400 401
\permanent
\def
\btxrawfield
#
1
{
\clf_btxfield
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
402 403
\permanent
\def
\btxfield
#
1
{
\dostarttagged
\t!pubfld
{
#
1
}
\clf_btxfield
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
\dostoptagged
}
404
\permanent
\def
\btxdetail
#
1
{
\dostarttagged
\t!pubfld
{
#
1
}
\clf_btxdetail
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
\dostoptagged
}
405
\permanent
\def
\btxflush
#
1
{
\dostarttagged
\t!pubfld
{
#
1
}
\clf_btxflush
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
\dostoptagged
}
406
\permanent
\def
\btxdirect
#
1
{
\dostarttagged
\t!pubfld
{
#
1
}
\clf_btxdirect
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
\dostoptagged
}
407
%permanent\def\btxauthorfield#1{\dostarttagged\t!pubfld{#1}\clf_btxauthorfield \currentbtxauthorindex{#1}\dostoptagged}
408 409
% Also possible but inefficient:
410
%
411
% \permanent\def\btxfield #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxfield {\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
412
% \permanent\def\btxdetail #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxdetail{\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
413
% \permanent\def\btxflush #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxflush {\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
414
% \permanent\def\btxdirect #1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxdirect{\currentbtxdataset}{\currentbtxtag}{#1}\localcontrolled{\dostoptagged}}
415
% %permanent\def\btxauthorfield#1{\localcontrolled{\dostarttagged\t!pubfld{#1}}\clf_btxauthorfield \currentbtxauthorindex{#1}\localcontrolled{\dostoptagged}}
416 417
%D How complex will we go? Can we assume that e.g. an apa style will not be mixed
418
%D with another one? I think this assumption is okay. For manuals we might want to
419
%D mix but we can work around it.
420 421
%D Rendering.
422 423
\permanent
\protected
\def
\btxspace
{
\removeunwantedspaces
\space
}
424
\permanent
\protected
\def
\btxnobreakspace
{
\removeunwantedspaces
\nobreakspace
}
% these two are
425
\permanent
\protected
\def
\btxnbsp
{
\removeunwantedspaces
\nbsp
}
% the same anyway
426
\permanent
\protected
\def
\btxperiod
{
\removeunwantedspaces
.
\space
}
427
\permanent
\protected
\def
\btxcomma
{
\removeunwantedspaces
,
\space
}
428
\permanent
\protected
\def
\btxcommabreak
{
\removeunwantedspaces
,
\hskip
\zeropoint
plus
.
5
\emwidth
\relax
}
429
\permanent
\protected
\def
\btxcolon
{
\removeunwantedspaces
:
\space
}
430
\permanent
\protected
\def
\btxsemicolon
{
\removeunwantedspaces
;
\space
}
431
\permanent
\protected
\def
\btxlparent
{
\removeunwantedspaces
\space
(
}
% obsolete
432
\permanent
\protected
\def
\btxrparent
{
\removeunwantedspaces
)
\space
}
% obsolete
433
\permanent
\protected
\def
\btxleftparenthesis
{
\removeunwantedspaces
\space
(
}
434
\permanent
\protected
\def
\btxrightparenthesis
{
\removeunwantedspaces
)
\space
}
435
\permanent
\protected
\def
\btxrightparenthesisperiod
{
\removeunwantedspaces
)
.
\space
}
436
\permanent
\protected
\def
\btxrightparenthesiscomma
{
\removeunwantedspaces
)
,
\space
}
437
\permanent
\protected
\def
\btxleftbracket
{
\removeunwantedspaces
\space
[
}
438
\permanent
\protected
\def
\btxrightbracket
{
\removeunwantedspaces
]
\space
}
439
\permanent
\protected
\def
\btxrightbracketperiod
{
\removeunwantedspaces
]
.
\space
}
440
\permanent
\protected
\def
\btxrightbracketcomma
{
\removeunwantedspaces
]
,
\space
}
441 442
%D Variables:
443 444
\mutable
\let
\currentbtxbacklink
\empty
\permanent
\protected
\def
\btxsetbacklink
{
\def
\currentbtxbacklink
}
445
\mutable
\let
\currentbtxcategory
\empty
\permanent
\protected
\def
\btxsetcategory
{
\def
\currentbtxcategory
}
446
\mutable
\let
\currentbtxcombis
\empty
\permanent
\protected
\def
\btxsetcombis
{
\def
\currentbtxcombis
}
447
\mutable
\let
\currentbtxdataset
\empty
\permanent
\protected
\def
\btxsetdataset
{
\def
\currentbtxdataset
}
448
\mutable
\let
\currentbtxfirst
\empty
\permanent
\protected
\def
\btxsetfirst
{
\def
\currentbtxfirst
}
449
\mutable
\let
\currentbtxsecond
\empty
\permanent
\protected
\def
\btxsetsecond
{
\def
\currentbtxsecond
}
450
\mutable
\let
\currentbtxsuffix
\empty
\permanent
\protected
\def
\btxsetsuffix
{
\def
\currentbtxsuffix
}
451
\mutable
\let
\currentbtxinternal
\empty
\permanent
\protected
\def
\btxsetinternal
{
\def
\currentbtxinternal
}
452
\mutable
\let
\currentbtxlefttext
\empty
\permanent
\protected
\def
\btxsetlefttext
{
\def
\currentbtxlefttext
}
453
\mutable
\let
\currentbtxrighttext
\empty
\permanent
\protected
\def
\btxsetrighttext
{
\def
\currentbtxrighttext
}
454
\mutable
\let
\currentbtxbefore
\empty
\permanent
\protected
\def
\btxsetbefore
{
\def
\currentbtxbefore
}
455
\mutable
\let
\currentbtxafter
\empty
\permanent
\protected
\def
\btxsetafter
{
\def
\currentbtxafter
}
456
\mutable
\let
\currentbtxlanguage
\empty
\permanent
\protected
\def
\btxsetlanguage
{
\def
\currentbtxlanguage
}
457
\mutable
\let
\currentbtxtag
\empty
\permanent
\protected
\def
\btxsettag
{
\def
\currentbtxtag
}
458
\mutable
\let
\currentbtxnumber
\empty
\permanent
\protected
\def
\btxsetnumber
{
\def
\currentbtxnumber
}
459
\mutable
\let
\currentbtxfirstinternal
\empty
\permanent
\protected
\def
\btxsetfirstinternal
{
\def
\currentbtxfirstinternal
}
460
\mutable
\let
\currentbtxlastinternal
\empty
\permanent
\protected
\def
\btxsetlastinternal
{
\def
\currentbtxlastinternal
}
461 462
\mutable
\let
\currentbtxauthorvariant
\v!normal
\permanent
\protected
\def
\btxsetauthorvariant
{
\def
\currentbtxauthorvariant
}
463
\mutable
\let
\currentbtxfirstnames
\empty
\permanent
\protected
\def
\btxsetfirstnames
{
\let
\currentbtxfirstnames
\currentbtxfirstnames
_
indeed
}
464
\mutable
\let
\currentbtxinitials
\empty
\permanent
\protected
\def
\btxsetinitials
{
\let
\currentbtxinitials
\currentbtxinitials
_
indeed
}
465
\mutable
\let
\currentbtxjuniors
\empty
\permanent
\protected
\def
\btxsetjuniors
{
\let
\currentbtxjuniors
\currentbtxjuniors
_
indeed
}
466
\mutable
\let
\currentbtxsurnames
\empty
\permanent
\protected
\def
\btxsetsurnames
{
\let
\currentbtxsurnames
\currentbtxsurnames
_
indeed
}
467
\mutable
\let
\currentbtxvons
\empty
\permanent
\protected
\def
\btxsetvons
{
\let
\currentbtxvons
\currentbtxvons
_
indeed
}
468 469
\newconstant
\currentbtxoverflow
\permanent
\protected
\def
\btxsetoverflow
#
1
{
\currentbtxoverflow
#
1
\relax
}
470
\newconstant
\currentbtxconcat
\permanent
\protected
\def
\btxsetconcat
#
1
{
\currentbtxconcat
#
1
\relax
}
471
\newconstant
\currentbtxcount
\permanent
\protected
\def
\btxsetcount
#
1
{
\currentbtxcount
#
1
\relax
}
472
\newconstant
\currentbtxauthorindex
%permanent\protected\def\btxsetauthorindex#1{\currentbtxauthorindex#1\relax} % passed directly
473
\newconstant
\currentbtxauthorcount
%permanent\protected\def\btxsetauthorcount#1{\currentbtxauthorcount#1\relax} % passed directly
474
\newconstant
\currentbtxauthorstate
\permanent
\protected
\def
\btxsetauthorstate
#
1
{
\currentbtxauthorstate
#
1
\relax
}
475 476
\protected
\def
\currentbtxfirstnames
_
indeed
{
\clf_btxcurrentfirstnames
\numexpr
\currentbtxauthorindex
\relax
}
477
\protected
\def
\currentbtxinitials
_
indeed
{
\clf_btxcurrentinitials
\numexpr
\currentbtxauthorindex
\relax
}
478
\protected
\def
\currentbtxjuniors
_
indeed
{
\clf_btxcurrentjuniors
\numexpr
\currentbtxauthorindex
\relax
}
479
\protected
\def
\currentbtxsurnames
_
indeed
{
\clf_btxcurrentsurnames
\numexpr
\currentbtxauthorindex
\relax
}
480
\protected
\def
\currentbtxvons
_
indeed
{
\clf_btxcurrentvons
\numexpr
\currentbtxauthorindex
\relax
}
481 482
\mutable
\let
\currentbtxfirstpage
\empty
\permanent
\protected
\def
\btxsetfirstpage
#
1
{
\def
\currentbtxfirstpage
{
\btx_page_number
{
#
1
}
}
}
483
\mutable
\let
\currentbtxlastpage
\empty
\permanent
\protected
\def
\btxsetlastpage
#
1
{
\def
\currentbtxlastpage
{
\btx_page_number
{
#
1
}
}
}
484 485
\mutable
\let
\currentbtxfield
\empty
486
\mutable
\let
\currentbtxfielddoi
\empty
487
\mutable
\let
\currentbtxfieldmonth
\empty
488
\mutable
\let
\currentbtxfieldyear
\empty
489
\mutable
\let
\currentbtxfieldurl
\empty
490
\mutable
\let
\currentbtxcriterium
\empty
491
\mutable
\let
\currentbtxlist
\empty
492
\mutable
\let
\currentbtxlistentry
\empty
493
\mutable
\let
\currentbtxlistindex
\empty
494
\mutable
\let
\currentbtxreference
\empty
495
\mutable
\let
\currentbtxrenderingtitle
\empty
496
\mutable
\let
\currentbtxcitetag
\empty
497 498
\mutable
\def
\currentbtxauthorvariant
{
normal
}
499 500
\protected
\def
\btx_reset_list
% not needed as we're grouped
501
{
\let
\currentbtxcombis
\empty
502
\let
\currentbtxcategory
\empty
503
\let
\currentbtxinternal
\empty
504
\let
\currentbtxlefttext
\empty
505
\let
\currentbtxrighttext
\empty
506
\let
\currentbtxbefore
\empty
507
\let
\currentbtxafter
\empty
508
\let
\currentbtxbacklink
\empty
509
\let
\currentbtxlanguage
\empty
510
\let
\currentbtxsuffix
\empty
511
%\let\currentbtxdataset \empty % will always be set
512
%\let\currentbtxtag \empty % will always be set
513
\let
\currentbtxnumber
\empty
}
514 515
\protected
\def
\btx_reset_cite
% check for less .. not all resets needed when we're grouped (only subcites)
516
{
\let
\currentbtxfirst
\empty
517
\let
\currentbtxsecond
\empty
518
\let
\currentbtxsuffix
\empty
519
\let
\currentbtxinternal
\empty
520
\let
\currentbtxlefttext
\empty
521
\let
\currentbtxrighttext
\empty
522
\let
\currentbtxbefore
\empty
523
\let
\currentbtxafter
\empty
524
\let
\currentbtxbacklink
\empty
525
\let
\currentbtxlanguage
\empty
526
%\let \currentbtxdataset \empty % will always be set, beware of local reset ~
527
%\let \currentbtxtag \empty % will always be set, beware of local reset ~
528
\let
\currentbtxnumber
\empty
529
\setconstant
\currentbtxoverflow
\zerocount
530
\setconstant
\currentbtxconcat
\zerocount
531
\setconstant
\currentbtxcount
\zerocount
}
532 533
\protected
\def
\btx_reset_page
% probably not needed
534
{
\let
\currentbtxfirstpage
\empty
535
\let
\currentbtxlastpage
\empty
536
\let
\currentbtxfirstinternal
\empty
537
\let
\currentbtxlastinternal
\empty
538
\setconstant
\currentbtxoverflow
\zerocount
539
\setconstant
\currentbtxconcat
\zerocount
540
\setconstant
\currentbtxcount
\zerocount
}
541 542
\protected
\def
\btx_reset_numbering
% probably not needed
543
{
\let
\currentbtxfirst
\empty
544
\let
\currentbtxsecond
\empty
545
\let
\currentbtxsuffix
\empty
546
\setconstant
\currentbtxconcat
\zerocount
}
547 548
%D Pages:
549 550
\protected
\def
\btx_page_number
#
1
%
551
{
\def
\currentlistindex
{
#
1
}
%
552
\structurelistpagenumber
}
553 554
%D Language:
555 556
\mutable
\def
\mainbtxlanguage
{
\currentmainlanguage
}
557 558
\protected
\def
\btx_check_language
559
{
\let
\mainbtxlanguage
\currentlanguage
560
\ifempty
\currentbtxlanguage
561
\let
\currentbtxlanguage
\currentlanguage
562
\else
563
\btx_check_language_indeed
564
\fi
}
565 566
\protected
\def
\btx_check_language_indeed
567
{
\edef
\currentbtxlanguage
{
\reallanguagetag
\currentbtxlanguage
}
%
568
\ifempty
\currentbtxlanguage
569
\let
\currentbtxlanguage
\currentlanguage
570
\orelse
\ifx
\currentbtxlanguage
\currentlanguage
\else
571
\setcurrentlanguage
\currentmainlanguage
\currentbtxlanguage
572
\fi
}
573 574
%D Tracing
575 576
\newconditional
\c_btx_trace
% not used yet
577 578
\installtextracker
579
{
btxrendering
}
580
{
\settrue
\c_btx_trace
}
581
{
\setfalse
\c_btx_trace
}
582 583
%D Rendering lists and citations.
584 585
\permanent
\protected
\def
\btxtodo
#
1
{
[
#
1
]
}
586 587
%D Lists:
588 589
\newdimen
\d_publ_number_width
590 591
\ifdefined
\btxblock
\else
\newcount
\btxblock
\fi
\btxblock
\plusone
592
\ifdefined
\btxcitecounter
\else
\newcount
\btxcitecounter
\fi
% maybe pass this to lua
593 594
\newtoks
\everysetupbtxlistplacement
% name will change
595
\newtoks
\everysetupbtxciteplacement
% name will change
596 597
\definelist
% only used for selecting
598
[
\s!btx
]
599 600
\setuplist
601
[
\s!btx
]
602
[
\c!prefixstopper
=
:
,
603
\c!state
=
\v!start
,
604
\c!alternative
=
a
,
605
\c!interaction
=
\v!none
,
606
%\c!alternative=\v!paragraph,
607
%\c!width=\v!auto,
608
%\c!distance=\emwidth,
609
\c!before
=
\blank
,
610
\c!after
=
\blank
]
611 612
\permanent
\tolerant
\protected
\def
\setupbtxlist
[
#
1
]
#
*
[
#
2
]
%
613
{
\ifarguments
\or
614
\setuplist
[
\s!btx
]
[
#
1
]
%
615
\or
616
\setuplist
[
\s!btx
:
#
1
]
[
#
2
]
%
617
\fi
}
618 619
\appendtoks
620
\ifempty
\currentbtxrenderingparent
621
\definelist
622
[
\s!btx
:
\currentbtxrendering
]
%
623
[
\s!btx
]
%
624
\orelse
\ifx
\currentbtxrenderingparent
\s!btx
625
\definelist
626
[
\s!btx
:
\currentbtxrendering
]
%
627
[
\s!btx
]
%
628
\else
629
\definelist
630
[
\s!btx
:
\currentbtxrendering
]
%
631
[
\s!btx
:
\currentbtxrenderingparent
]
%
632
\fi
633
\to
\everydefinebtxrendering
634 635
\newconditional
\c_btx_list_texts
636 637
\appendtoks
638
\doifelse
{
\btxrenderingparameter
\c!textstate
}
\v!start
639
\settrue
\setfalse
\c_btx_list_texts
640
\to
\everysetupbtxlistplacement
641 642
\newconditional
\c_btx_list_pages
643 644
\appendtoks
645
\doifelse
{
\btxrenderingparameter
\c!pagestate
}
\v!start
646
\settrue
\setfalse
\c_btx_list_pages
647
\to
\everysetupbtxlistplacement
648 649
\protected
\def
\btx_entry_inject_pages
% for the moment only normal
650
{
\dontleavehmode
651
\begingroup
652
\setbtxlist
% probably already set
653
\btx_reset_page
654
\setbtxparameterset
\s!list
\s!page
655
\btxparameter
\c!command
656
{
\usebtxstyleandcolor
\c!style
\c!color
657
\btxparameter
\c!left
658
\clf_btxflushpages
{
\currentbtxdataset
}
{
\currentbtxtag
}
%
659
\btxparameter
\c!right
}
%
660
\endgroup
}
661 662
\permanent
\protected
\def
\btxpagesetup
#
1
% there will be no left|right|command|style at this inner level
663
{
\begingroup
664
\publ_fast_setup
\plusfive
\s!list
\s!page
665
\endgroup
666
\btx_reset_page
}
% probably not needed
667 668
\permanent
\protected
\def
\btxnumberingsetup
#
1
%
669
{
\begingroup
670
\dostarttagged
\t!listtag
\empty
671
\setbtxparameterset
{
\c!list
:
\s!numbering
}
\currentbtxnumbering
% brrrr \setbtxlist
672
\btxparameter
\c!left
673
\publ_fast_setup
\plusthree
{
\s!list
:
\s!numbering
}
{
#
1
}
%
674
\btxparameter
\c!right
675
\dostoptagged
676
\endgroup
677
\btx_reset_numbering
}
% probably not needed
678 679
% end of page stuff
680 681
\permanent
\protected
\def
\btxflushlisttext
682
{
\begingroup
683
\usebtxstyleandcolor
\c!style
\c!color
684
\ignorespaces
685
\publ_fast_setup
\plusfour
\s!list
\currentbtxcategory
686
\removeunwantedspaces
687
\endgroup
}
688 689
\permanent
\protected
\def
\btxflushlistcombis
690
{
\begingroup
691
\processcommacommand
[
\currentbtxcombis
]
\btx_entry_inject_combi
% maybe in lua
692
\endgroup
}
693 694
\def
\btx_entry_inject_list_text
695
{
\publ_fast_setup
\plusfour
\s!list
\s!text
}
696 697
\ifdefined
\dotagpublication
\else
\aliased
\let
\dotagpublication
\gobbletwoarguments
\fi
698 699
\protected
\def
\btx_entry_inject
700
{
\begingroup
701
\dostarttagged
\t!publication
\empty
702
\dotagpublication
\currentbtxdataset
\currentbtxtag
703
\redoconvertfont
% see (**) in strc-lst, this will become an configuration option
704
\edef
\currentbtxcategory
{
\btxrawfield
{
category
}
}
%
705
\ignorespaces
706
\ifconditional
\c_btx_list_texts
707
\dostarttagged
\t!listtext
\s!left
708
\currentbtxbefore
709
\dostoptagged
710
\fi
711
%\dostarttagged\t!listcontent\empty
712
\btx_entry_inject_list_text
713
%\dostoptagged
714
\ifconditional
\c_btx_list_pages
715
\dostarttagged
\t!listpage
\empty
716
\btx_entry_inject_pages
717
\dostoptagged
718
\fi
719
\ifconditional
\c_btx_list_texts
720
\dostarttagged
\t!listtext
\s!right
721
\currentbtxafter
722
\dostoptagged
723
\fi
724
\dostoptagged
725
\endgroup
}
726 727
\permanent
\tolerant
\protected
\def
\btxshowentryinline
[
#
1
]
#
*
[
#
2
]
%
728
{
\ifarguments
729
\ctxcommand{
showbtxentry
(
"
\currentbtxdataset
"
,
"
\currentbtxtag
"
)
}
730
\or
731
\ctxcommand{
showbtxentry
(
"
\currentbtxdataset
"
,
"
#1
"
)
}
732
\or
733
\ctxcommand{
showbtxentry
(
"
#1
"
,
"
#2
"
)
}
734
\fi
}
735 736
\permanent
\protected
\def
\btxstartcombientry
737
{
\begingroup
}
738 739
\permanent
\protected
\def
\btxstopcombientry
740
{
\endgroup
}
741 742
\permanent
\protected
\def
\btxhandlecombientry
743
{
\btx_reference_indeed
}
744 745
\def
\btx_entry_inject_combi
#
1
%
746
{
\begingroup
747
\def
\currentbtxtag
{
#
1
}
%
748
\ignorespaces
749
\publ_fast_setup
\plusfour
\s!list
\currentbtxcategory
750
\removeunwantedspaces
751
\endgroup
}
752 753
% uses reference when set
754 755
% \def\btx_entry_inject_combi#1%
756
% {\begingroup
757
% \def\currentbtxtag{#1}%
758
% \ignorespaces
759
% \btxdoifelsecombiinlist\currentbtxdataset\currentbtxtag
760
% {\clf_btxflushlistcombi{\currentbtxdataset}{\currentbtxtag}}
761
% {\publ_fast_setup\plusfour\s!list\currentbtxcategory}%
762
% \removeunwantedspaces
763
% \endgroup}
764 765
\newtoks
\everybtxlistrendering
766 767
\appendtoks
768
\setbtxlist
769
%
770
\edef
\currentbtxcriterium
{
\btxrenderingparameter
\c!criterium
}
% \v!cite will become \s!cite
771
\ifempty
\currentbtxcriterium
772
\let
\currentbtxcriterium
\v!previous
773
\orelse
\ifx
\currentbtxcriterium
\v!cite
774
\let
\currentbtxcriterium
\v!here
775
\fi
776
%
777
\iflocation
778
\letinteractionparameter
\c!style
\empty
779
% \letinteractionparameter\c!color\empty
780
% \letinteractionparameter\c!contrastcolor\empty
781
\fi
782
\to
\everybtxlistrendering
783 784
\mutable
\let
\nofbtxlistentries
\!!zerocount
785
\mutable
\let
\currentbtxlistentry
\!!zerocount
786
\mutable
\let
\currentbtxlistindex
\!!zerocount
% only for internal use (points back to big list)
787 788
\newconditional
\c_publ_prefixed
789 790
\permanent
\protected
\def
\btxsetnoflistentries
#
1
{
\edef
\nofbtxlistentries
{
#
1
}
}
791
\permanent
\protected
\def
\btxsetcurrentlistentry
#
1
{
\edef
\currentbtxlistentry
{
#
1
}
}
792
\permanent
\protected
\def
\btxsetcurrentlistindex
#
1
{
\edef
\currentbtxlistindex
{
#
1
}
}
793 794
\permanent
\protected
\def
\btxdoifelsesameaspreviouschecked
#
1
#
2
% #1 == always | doublesided
795
{
\clf_btxdoifelsesameasprevious
796
{
\currentbtxdataset
}
%
797
\currentbtxlistentry
%
798
{
#
2
}
%
799
\c_btx_list_reference
800
{
#
1
}
}
801 802
\permanent
\protected
\def
\btxdoifelsesameasprevious
803
{
\btxdoifelsesameaspreviouschecked
\v!doublesided
}
804 805
\permanent
\protected
\def
\btxdoifelsecombiinlist
#
1
#
2
%
806
{
\clf_btxdoifelsecombiinlist
{
#
1
}
{
#
2
}
}
807 808
\permanent
\protected
\def
\btxdoifelsecitedone
#
1
#
2
%
809
{
\clf_btxdoifelsecitedone
{
#
1
}
{
#
2
}
}
810 811
\aliased
\let
\btxdoifsameaspreviouscheckedelse
\btxdoifelsesameaspreviouschecked
812
\aliased
\let
\btxdoifsameaspreviouselse
\btxdoifelsesameasprevious
813
\aliased
\let
\btxdoifcombiinlistelse
\btxdoifelsecombiinlist
814
\aliased
\let
\btxdoifcitedoneelse
\btxdoifelsecitedone
815 816
\tolerant
\def
\publ_place_list_indeed
#
1
#
2
#
*
[
#
3
]
#
*
[
#
4
]
%
817
{
\begingroup
818
\ifparameters
\or
\or
819
\let
\currentbtxrendering
\currentbtxspecification
820
\or
821
\ifhastok
=
{
#
3
}
%
822
% [settings]
823
\let
\currentbtxrendering
\currentbtxspecification
824
\setupcurrentbtxrendering
[
#
3
]
%
825
\edef
\p_specification
{
\btxrenderingparameter
\c!specification
}
%
826
\ifempty
\p_specification
\else
827
\let
\currentbtxspecification
\p_specification
828
\let
\currentbtxrendering
\currentbtxspecification
% tricky
829
\fi
830
\else
831
\edef
\currentbtxrendering
{
#
3
}
%
832
\edef
\p_specification
{
\btxrenderingparameter
\c!specification
}
%
833
\ifempty
\p_specification
\else
834
\let
\currentbtxspecification
\p_specification
835
\fi
836
\fi
837
\or
838
% [rendering] [settings]
839
\edef
\currentbtxrendering
{
#
3
}
%
840
\setupcurrentbtxrendering
[
#
4
]
%
841
\edef
\p_specification
{
\btxrenderingparameter
\c!specification
}
%
842
\ifempty
\p_specification
\else
843
\let
\currentbtxspecification
\p_specification
844
\fi
845
\fi
846
\setbtxparameterset
\currentbtxspecification
\s!list
847
\the
\everybtxlistrendering
848
\ifconditional
#
1
\relax
849
\edef
\currentbtxrenderingtitle
{
\btxrenderingparameter
\c!title
}
%
850
\ifempty
\currentbtxrenderingtitle
851
\normalexpanded
{
\startnamedsection
[
\v!chapter
]
[
\c!reference
=
\currentbtxrendering
,
\c!title
=
{
\headtext
{
\currentbtxrendering
}
}
]
}
%
852
\else
853
\normalexpanded
{
\startnamedsection
[
\v!chapter
]
[
\c!reference
=
\currentbtxrendering
,
\c!title
=
{
\currentbtxrenderingtitle
}
]
}
%
854
\fi
855
\fi
856
\ifempty
\currentbtxrendering
857
\setbtxrendering
% hm
858
\fi
859
\edef
\currentbtxdataset
{
\btxrenderingparameter
\c!dataset
}
%
860
\uselanguageparameter
\btxdatasetparameter
% new
861
\setbtxlist
862
\the
\everystructurelist
863
\the
\everysetupbtxlistplacement
864
% why not pass this with collect .. todo
865
% here we just collect items
866
\clf_btxcollectlistentries
867
names
{
\s!btx
}
%
868
criterium
{
\currentbtxcriterium
}
%
869
reference
{
\btxrenderingparameter
\c!reference
}
%
870
method
{
\btxrenderingparameter
\c!method
}
%
871
dataset
{
\currentbtxdataset
}
%
872
keyword
{
\btxrenderingparameter
\c!keyword
}
%
873
sorttype
{
\btxrenderingparameter
\c!sorttype
}
%
874
repeated
{
\btxrenderingparameter
\c!repeat
}
%
875
ignored
{
\btxrenderingparameter
\c!ignore
}
%
876
group
{
\btxrenderingparameter
\c!group
}
%
877
filter
{
\btxrenderingparameter
\c!filter
}
%
878
\relax
879
\ifnum
\nofbtxlistentries
>
\zerocount
880
\forgetall
881
\btxrenderingparameter
\c!before
882
\ifconditional
#
2
\relax
883
\edef
\p_command
{
\btxrenderingparameter
\c!command
}
%
884
\ifempty
\p_command
885
\edef
\p_setups
{
\btxrenderingparameter
\c!setups
}
%
886
\ifempty
\p_setups
887
\else
888
\directsetup
{
\p_setups
}
%
889
\fi
890
\else
891
\expandafter
\p_command
\expandafter
{
\number
\nofbtxlistentries
}
\relax
892
\fi
893
\else
894
\dostarttagged
\t!publications
\currentbtxrendering
895
\dostarttagged
\t!list
{
btx
}
%
896
\startpacked
[
\v!blank
]
%
897
% sorting and so
898
\clf_btxpreparelistentries
{
\currentbtxdataset
}
% could be put in collect
899
% next we analyze the width
900
\ifempty
\currentbtxnumbering
\else
901
\edef
\p_width
{
\listparameter
\c!width
}
%
902
\ifx
\p_width
\v!auto
903
\setbox
\scratchbox
\vbox
\bgroup
904
\settrialtypesetting
905
\clf_btxfetchlistentries
{
\currentbtxdataset
}
%
906
\egroup
907
\d_publ_number_width
\wd
\scratchbox
908
\letlistparameter
\c!width
\d_publ_number_width
909
\fi
910
\fi
911
\doifelse
{
\listparameter
\c!prefix
}
\v!yes
\settrue
\setfalse
\c_publ_prefixed
912
% this actually typesets them, we loop here as otherwise the whole
913
% bunch gets flushed at once
914
\dorecurse
\nofbtxlistentries
915
{
\let
\currentbtxlistentry
\recurselevel
916
\clf_btxflushlistentry
{
\currentbtxdataset
}
\currentbtxlistentry
\relax
}
%
917
\stoppacked
918
\dostoptagged
919
\dostoptagged
920
\fi
921
\btxrenderingparameter
\c!after
922
\fi
923
\ifconditional
#
1
\relax
924
\stopnamedsection
925
\fi
926
\global
\advance
\btxblock
\plusone
927
\endgroup
}
928 929
\permanent
\protected
\def
\placebtxrendering
{
\publ_place_list_indeed
\conditionalfalse
\conditionalfalse
}
930
\permanent
\protected
\def
\completebtxrendering
{
\publ_place_list_indeed
\conditionaltrue
\conditionalfalse
}
931
\permanent
\protected
\def
\flushbtxrendering
{
\publ_place_list_indeed
\conditionalfalse
\conditionaltrue
}
932 933
\aliased
\let
\completelistofpublications
\completebtxrendering
% for old times sake
934
\aliased
\let
\placelistofpublications
\placebtxrendering
% for old times sake
935 936
%D This is somewhat special (for Alan of course):
937
%D
938
%D \starttyping
939
%D % #1 is number of entries
940
%D
941
%D \starttexdefinition mutable protected btx:for:alan:wrapper #1
942
%D \bTABLE
943
%D % we can have a command or setups
944
%D \flushbtxentries[command=\texdefinition{btx:for:alan:content}]
945
%D \eTABLE
946
%D \stoptexdefinition
947
%D
948
%D % #1 is tag
949
%D
950
%D \starttexdefinition mutable protected btx:for:alan:content #1
951
%D \bTR
952
%D \bTD
953
%D \btxsettag{#1}
954
%D \btxfield{name}
955
%D \eTD
956
%D \eTR
957
%D \stoptexdefinition
958
%D
959
%D % we can have a command or setups
960
%D
961
%D \flushbtxrendering [method=dataset,command=\texdefinition{btx:for:alan:wrapper}]
962
%D \stoptyping
963
%D
964
%D Because we want to be ungrouped we use a special loop construct.
965 966
\permanent
\protected
\def
\btxsetlisttag
#
1
%
967
{
\clf_btxflushlisttag
{
\currentbtxdataset
}
#
1
\relax
}
968 969
\newcount
\c_btx_list_index
970 971
\let
\m_btx_list_action
\empty
972 973
\def
\publ_flush_list_step_command
974
{
\btxsetlisttag
{
\c_btx_list_index
}
975
\expandafter
\m_btx_list_action
\expandafter
{
\currentbtxtag
}
%
976
\ifnum
\c_btx_list_index
<
\nofbtxlistentries
977
\advance
\c_btx_list_index
\plusone
978
\expandafter
\publ_flush_list_step_command
979
\else
980
\glet
\m_btx_list_action
\relax
981
\fi
}
982 983
\def
\publ_flush_list_step_setup
984
{
\btxsetlisttag
{
\c_btx_list_index
}
985
\directsetup
{
\m_btx_list_action
}
%
986
\ifnum
\c_btx_list_index
<
\nofbtxlistentries
987
\advance
\c_btx_list_index
\plusone
988
\expandafter
\publ_flush_list_step_setup
989
\else
990
\glet
\m_btx_list_action
\relax
991
\fi
}
992 993
\permanent
\protected
\def
\flushbtxentries
[
#
1
]
%
994
{
\begingroup
995
\getdummyparameters
[
\c!command
=
,
\c!setups
=
,
#
1
]
%
996
\xdef
\m_btx_list_action
{
\dummyparameter
\c!command
}
%
997
\ifempty
\m_btx_list_action
998
\xdef
\m_btx_list_action
{
\dummyparameter
\c!setups
}
%
999
\ifempty
\m_btx_list_action
1000
\endgroup
1001
\c_btx_list_index
\zerocount
1002
\else
1003
\endgroup
1004
\c_btx_list_index
\plusone
1005
\doubleexpandafter
\publ_flush_list_step_command
1006
\fi
1007
\else
1008
\endgroup
1009
\c_btx_list_index
\plusone
1010
\expandafter
\publ_flush_list_step_command
1011
\fi
}
1012 1013
%D So far.
1014 1015
\permanent
\def
\currentbtxblock
{
\number
\btxblock
}
1016 1017
% called at the lua end, for determining the width
1018 1019
\permanent
\protected
\def
\btxchecklistentry
1020
{
\begingroup
1021
% todo, switch to font
1022
\hbox
{
\btx_reference_checked
}
%
1023
\par
1024
\endgroup
}
1025 1026
% called at the lua end, the real rendering
1027 1028
% we could have a yes and no where o nils the btx_reference_indeed ... saves a check there
1029 1030
\installstructurelistprocessor
{
\s!btx
}
1031
{
\let
\currentlistentrynumber
\btx_reference_indeed
1032
\let
\currentlistentrytitle
\btx_entry_indeed
1033
\let
\currentlistentrypagenumber
\btx_page_indeed
1034
\strc_lists_apply_renderingsetup
}
1035 1036
\def
\btx_entry_indeed
1037
{
\dostarttagged
\t!listcontent
\empty
1038
\btx_list_reference_inject
1039
\btx_entry_inject
1040
\dostoptagged
}
1041 1042
\def
\btx_page_indeed
1043
{
}
1044 1045
\permanent
\protected
\def
\btxhandlelistentry
1046
{
\strc_lists_entry_process
}
1047 1048
\permanent
\protected
\def
\btxstartlistentry
% maybe pass i
1049
{
\begingroup
1050
\global
\advance
\c_btx_list_reference
\plusone
}
1051 1052
\permanent
\protected
\def
\btxstoplistentry
1053
{
\iftrialtypesetting
1054
\global
\advance
\c_btx_list_reference
\minusone
1055
\fi
1056
\endgroup
}
1057 1058
\newtoks
\everybtxlistentry
1059 1060
\permanent
\protected
\def
\btxlistsetup
#
1
% used for the reference in the list
1061
{
\the
\everybtxlistentry
1062
\everybtxlistentry
\emptytoks
% so only once per entry to be sure
1063
\publ_fast_setup
\plusfour
\s!list
{
#
1
}
}
1064 1065
\appendtoks
1066
\btx_check_language
1067
\to
\everybtxlistentry
1068 1069
\protected
\def
\btx_reference_indeed
1070
{
\begingroup
1071
% redundant will go away:
1072
\setbtxparameterset
{
\c!list
:
\s!numbering
}
\currentbtxnumbering
1073
%
1074
\ifempty
\currentbtxnumbering
1075
% nothing
1076
\orelse
\ifx
\currentbtxnumbering
\v!no
1077
% nothing
1078
\else
1079
\usebtxstyleandcolor
\c!style
\c!color
% new, needed?
1080
\ifconditional
\c_publ_prefixed
\btxlistprefixednumber
\fi
1081
\clf_btxlistvariant
% some can go
1082
{
\currentbtxdataset
}
%
1083
{
\currentbtxblock
}
%
1084
{
\currentbtxtag
}
%
1085
{
\currentbtxnumbering
}
%
1086
{
\currentbtxnumber
}
%
1087
\relax
1088
\fi
1089
\endgroup
}
1090 1091
\permanent
\protected
\def
\btxlistprefixednumber
% hack but alan needs it
1092
{
\clf_listprefixednumber
1093
{
\currentlist
}
%
1094
\currentbtxlistindex
1095
{
%
1096
prefix
{
\listparameter
\c!prefix
}
%
1097
separatorset
{
\listparameter
\c!prefixseparatorset
}
%
1098
conversionset
{
\listparameter
\c!prefixconversionset
}
%
1099
starter
{
\listparameter
\c!prefixstarter
}
%
1100
stopper
{
\listparameter
\c!prefixstopper
}
%
1101
set
{
\listparameter
\c!prefixset
}
%
1102
segments
{
\listparameter
\c!prefixsegments
}
%
1103
connector
{
\listparameter
\c!prefixconnector
}
%
1104
}
%
1105
\relax
}
1106 1107
\protected
\def
\btx_reference_checked
1108
{
\dontleavehmode
\hbox
\bgroup
% \hpack
1109
\btx_reference_indeed
1110
\egroup
}
1111 1112
\newcount
\c_btx_list_reference
1113 1114
\protected
\def
\btx_list_reference_inject
1115
{
\dontleavehmode
\begingroup
% no box
1116
\iftrialtypesetting
\else
1117
\btx_list_reference_inject_now
1118
\fi
1119
% \btx_reference_indeed % else double entry in list
1120
\endgroup
}
1121 1122
\def
\btx_list_reference_inject_now
1123
{
\strc_references_direct_full_user
1124
{
\ifx
\currentbtxdataset
\v!default
\else
\s!btxset
=
\currentbtxdataset
,
\fi
%
1125
\s!btxref
=
\currentbtxtag
,
%
1126
\s!btxspc
=
\currentbtxspecification
,
%
1127
\s!btxlst
=
\number
\c_btx_list_reference
,
% check if needed
1128
%\ifempty\currentbtxcombis \else\s!btxcom={\currentbtxcombis},\fi%
1129
\ifempty
\currentbtxbefore
\else
\s!btxbtx
=
{
\currentbtxbefore
}
,
\fi
%
1130
\ifempty
\currentbtxafter
\else
\s!btxatx
=
{
\currentbtxafter
}
,
\fi
%
1131
\ifempty
\currentbtxbacklink
\else
\s!btxint
=
\number
\currentbtxbacklink
\fi
1132
}
%
1133
{
\s!btx
:
:
\v!list
:
:
\number
\c_btx_list_reference
}
%
1134
{
\currentbtxnumber
}
}
1135 1136
\newconditional
\c_btx_cite_reference_injected
1137 1138
\permanent
\protected
\def
\btx_cite_reference_inject
1139
{
\ifconditional
\c_btx_cite_reference_injected
\else
1140
\dontleavehmode
1141
\iftrialtypesetting
\else
1142
\ifempty
\currentbtxbacklink
1143
% can be made empty when combining author / year
1144
\orelse
\ifnum
\currentbtxbacklink
>
\zerocount
1145
\btx_cite_reference_inject_indeed
1146
\settrue
\c_btx_cite_reference_injected
1147
\fi
1148
\fi
1149
\fi
}
1150 1151
\newtoks
\t_btx_reference_inject
1152 1153
\def
\btx_cite_reference_inject_indeed
1154
{
\the
\t_btx_reference_inject
1155
\strc_lists_inject_direct
% todo: make like \btx_list_reference_inject_now with { }
1156
[
\s!btx
]
%
1157
[
\c!type
=
\s!btx
]
% \c!location=\v!none
1158
[
\ifx
\currentbtxdataset
\v!default
\else
\s!btxset
=
\currentbtxdataset
,
\fi
%
1159
\s!btxref
=
\currentbtxtag
,
%
1160
%\ifempty\currentbtxcombis \else\s!btxcom={\currentbtxcombis},\fi%
1161
\ifempty
\currentbtxbefore
\else
\s!btxbtx
=
{
\currentbtxbefore
}
,
\fi
%
1162
\ifempty
\currentbtxafter
\else
\s!btxatx
=
{
\currentbtxafter
}
,
\fi
%
1163
\ifempty
\currentbtxbacklink
\else
\s!btxint
=
\number
\currentbtxbacklink
,
\fi
1164
\ifempty
\currentbtxciteuservariables
\else
,
\currentbtxciteuservariables
\fi
]
}
1165 1166
\permanent
\def
\currentbtxuservariable
#
1
{
\clf_btxuservariable
{
\currentbtxdataset
}
{
#
1
}
}
1167
\permanent
\def
\btxdoifelseuservariable
#
1
{
\clf_btxdoifelseuservariable
{
\currentbtxdataset
}
{
#
1
}
}
1168 1169
\aliased
\let
\btxdoifuservariableelse
\btxdoifelseuservariable
1170 1171
\aliased
\let
\btxcitereference
\btx_cite_reference_inject
1172 1173
\mutable
\let
\currentbtxnumbering
\empty
1174
\mutable
\let
\currentbtxcitealternative
\empty
1175 1176
\appendtoks
1177
\edef
\currentbtxnumbering
{
\btxrenderingparameter
\c!numbering
}
%
1178
\ifx
\currentbtxnumbering
\v!yes
1179
\def
\currentbtxnumbering
{
num
}
% convenient alias
1180
\letbtxrenderingparameter
\c!numbering
\currentbtxnumbering
1181
\letlistparameter
\c!headnumber
\v!always
1182
\orelse
\ifx
\currentbtxnumbering
\v!no
1183
\letlistparameter
\c!headnumber
\v!no
1184
\let
\currentbtxnumbering
\empty
1185
% \letlistparameter\c!textcommand\outdented % needed? we can use titlealign
1186
\letlistparameter
\c!symbol
\v!none
1187
\letlistparameter
\c!aligntitle
\v!yes
1188
\letlistparameter
\c!numbercommand
\firstofoneargument
% for the moment, no doubling needed
1189
\else
1190
\letlistparameter
\c!headnumber
\v!always
1191
\fi
1192
\let
\currentlistmethod
\s!btx
1193
\to
\everysetupbtxlistplacement
1194 1195
\permanent
\tolerant
\protected
\def
\btxremapauthor
[
#
1
]
#
*
[
#
2
]
%
1196
{
\clf_btxremapauthor
{
#
1
}
{
#
2
}
}
1197 1198
\permanent
\protected
\def
\btxshowauthorremapping
1199
{
\clf_btxshowauthorremapping
}
1200 1201
\permanent
\protected
\def
\btxflushauthor
1202
{
\doifelsenextoptionalcs
\btx_flush_author_yes
\btx_flush_author_nop
}
1203 1204
\permanent
\protected
\def
\btxflushsuffix
1205
{
\ifempty
\currentbtxsuffix
1206
% nothing
1207
\else
1208
\characters
{
\currentbtxsuffix
}
% todo : rendering specific converter
1209
\fi
}
1210 1211
\def
\btx_flush_author_yes
[
#
1
]
{
\btx_flush_author
{
#
1
}
}
1212
\def
\btx_flush_author_nop
{
\btx_flush_author
{
\btxparameter
\c!authorconversion
}
}
1213 1214
\protected
\def
\btx_flush_author
#
1
#
2
%
1215
{
\begingroup
1216
\edef
\currentbtxfield
{
#
2
}
%
1217
\setbtxparameterset
\s!list
\currentbtxfield
1218
% \let\currentbtxlistvariant\currentbtxfield
1219
\clf_btxauthor
1220
{
\currentbtxdataset
}
%
1221
{
\currentbtxtag
}
%
1222
{
\currentbtxfield
}
%
1223
{
%
1224
combiner
{
#
1
}
%
1225
kind
{
list
}
%
1226
etallimit
{
\btxparameter
\c!etallimit
}
%
1227
etaldisplay
{
\btxparameter
\c!etaldisplay
}
%
1228
etaloption
{
\btxparameter
\c!etaloption
}
%
1229
symbol
{
\btxparameter
{
\c!stopper
:
initials
}
}
%
1230
connector
{
\btxparameter
{
\c!connector
:
initials
}
}
%
1231
}
%
1232
\relax
1233
\endgroup
}
1234 1235
% yes or no: maybe just \flushauthor{...}{...}
1236 1237
\permanent
\protected
\def
\btxflushauthorname
{
\btx_flush_author
{
name
}
}
% #1
1238
\permanent
\protected
\def
\btxflushauthornormal
{
\btx_flush_author
{
normal
}
}
% #1
1239
\permanent
\protected
\def
\btxflushauthornormalshort
{
\btx_flush_author
{
normalshort
}
}
% #1
1240
\permanent
\protected
\def
\btxflushauthorinverted
{
\btx_flush_author
{
inverted
}
}
% #1
1241
\permanent
\protected
\def
\btxflushauthorinvertedshort
{
\btx_flush_author
{
invertedshort
}
}
% #1
1242 1243
\mutable
\let
\currentbtxauthorfield
\s!author
1244 1245
\permanent
\protected
\def
\btxsetauthorfield
#
1
{
\edef
\currentbtxauthorfield
{
#
1
}
}
1246 1247
\permanent
\protected
\def
\currentbtxciteauthorbyfield
1248
{
\begingroup
1249
%\setbtxparameterset\s!cite\s!author
1250
% the alternatives inherit from cite:author
1251
% and APA distinguishes authoryears from authoryear ("and" vs. "&")
1252
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1253
\clf_btxauthor
1254
{
\currentbtxdataset
}
%
1255
{
\currentbtxtag
}
%
1256
{
\currentbtxauthorfield
}
%
1257
{
%
1258
combiner
{
\btxparameter
\c!authorconversion
}
%
1259
kind
{
cite
}
%
1260
etallimit
{
\btxparameter
\c!etallimit
}
%
1261
etaldisplay
{
\btxparameter
\c!etaldisplay
}
%
1262
etaloption
{
\btxparameter
\c!etaloption
}
%
1263
symbol
{
\btxparameter
{
\c!stopper
:
initials
}
}
%
1264
}
%
1265
\relax
1266
\endgroup
}
1267 1268
\permanent
\protected
\def
\currentbtxciteauthor
1269
{
\let
\currentbtxauthorfield
\s!author
1270
\currentbtxciteauthorbyfield
}
% always author
1271 1272
\permanent
\protected
\def
\btxstartauthor
#
1
#
2
#
3
% a state > 0 signals that some authors can clash
1273
{
\begingroup
1274
\currentbtxauthorindex
#
1
\relax
1275
\currentbtxauthorcount
#
2
\relax
1276
\currentbtxauthorstate
#
3
\relax
}
1277 1278
\permanent
\protected
\def
\btxstopauthor
1279
{
\endgroup
}
1280 1281
\permanent
\protected
\def
\btxciteauthorsetup
#
1
{
\fastsetup
{
\s!btx
:
\s!cite
:
\s!author
:
#
1
}
}
1282
\permanent
\protected
\def
\btxlistauthorsetup
#
1
{
\fastsetup
{
\s!btx
:
\s!list
:
\s!author
:
#
1
}
}
1283 1284
% \btxflushauthor{author}
1285
% \btxflushauthor{editor}
1286
%
1287
% \btxflushauthor[name]{author}
1288
% \btxflushauthor[normal]{author}
1289
% \btxflushauthor[normalshort]{author}
1290
% \btxflushauthor[inverted]{author}
1291
% \btxflushauthor[invertedshort]{author}
1292 1293
% \btxflushauthor{author}
1294
% \btxflushauthor{editor}
1295 1296
% Interaction
1297
%
1298
% Because we have more complex entries in lists we don't use the normal list
1299
% interaction features.
1300 1301
\newconditional
\btxinteractive
1302
\newconditional
\btxinteractivenumber
1303
\newconditional
\btxinteractivetext
1304
\newconditional
\btxinteractivepage
1305 1306
\mutable
\let
\currentbtxinteraction
\empty
1307 1308
\installcorenamespace
{
btxinteraction
}
1309 1310
\defcsname
\??btxinteraction
\v!number
\endcsname
{
\settrue
\btxinteractivenumber
}
1311
\defcsname
\??btxinteraction
\v!text
\endcsname
{
\settrue
\btxinteractivetext
}
1312
\defcsname
\??btxinteraction
\v!page
\endcsname
{
\settrue
\btxinteractivepage
}
1313
\defcsname
\??btxinteraction
\v!all
\endcsname
{
\settrue
\btxinteractivenumber
1314
\settrue
\btxinteractivetext
1315
\settrue
\btxinteractivepage
}
1316 1317
% \setupbtx[interaction=page] % or text or number or all
1318
% \setupbtxrendering[pagestate=start]
1319 1320
\appendtoks
1321
\iflocation
1322
\edef
\currentbtxinteraction
{
\btxparameter
\c!interaction
}
%
1323
\ifx
\currentbtxinteraction
\v!stop
1324
\setfalse
\btxinteractive
1325
\else
1326
\enforced
\let
\structurelistlocation
\empty
1327
\settrue
\btxinteractive
1328
\begincsname
\??btxinteraction
\currentbtxinteraction
\endcsname
1329
\fi
1330
\else
1331
\setfalse
\btxinteractive
1332
\fi
1333
\to
\everysetupbtxlistplacement
1334 1335
\appendtoks
1336
\iflocation
1337
\edef
\currentbtxinteraction
{
\btxparameter
\c!interaction
}
%
1338
\ifx
\currentbtxinteraction
\v!stop
1339
\setfalse
\btxinteractive
1340
\else
1341
\settrue
\btxinteractive
1342
\fi
1343
\else
1344
\setfalse
\btxinteractive
1345
\fi
1346
\to
\everysetupbtxciteplacement
1347 1348
%D When a publication is cited, we need to signal that somehow. This is done with the
1349
%D following (not user) command. We could tag without injecting a node but this way
1350
%D we also store the location, which makes it possible to ask local lists.
1351 1352
%D \macros{cite,nocite,citation,nocitation,usecitation}
1353
%D
1354
%D The inline \type {\cite} command creates a (often) short reference to a publication
1355
%D and for historic reasons uses a strict test for brackets. This means, at least
1356
%D in the default case that spaces are ignored in the argument scanner. The \type
1357
%D {\citation} commands is more liberal but also gobbles following spaces. Both
1358
%D commands insert a reference as well as a visual clue.
1359
%D
1360
%D The \type {no} commands all do the same (they are synonyms): they make sure that
1361
%D a reference is injected but show nothing. However, they do create a node so best
1362
%D attach them to some text in order to avoid spacing interferences. A slightly
1363
%D less efficient alternative is \type {\cite[none][tag]}.
1364 1365
% [tags]
1366
% [settings|variant][tags]
1367
% [base::tags]
1368
% [settings|variant][base::tags]
1369 1370
% these need to be sort of protected:
1371 1372
% methods:
1373
%
1374
% hidden : mark for list, don't show in text
1375
% list : mark for list, show in text only when in list
1376
% text : not to list, show in text
1377
% always : mark for list, show in text
1378 1379
\let
\p_publ_cite_before
\empty
1380
\let
\p_publ_cite_after
\empty
1381
\let
\p_publ_cite_lefttext
\empty
1382
\let
\p_publ_cite_righttext
\empty
1383 1384
\mutable
\let
\currentbtxciteuservariables
\empty
1385
\mutable
\let
\currentbtxcitealternative
\empty
1386 1387
\permanent
\protected
\def
\btxhybridcite
% so one can alias the old
1388
{
\dontleavehmode
1389
\begingroup
1390
\strictdoifelsenextoptional
\publ_cite_tags_options
\publ_cite_tags_indeed
}
1391 1392
\protected
\def
\publ_cite_tags_options
[
#
1
]
%
1393
{
\strictdoifelsenextoptional
{
\publ_cite_tags_options_indeed
{
#
1
}
}
{
\publ_cite_tags_indeed
{
#
1
}
}
}
1394 1395
\protected
\def
\publ_cite_tags_indeed
#
1
%
1396
{
\letinteractionparameter
\c!style
\empty
1397
\setbtxparametersetroot
\s!cite
% we need to get the default
1398
\edef
\currentbtxcitealternative
{
\btxparameter
\c!alternative
}
%
1399
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1400
\edef
\currentbtxcitetag
{
#
1
}
%
1401
\the
\everysetupbtxciteplacement
1402
\publ_cite_variant
1403
\endgroup
}
1404 1405
\protected
\def
\publ_cite_tags_options_indeed
#
1
%
1406
{
\doifelseassignment
{
#
1
}
\publ_cite_tags_settings_indeed
\publ_cite_tags_variants_indeed
{
#
1
}
}
1407 1408
\def
\publ_cite_tags_settings_indeed
#
1
[
#
2
]
%
1409
{
\letinteractionparameter
\c!style
\empty
1410
%\letinteractionparameter\c!color\empty
1411
\letdummyparameter
\c!reference
\empty
1412
\letdummyparameter
\c!alternative
\empty
1413
\letdummyparameter
\c!before
\empty
1414
\letdummyparameter
\c!after
\empty
1415
\letdummyparameter
\c!lefttext
\empty
1416
\letdummyparameter
\c!righttext
\empty
1417
\getdummyparameters
[
#
1
]
%
1418
\edef
\p_reference
{
\dummyparameter
\c!reference
}
%
1419
\ifempty
\p_reference
1420
\edef
\currentbtxcitetag
{
#
2
}
%
1421
\else
1422
\let
\currentbtxcitetag
\p_reference
1423
\edef
\currentbtxciteuservariables
{
#
2
}
%
1424
\fi
1425
\edef
\p_specification
{
\dummyparameter
\c!specification
}
%
1426
\ifempty
\p_specification
1427
\else
1428
\let
\currentbtxspecification
\p_specification
1429
\fi
1430
\edef
\p_alternative
{
\dummyparameter
\c!alternative
}
%
1431
\ifempty
\p_alternative
1432
\setbtxparametersetroot
\s!cite
1433
\edef
\currentbtxcitealternative
{
\btxparameter
\c!alternative
}
%
1434
\else
1435
\let
\currentbtxcitealternative
\p_alternative
1436
\fi
1437
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1438
\setupcurrentbtx
[
#
1
]
%
1439
%
1440
\edef
\p_publ_cite_before
{
\dummyparameter
\c!before
}
%
1441
\edef
\p_publ_cite_after
{
\dummyparameter
\c!after
}
%
1442
\edef
\p_publ_cite_lefttext
{
\dummyparameter
\c!lefttext
}
%
1443
\edef
\p_publ_cite_righttext
{
\dummyparameter
\c!righttext
}
%
1444
%
1445
\the
\everysetupbtxciteplacement
1446
\publ_cite_variant
1447
\endgroup
}
1448 1449
\def
\publ_cite_tags_variants_indeed
#
1
[
#
2
]
%
1450
{
\letinteractionparameter
\c!style
\empty
1451
\edef
\currentbtxcitealternative
{
#
1
}
%
1452
\edef
\currentbtxcitetag
{
#
2
}
%
1453
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1454
\the
\everysetupbtxciteplacement
1455
\publ_cite_variant
1456
\endgroup
}
1457 1458
\newconditional
\btxcitecompress
1459 1460
\mutable
\let
\currentbtxcitemethod
\v!hidden
1461 1462
\def
\publ_cite_variant
1463
{
\begingroup
1464
\publ_cite_handle_variant_indeed
[
\currentbtxcitetag
]
}
1465 1466
\protected
\def
\publ_cite_handle_variant
#
1
%
1467
{
\begingroup
1468
\edef
\currentbtxcitealternative
{
#
1
}
%
1469
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1470
\the
\everysetupbtxciteplacement
1471
\publ_cite_handle_variant_indeed
}
1472 1473
\permanent
\protected
\def
\publ_cite_handle_variant_blob
1474
{
\clf_btxhandlecite
1475
dataset
{
\currentbtxdataset
}
%
1476
reference
{
\currentbtxreference
}
%
1477
method
{
\currentbtxcitemethod
}
%
1478
variant
{
\currentbtxcitealternative
}
%
1479
sorttype
{
\btxparameter
\c!sorttype
}
%
1480
compress
{
\btxparameter
\c!compress
}
%
1481
author
{
\btxparameter
\c!author
}
%
1482
authorconversion
{
\c!authorconversion
}
%
1483
lefttext
{
\p_publ_cite_lefttext
}
%
1484
righttext
{
\p_publ_cite_righttext
}
%
1485
before
{
\p_publ_cite_before
}
%
1486
after
{
\p_publ_cite_after
}
%
1487
\relax
1488
\iftrialtypesetting
\else
1489
%\clf_btxflushmarked
1490
\fi
}
1491 1492
\aliased
\let
\dobtxcitevariantblob
\publ_cite_handle_variant_blob
% command can use it via lua
1493 1494
\tolerant
\def
\publ_cite_handle_variant_indeed
[
#
1
]
%
1495
{
\letbtxparameter
\c!alternative
\currentbtxcitealternative
1496
\edef
\currentbtxreference
{
#
1
}
%
1497
\saverunningstyleandcolor
1498
\usebtxstyleandcolor
\c!style
\c!color
1499
\uselanguageparameter
\btxdatasetparameter
% new
1500
\btxparameter
\c!left
1501
\btxparameter
\c!command
{
\dobtxcitevariantblob
}
% {\publ_cite_handle_variant_blob}%
1502
\btxparameter
\c!right
1503
\endgroup
}
1504 1505
\permanent
\protected
\def
\btxlistcitation
{
\publ_citation
\v!list
}
1506
\permanent
\protected
\def
\btxtextcitation
{
\publ_citation
\v!text
}
1507
\permanent
\protected
\def
\btxalwayscitation
{
\publ_citation
\v!always
}
1508 1509
\tolerant
\def
\publ_citation
#
1
[
#
2
]
#
,
[
#
3
]
% could be made more efficient but not now
1510
{
\dontleavehmode
1511
\begingroup
1512
\let
\currentbtxcitemethod
#
1
%
1513
\ifparameter
#
3
\or
1514
\publ_cite_tags_options_indeed
{
#
2
}
[
#
3
]
%
1515
\else
1516
\publ_cite_tags_indeed
{
#
2
}
%
1517
\fi
}
1518 1519
\permanent
\tolerant
\protected
\def
\btxhiddencitation
[
#
1
]
%
1520
{
\iftrialtypesetting
\else
1521
\begingroup
1522
\let
\currentbtxcitemethod
\v!hidden
1523
\edef
\currentbtxreference
{
#
1
}
%
1524
\clf_btxhandlenocite
1525
method
{
\currentbtxcitemethod
}
%
1526
dataset
{
\currentbtxdataset
}
%
1527
reference
{
\currentbtxreference
}
%
1528
\relax
1529
%\clf_btxflushmarked
1530
\endgroup
1531
\fi
}
1532 1533
\permanent
\protected
\def
\btxmissing
#
1
%
1534
{
\dontleavehmode
{
\tttf
<
#
1
>
}
}
1535 1536
%D Compatibility:
1537 1538
\aliased
\let
\hiddencitation
\btxhiddencitation
\aliased
\let
\hiddencite
\hiddencitation
1539
\aliased
\let
\listcitation
\btxlistcitation
\aliased
\let
\listcite
\listcitation
1540
\aliased
\let
\textcitation
\btxtextcitation
\aliased
\let
\textcite
\textcitation
1541
\aliased
\let
\alwayscitation
\btxalwayscitation
\aliased
\let
\alwayscite
\alwayscitation
1542 1543
\permanent
\protected
\def
\citation
{
\doifelsenextoptionalcs
\btxlistcitation
\btxdirectlistcite
}
1544
\permanent
\protected
\def
\nocitation
{
\doifelsenextoptionalcs
\btxhiddencitation
\btxdirecthiddencite
}
1545 1546
\aliased
\let
\cite
\citation
1547
\aliased
\let
\nocite
\nocitation
1548
\aliased
\let
\usecitation
\nocitation
1549 1550
\protected
\def
\publ_entry_citation
{
\doifelsenextoptionalcs
\btxlistcitation
\btxdirectlistcite
}
1551
\protected
\def
\publ_entry_nocitation
{
\doifelsenextoptionalcs
\btxhiddencitation
\btxdirecthiddencite
}
1552 1553
\appendtoks
1554
\enforced
\let
\cite
\publ_entry_citation
1555
\enforced
\let
\nocite
\publ_entry_nocitation
1556
\to
\everybtxlistrendering
1557 1558
\permanent
\protected
\def
\btxdirectlistcite
#
1
{
\btxlistcitation
[
#
1
]
\relax
}
% no optional arguments
1559
\permanent
\protected
\def
\btxdirecthiddencite
#
1
{
\btxhiddencitation
[
#
1
]
\relax
}
% no optional arguments
1560 1561
%D Setup helpers, beware, we need to wrap this .. now we need to know
1562
%D how setups are implemented.
1563 1564
\defcsname
\??setup
:
\s!btx
:
\s!unknown
\endcsname
#
1
{
\inframed
{
\tttf
#
1
}
}
1565 1566
\def
\publ_fast_setup_yes
#
1
#
2
%
1567
{
\csname
\??setup
:
\s!btx
:
%
1568
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
#
2
\endcsname
1569
\currentbtxspecification
:
#
1
:
#
2
%
1570
\orelse
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecificationfallback
:
#
1
:
#
2
\endcsname
1571
\currentbtxspecificationfallback
:
#
1
:
#
2
%
1572
\orelse
\ifcsname
\??setup
:
\s!btx
:
#
1
:
#
2
\endcsname
1573
#
1
:
#
2
%
1574
\orelse
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
\s!unknown
\endcsname
1575
\currentbtxspecification
:
#
1
:
\s!unknown
1576
\orelse
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecificationfallback
:
#
1
:
\s!unknown
\endcsname
1577
\currentbtxspecificationfallback
:
#
1
:
\s!unknown
1578
\else
1579
#
1
:
\s!unknown
1580
\fi
1581
\endcsname
{
#
2
}
}
1582 1583
\def
\publ_fast_setup_nop
#
1
#
2
%
1584
{
\csname
\??setup
:
\s!btx
:
%
1585
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
#
2
\endcsname
1586
\currentbtxspecification
:
#
1
:
#
2
%
1587
\orelse
\ifcsname
\??setup
:
\s!btx
:
#
1
:
#
2
\endcsname
1588
#
1
:
#
2
%
1589
\orelse
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
\s!unknown
\endcsname
1590
\currentbtxspecification
:
#
1
:
\s!unknown
1591
\else
1592
#
1
:
\s!unknown
1593
\fi
1594
\endcsname
{
#
2
}
}
1595 1596
\newconstant
\btxsetuptype
1597 1598
% 0 = unknown darkred
1599
% 1 = cite darkblue
1600
% 2 = subcite darkgreen
1601
% 3 = numbering darkorange
1602
% 4 = list darkcyan
1603
% 5 = page darkmagenta
1604
% 6 = unknown darkred
1605 1606
\protected
\def
\publ_fast_btx_setup_chain_inbetween
{
\allowbreak
-
>
\allowbreak
}
1607
\protected
\def
\publ_fast_btx_setup_colon_inbetween
{
\allowbreak
:
\allowbreak
}
1608 1609
\protected
\def
\publ_fast_btx_setup_chain_yes
#
1
#
2
%
1610
{
\dontleavehmode
\begingroup
1611
\let
\:
\publ_fast_btx_setup_colon_inbetween
1612
\infofont
1613
\ifcase
\btxsetuptype
\darkred
\or
\darkblue
\or
\darkgreen
\or
\darkcyan
\or
\darkmagenta
\else
\darkred
\fi
1614
[
\prewordbreak
1615
\currentbtxspecification
\:
#
1
\:
#
2
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
#
2
\endcsname
\else
1616
\publ_fast_btx_setup_chain_inbetween
1617
\currentbtxspecificationfallback
\:
#
1
\:
#
2
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecificationfallback
:
#
1
:
#
2
\endcsname
\else
1618
\publ_fast_btx_setup_chain_inbetween
1619
#
1
\:
#
2
\ifcsname
\??setup
:
\s!btx
:
#
1
:
#
2
\endcsname
\else
1620
\publ_fast_btx_setup_chain_inbetween
1621
\currentbtxspecification
\:
#
1
\:
\s!unknown
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
\s!unknown
\endcsname
\else
1622
\publ_fast_btx_setup_chain_inbetween
1623
\currentbtxspecificationfallback
\:
#
1
\:
\s!unknown
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecificationfallback
:
#
1
:
\s!unknown
\endcsname
\else
1624
\publ_fast_btx_setup_chain_inbetween
1625
unset
\fi
\fi
\fi
\fi
\fi
1626
\space
@
\space
1627
\currentbtx
1628
\prewordbreak
]
%
1629
\endgroup
}
1630 1631
\protected
\def
\publ_fast_btx_setup_chain_nop
#
1
#
2
%
1632
{
\dontleavehmode
\begingroup
1633
\let
\:
\publ_fast_btx_setup_colon_inbetween
1634
\infofont
1635
\darkred
1636
[
\prewordbreak
1637
\currentbtxspecification
\:
#
1
\:
#
2
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
#
2
\endcsname
\else
1638
\publ_fast_btx_setup_chain_inbetween
1639
#
1
\:
#
2
\ifcsname
\??setup
:
\s!btx
:
#
1
:
#
2
\endcsname
\else
1640
\publ_fast_btx_setup_chain_inbetween
1641
\currentbtxspecification
\:
#
1
\:
\s!unknown
\ifcsname
\??setup
:
\s!btx
:
\currentbtxspecification
:
#
1
:
\s!unknown
\endcsname
\else
1642
\publ_fast_btx_setup_chain_inbetween
1643
unset
\fi
\fi
\fi
1644
\space
@
\space
1645
\currentbtx
1646
\prewordbreak
]
%
1647
\endgroup
}
1648 1649
\protected
\def
\publ_fast_btx_setup_normal
#
1
%
1650
{
\btxsetuptype
#
1
\relax
1651
\ifempty
\currentbtxspecificationfallback
1652
\expandafter
\publ_fast_setup_nop
1653
\else
1654
\expandafter
\publ_fast_setup_yes
1655
\fi
}
1656 1657
\protected
\def
\publ_fast_btx_setup_visual
#
1
#
2
#
3
%
1658
{
\btxsetuptype
#
1
\relax
1659
\ifempty
\currentbtxspecificationfallback
1660
\expandafter
\publ_fast_btx_setup_chain_nop
1661
\else
1662
\expandafter
\publ_fast_btx_setup_chain_yes
1663
\fi
{
#
2
}
{
#
3
}
%
1664
\ifempty
\currentbtxspecificationfallback
1665
\expandafter
\publ_fast_setup_nop
1666
\else
1667
\expandafter
\publ_fast_setup_yes
1668
\fi
{
#
2
}
{
#
3
}
}
1669 1670
\installtextracker
1671
{
publications
.
setups
}
1672
{
\let
\publ_fast_setup
\publ_fast_btx_setup_visual
}
1673
{
\let
\publ_fast_setup
\publ_fast_btx_setup_normal
}
1674 1675
\let
\publ_fast_setup
\publ_fast_btx_setup_normal
1676 1677
%D Cite helpers:
1678 1679
\newtoks
\everybtxciteentry
1680 1681
\prependtoks
1682
\setfalse
\c_btx_cite_reference_injected
1683
\to
\everybtxciteentry
1684 1685
\permanent
\protected
\def
\btxcitesetup
#
1
%
1686
{
\the
\everybtxciteentry
1687
\everybtxciteentry
\emptytoks
% tricky maybe not when subcites
1688
\publ_fast_setup
\plusone
\s!cite
{
#
1
}
}
% no \btxcitereset as we loose dataset and such
1689 1690
\permanent
\protected
\def
\btxsubcitesetup
#
1
%
1691
{
\the
\everybtxciteentry
1692
\everybtxciteentry
\emptytoks
% tricky maybe not when subcites
1693
\publ_fast_setup
\plustwo
\s!cite
{
#
1
}
}
% no \btxcitereset as we loose dataset and such
1694 1695
\appendtoks
1696
\btx_check_language
1697
\to
\everybtxciteentry
1698 1699
\permanent
\protected
\def
\btxstartsubcite
#
1
%
1700
{
\begingroup
1701
\btx_reset_cite
% todo: limited set
1702
% \saverunningstyleandcolor % let's see when Alan needs it
1703
\def
\currentbtxcitealternative
{
#
1
}
%
1704
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1705
\usebtxstyleandcolor
\c!style
\c!color
1706
\btxparameter
\c!left
1707
\relax
}
1708 1709
\permanent
\protected
\def
\btxstopsubcite
1710
{
\relax
1711
\btxparameter
\c!right
1712
\endgroup
}
1713 1714
\permanent
\protected
\def
\btxstartciterendering
[
#
1
]
%
1715
{
\begingroup
1716
\edef
\currentbtxcitealternative
{
#
1
}
%
1717
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1718
\usebtxstyleandcolor
\c!style
\c!color
1719
\btxparameter
\c!left
1720
\relax
}
1721 1722
\permanent
\protected
\def
\btxstopciterendering
1723
{
\relax
1724
\btxparameter
\c!right
1725
\endgroup
}
1726 1727
\aliased
\let
\btxstartciteauthor
\begingroup
1728
\aliased
\let
\btxstopciteauthor
\endgroup
1729 1730
\permanent
\protected
\def
\btxstartcite
{
\begingroup
\btx_reset_cite
}
1731
\aliased
\let
\btxstopcite
\endgroup
1732 1733
%D Whatever helpers:
1734 1735
\permanent
\protected
\def
\btxsingularplural
#
1
{
\clf_btxsingularorplural
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
1736
\permanent
\protected
\def
\btxoneorrange
#
1
{
\clf_btxoneorrange
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
1737
\permanent
\protected
\def
\btxfirstofrange
#
1
{
\clf_btxfirstofrange
{
\currentbtxdataset
}
{
\currentbtxtag
}
{
#
1
}
}
1738 1739
\aliased
\let
\btxsingularorplural
\btxsingularplural
1740 1741
\stopcontextdefinitioncode
1742 1743
%D Journals
1744 1745
\permanent
\protected
\def
\btxloadjournallist
[
#
1
]
{
\clf_btxloadjournallist
{
#
1
}
}
1746
\permanent
\protected
\def
\btxsavejournallist
[
#
1
]
{
\clf_btxsavejournallist
{
#
1
}
}
1747
\permanent
\protected
\def
\btxaddjournal
[
#
1
]
[
#
2
]
{
\clf_btxaddjournal
{
#
1
}
{
#
2
}
}
1748
\permanent
\def
\btxexpandedjournal
#
1
{
\clf_btxexpandedjournal
{
#
1
}
}
% \protected ?
1749
\permanent
\def
\btxabbreviatedjournal
#
1
{
\clf_btxabbreviatedjournal
{
#
1
}
}
% \protected ?
1750 1751
% \installcorenamespace{btxjournal}
1752
%
1753
% \letvalue{\s!btxjournal\v!long }\btxexpandedjournal
1754
% \letvalue{\s!btxjournal\v!short }\btxabbreviatedjournal
1755
% \letvalue{\s!btxjournal\v!normal}\firstofoneargument
1756
%
1757
% \protected\def\btxcheckedjournal
1758
% {\expandnamespaceparameter\s!btxjournal\btxrenderingparameter\c!journalconversion}
1759 1760
% \btxloadjournallist[list.txt] % Foo Journal of Bars = FBJ \n ....
1761
%
1762
% \btxexpandedjournal[fbj]
1763
% \btxabbreviatedjournal[foo journal of bars]
1764 1765
%D Saving data:
1766 1767
\tolerant
\permanent
\protected
\def
\savebtxdataset
[
#
1
]
#
*
[
#
2
]
#
*
[
#
3
]
1768
{
\ifarguments
1769
% bad news
1770
\or
1771
\ifhastok
=
{
#
1
}
%
1772
\publ_save_dataset_indeed
[
\s!default
]
[
\jobname
-
saved
.
bib
]
[
#
1
]
%
1773
\else
1774
\publ_save_dataset_indeed
[
\s!default
]
[
#
1
]
[
]
%
1775
\fi
1776
\or
1777
\ifhastok
=
{
#
2
}
%
1778
\publ_save_dataset_indeed
[
\s!default
]
[
#
1
]
[
#
2
]
%
1779
\else
1780
\publ_save_dataset_indeed
[
#
1
]
[
#
2
]
[
]
%
1781
\fi
1782
\or
1783
\publ_save_dataset_indeed
[
#
1
]
[
#
2
]
[
#
3
]
%
1784
\fi
}
1785 1786
\protected
\def
\publ_save_dataset_indeed
[
#
1
]
[
#
2
]
[
#
3
]
%
1787
{
\begingroup
1788
\getdummyparameters
1789
[
\c!criterium
=
\v!all
,
%
1790
\c!type
=
,
%
1791
\c!dataset
=
#
1
,
%
1792
\c!file
=
#
2
,
%
1793
#
3
]
% % all or used
1794
\clf_btxsavedataset
1795
dataset
{
\dummyparameter
\c!dataset
}
%
1796
filename
{
\dummyparameter
\c!file
}
%
1797
filetype
{
\dummyparameter
\c!type
}
%
1798
criterium
{
\dummyparameter
\c!criterium
}
%
1799
\relax
1800
\endgroup
}
1801 1802
% \savebtxdataset[default][e:/tmp/foo.bib]
1803
% \savebtxdataset[default][e:/tmp/foo.lua]
1804
% \savebtxdataset[default][e:/tmp/foo.xml]
1805 1806
%D In-text entries:
1807 1808
\permanent
\protected
\def
\placecitation
{
\citation
[
entry
]
}
% [#1]
1809 1810
\permanent
\protected
\def
\btxhandleciteentry
1811
{
\dontleavehmode
1812
\begingroup
1813
\def
\currentbtxcitealternative
{
entry
}
%
1814
\setbtxparameterset
\s!cite
\currentbtxcitealternative
% needs checking
1815
\btxcitereference
1816
\btx_entry_inject
1817
\endgroup
}
1818 1819
%D Registers
1820 1821
% \setupbtxregister
1822
% [\c!state=\v!start,
1823
% \c!dataset=\v!all,
1824
% \c!method=\v!always]
1825 1826
\protected
\def
\publ_registers_set
1827
{
\ifempty
\currentbtxregister
\else
1828
\clf_btxsetregister
1829
specification
{
\currentbtxspecification
}
%
1830
name
{
\currentbtxregister
}
%
1831
state
{
\btxregisterparameter
\c!state
}
%
1832
dataset
{
\btxregisterparameter
\c!dataset
}
%
1833
field
{
\btxregisterparameter
\c!field
}
%
1834
register
{
\btxregisterparameter
\c!register
}
%
1835
method
{
\btxregisterparameter
\c!method
}
%
1836
alternative
{
\btxregisterparameter
\c!alternative
}
%
1837
\relax
1838
\fi
}
1839 1840
\appendtoks
1841
\publ_registers_set
1842
\to
\everydefinebtxregister
1843 1844
\appendtoks
1845
\publ_registers_set
1846
\to
\everysetupbtxregister
1847 1848
\appendtoks
1849
\normalexpanded
{
%
1850
\defineprocessor
1851
[
\s!btx
:
r
:
\currentbtxregister
]
%
1852
[
\c!style
=
\noexpand
\namedbtxregisterparameter
{
\currentbtxregister
}
\noexpand
\c!style
,
1853
\c!color
=
\noexpand
\namedbtxregisterparameter
{
\currentbtxregister
}
\noexpand
\c!color
]
}
%
1854
\to
\everydefinebtxregister
1855 1856
\appendtoks
1857
\clf_btxtoregister
{
\currentbtxdataset
}
{
\currentbtxtag
}
%
1858
\to
\t_btx_reference_inject
1859 1860
\permanent
\protected
\def
\btxindexedauthor
#
1
#
2
#
3
#
4
#
5
#
6
% alternative von last initials first junior
1861
{
\begingroup
1862
\def
\currentbtxcitealternative
{
#
1
}
%
1863
\ifempty
\currentbtxcitealternative
1864
\edef
\currentbtxcitealternative
{
invertedshort
}
% maybe we need some default here too?
1865
\fi
1866
%let\currentbtxlistvariant\currentbtxcitealternative % we inherit
1867
\the
\everysetupbtxciteplacement
1868
\def
\currentbtxvons
{
#
2
}
%
1869
\def
\currentbtxsurnames
{
#
3
}
%
1870
\def
\currentbtxinitials
{
#
4
}
%
1871
\def
\currentbtxfirstnames
{
#
5
}
%
1872
\def
\currentbtxjuniors
{
#
6
}
%
1873
\setbtxparameterset
\s!cite
\currentbtxcitealternative
1874
\fastsetup
{
\s!btx
:
\s!cite
:
\s!author
:
\currentbtxcitealternative
}
%
1875
\endgroup
}
1876 1877
\permanent
\protected
\def
\btxregisterauthor
1878
{
\doifelsenextoptionalcs
\publ_register_author_yes
\publ_register_author_nop
}
1879 1880
\def
\publ_register_author_yes
[
#
1
]
#
2
%
1881
{
\clf_btxauthortoregister
{
#
1
}
{
#
2
}
\relax
}
1882 1883
\def
\publ_register_author_nop
#
1
%
1884
{
\clf_btxauthortoregister
{
\currentbtxdataset
}
{
#
1
}
\relax
}
1885 1886
%D We hook some setters in the definition sets:
1887 1888
% \installdefinitionsetmember \??btx {btxspecification} \??btxcitevariant {btxcitevariant}
1889
% \installdefinitionsetmember \??btx {btxspecification} \??btxlistvariant {btxlistvariant}
1890
% \installdefinitionsetmember \??btx {btxspecification} \??btxlist {btxlist}
1891
% \installdefinitionsetmember \??btx {btxspecification} \??btxrendering {btxrendering}
1892
% \installdefinitionsetmember \??btx {btxspecification} \??btx {btx}
1893 1894
%D And more helpers ... a never ending story these publications:
1895 1896
% \definebtx
1897
% [btx:apa:list:article:title]
1898
% [style=bolditalic,
1899
% command=\WORD]
1900
%
1901
% \btxstartstyle[btx:apa:list:article:title]
1902
% \btxusecommand[btx:apa:list:article:title]{foo}
1903
% \btxstopstyle
1904 1905
\mutable
\let
\m_btx_saved_current
\empty
1906 1907
\permanent
\protected
\def
\btxstartstyle
[
#
1
]
%
1908
{
\begingroup
1909
\let
\m_btx_saved_current
\currentbtx
1910
\def
\currentbtx
{
#
1
}
%
1911
\usebtxstyleparameter
\c!style
1912
\let
\currentbtx
\m_btx_saved_current
}
1913 1914
\permanent
\protected
\def
\btxstartcolor
[
#
1
]
%
1915
{
\begingroup
1916
\let
\m_btx_saved_current
\currentbtx
1917
\def
\currentbtx
{
#
1
}
%
1918
\usebtxcolorparameter
\c!color
1919
\let
\currentbtx
\m_btx_saved_current
}
1920 1921
\permanent
\protected
\def
\btxstartstyleandcolor
[
#
1
]
%
1922
{
\begingroup
1923
\let
\m_btx_saved_current
\currentbtx
1924
\def
\currentbtx
{
#
1
}
%
1925
\usebtxstyleandcolor
\c!style
\c!color
1926
\let
\currentbtx
\m_btx_saved_current
}
1927 1928
\aliased
\let
\btxstopstyle
\endgroup
1929
\aliased
\let
\btxstopcolor
\endgroup
1930
\aliased
\let
\btxstopstyleandcolor
\endgroup
1931 1932
\permanent
\protected
\def
\btxusecommand
[
#
1
]
#
2
% using #2 permits space after []
1933
{
\namedbtxparameter
{
#
1
}
\c!command
{
#
2
}
}
1934 1935
\permanent
\protected
\def
\startbtxrunningstyleandcolor
1936
{
\dontleavehmode
1937
\begingroup
1938
\restorerunningstyleandcolor
}
1939 1940
\permanent
\protected
\def
\stopbtxrunningstyleandcolor
1941
{
\endgroup
}
1942 1943
%D Maybe handy:
1944 1945
\permanent
\protected
\def
\btxdoifelsematches
#
1
#
2
#
3
%
1946
{
\clf_btxdoifelsematches
{
#
1
}
{
#
2
}
{
#
3
}
}
1947 1948
%D Defaults:
1949 1950
\setupbtxrendering
1951
[
\c!interaction
=
\v!start
,
% \v!all
1952
\c!specification
=
\btxparameter
\c!specification
,
1953
\c!dataset
=
\v!default
,
1954
\c!repeat
=
\v!no
,
1955
\c!continue
=
\v!no
,
1956
\c!method
=
\v!global
,
1957
% \c!setups=btx:\btxrenderingparameter\c!alternative:initialize, % not the same usage as cite !
1958
\c!sorttype
=
\v!default
,
1959
\c!criterium
=
\v!text
,
1960
\c!refcommand
=
authoryears
,
% todo
1961
\c!numbering
=
\v!yes
,
1962
%\c!saveinlist=\v!no, % maybe for before/after
1963
\c!pagestate
=
\v!stop
,
1964
\c!textstate
=
\v!start
,
1965
\c!width
=
\v!auto
,
1966
\c!separator
=
{
\removepunctuation
;
\space
}
,
1967
\c!distance
=
1
.
5
\emwidth
]
1968 1969
% Quite some interpunction and labels are the same of at least consistent within
1970
% a standard when citations and list entries are involved. We assume that each
1971
% standard defines its own set but it can fall back on these defaults.
1972 1973
\setupbtx
1974
[
\c!interaction
=
\v!start
,
1975
\c!alternative
=
num
,
% default cite form, normally defined in the cite namespace
1976
\c!inbetween
=
\btxspace
,
1977
% \c!range=\endash, % separator:range?
1978
\c!range
=
\directdiscretionary
\endash
,
1979
\c!compress
=
\v!yes
,
% was no?
1980
\c!authorconversion
=
normal
,
1981
\c!sorttype
=
normal
,
% normal, reverse or none
1982
\c!etallimit
=
3
,
1983
\c!etaldisplay
=
\btxparameter
\c!etallimit
,
1984
\c!otherstext
=
{
\btxspace
et
al
.
}
,
1985
\c!separator
:
firstnames
=
{
\btxspace
}
,
1986
\c!separator
:
juniors
=
{
\btxspace
}
,
1987
\c!separator
:
vons
=
{
\btxspace
}
,
1988
\c!separator
:
initials
=
{
\btxspace
}
,
1989
\c!stopper
:
initials
=
{
.
}
,
1990
%\c!surnamesep={\btxcomma}, % is this used anywhere?
1991
\c!separator
:
invertedinitials
=
{
\btxcomma
}
,
1992
\c!separator
:
invertedfirstnames
=
{
\btxcomma
}
,
1993
\c!separator
:
names
:
2
=
{
\btxcomma
}
,
% separates multiple names
1994
\c!separator
:
names
:
3
=
\btxparameter
{
\c!separator
:
2
}
,
% before last name in a list
1995
\c!separator
:
names
:
4
=
\btxparameter
{
\c!separator
:
2
}
,
% between only two names
1996
\c!separator
:
2
=
{
\btxsemicolon
}
,
% aka pubsep - separates multiple objects
1997
\c!separator
:
3
=
\btxparameter
{
separator
:
2
}
,
% before last object in a list
1998
\c!separator
:
4
=
\btxparameter
{
separator
:
2
}
]
% between only two objects
1999 2000
% Do we want these in the format? Loading them delayed is somewhat messy.
2001 2002
\loadbtxdefinitionfile
[
commands
]
2003
\loadbtxdefinitionfile
[
definitions
]
2004 2005
\loadbtxdefinitionfile
[
cite
]
2006
\loadbtxdefinitionfile
[
list
]
2007
\loadbtxdefinitionfile
[
page
]
2008
\loadbtxdefinitionfile
[
author
]
2009 2010
% we assume that the users sets up the right specification and if not ... well,
2011
% hope for the best that something shows up and consult the manual otherwise
2012 2013
\permanent
\protected
\def
\usebtxdefinitions
[
#
1
]
%
2014
{
\loadbtxdefinitionfile
[
#
1
]
% % for hh
2015
\setupbtx
[
\c!specification
=
#
1
]
}
% for ab
2016 2017
\setupbtx
2018
[
\c!specification
=
\s!default
,
2019
\c!dataset
=
\v!default
,
2020
\c!default
=
\v!default
]
2021 2022
\loadbtxdefinitionfile
2023
[
\s!default
]
2024 2025
%D Delayed loading:
2026 2027
\fetchmodulecommand
\showbtxdatasetfields
\f!publ_tra
2028
\fetchmodulecommand
\showbtxdatasetcompleteness
\f!publ_tra
2029
\fetchmodulecommand
\showbtxdatasetauthors
\f!publ_tra
2030
\fetchmodulecommand
\showbtxhashedauthors
\f!publ_tra
2031
\fetchmodulecommand
\showbtxfields
\f!publ_tra
2032
\fetchmodulecommand
\showbtxtables
\f!publ_tra
2033 2034
%D Some potential crap:
2035
%D
2036
%D Because I consider this bad data management and a weird mix of languages only one
2037
%D accessor is provided.
2038 2039
\permanent
\tolerant
\protected
\def
\btxshortcut
[
#
1
]
#
:
#
2
%
2040
{
\clf_btxshortcut
{
\ifparameter
#
1
\or
#
1
\else
\s!default
\fi
}
{
#
2
}
}
2041 2042
\protect
2043