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