1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Structure Macros Constructions}
15
16\registerctxluafile{strccon}{}
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40\unprotect
41
42
43
44\installcorenamespace{construction}
45
46\installcommandhandler \??construction {construction} \??construction
47
48\let\setupconstructions\setupconstruction
49
50\setupconstructions[
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72 \c!alternative=\v!left,
73 \c!display=\v!yes,
74 \c!width=7\emwidth,
75 \c!distance=\emwidth,
76 \c!stretch=.50,
77 \c!shrink=.25,
78 \c!titledistance=.5\emwidth,
79
80
81 \c!margin=\v!no,
82 \c!before=\blank,
83 \c!inbetween=\blank,
84 \c!after=\blank,
85
86
87
88 \c!expansion=\v!no,
89
90
91]
92
93
94
95
96
97
98
99
100
101
102\installcorenamespace{constructionmain}
103\installcorenamespace{constructionlevel}
104\installcorenamespace{constructionclass}
105
106\let\currentconstructionmain \empty
107\let\currentconstructionlevel \empty
108\let\currentconstructionhandler\empty
109
110\settrue\c_strc_constructions_define_commands
111
112\appendtoks
113 \ifx\currentconstructionparent\empty
114 \letvalue{\??constructionmain\currentconstruction}\currentconstruction
115 \definelist[\currentconstruction]
116 \else
117 \letvalue{\??constructionmain\currentconstruction}\currentconstructionparent
118 \definelist[\currentconstruction][\currentconstructionparent]
119 \fi
120 \setevalue{\??constructionlevel\currentconstruction}{\number\constructionparameter\c!level}
121 \setevalue{\??constructionclass\currentconstruction}{\constructionparameter\s!handler}
122\to \everydefineconstruction
123
124\appendtoks
125 \ifconditional\c_strc_constructions_define_commands
126 \setuevalue{\e!start\currentconstruction}{\strc_constructions_start{\currentconstruction}}
127 \setuevalue{\e!stop \currentconstruction}{\strc_constructions_stop}
128 \fi
129\to \everydefineconstruction
130
131
132
133
134\unexpanded\def\strc_constructions_start#1
135 {\begingroup
136 \strc_constructions_initialize{#1}
137 \dodoubleempty\strc_constructions_start_regular}
138
139\unexpanded\def\strc_constructions_start_regular[#1][#2]
140 {\strc_constructions_register[#2][\c!label={\constructionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#1]
141 \csname\??constructionstarthandler\currentconstructionhandler\endcsname}
142
143\unexpanded\def\strc_constructions_stop
144 {\csname\??constructionstophandler\currentconstructionhandler\endcsname
145 \endgroup}
146
147
148
149
150
151\installcorenamespace{constructioninitializer}
152\installcorenamespace{constructionfinalizer}
153
154\installcorenamespace{constructionmainhandler}
155\installcorenamespace{constructioncommandhandler}
156\installcorenamespace{constructionstarthandler}
157\installcorenamespace{constructionstophandler}
158
159\installcorenamespace{constructiontexthandler}
160\installcorenamespace{constructionnotehandler}
161
162\unexpanded\def\strc_constructions_initialize#1
163 {\edef\currentconstruction{#1}
164 \let\currentconstructionhash\??construction
165 \let\currentconstructionlistentry\!!zerocount
166 \expandafter\let\expandafter\currentconstructionmain \csname\??constructionmain \currentconstruction\endcsname
167 \expandafter\let\expandafter\currentconstructionlevel \csname\??constructionlevel\currentconstruction\endcsname
168 \expandafter\let\expandafter\currentconstructionhandler\csname\??constructionclass\currentconstruction\endcsname
169 \csname\??constructioninitializer\currentconstructionhandler\endcsname}
170
171\unexpanded\def\strc_constructions_finalize
172 {\csname\??constructionfinalizer\currentconstructionhandler\endcsname
173 \strc_constructions_discard}
174
175\newconditional\c_strc_constructions_number_state
176\newconditional\c_strc_constructions_title_state
177
178\unexpanded\setvalue{\??constructioninitializer\v!construction}
179 {\setfalse\c_strc_constructions_number_state
180 \setfalse\c_strc_constructions_title_state}
181
182\unexpanded\setvalue{\??constructionfinalizer\v!construction}
183 {}
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212\newtoks\everyconstruction
213
214\unexpanded\def\currentconstructiontext
215 {\begstrut
216 \csname\??constructiontexthandler\currentconstructionhandler\endcsname
217 \endstrut}
218
219\unexpanded\def\currentconstructionsample
220 {\begstrut
221 \constructionparameter\c!text
222 \p_strc_constructions_sample
223 \endstrut}
224
225\unexpanded\def\wrappedconstruction#1
226 {\begingroup
227 \iftrialtypesetting \else
228 \currentconstructionsynchronize
229 \c_attr_destination\currentconstructionattribute\relax
230 \fi
231 #1
232 \endgroup}
233
234\unexpanded\def\wrappedcurrentconstruction
235 {\begingroup
236 \iftrialtypesetting \else
237 \currentconstructionsynchronize
238 \c_attr_destination\currentconstructionattribute\relax
239 \fi
240 \currentconstructiontext
241 \endgroup}
242
243\unexpanded\setvalue{\??constructionmainhandler\v!construction}#1
244 {\iftrialtypesetting \else
245 \begingroup
246 \currentconstructionsynchronize
247 \c_attr_destination\currentconstructionattribute\relax
248 \signalcharacter
249 \endgroup
250 \fi#1}
251
252\unexpanded\setvalue{\??constructiontexthandler\v!construction}
253 {\begingroup
254 \useconstructionstyleandcolor\c!headstyle\c!headcolor
255 \the\everyconstruction
256 \constructionparameter\c!headcommand
257 {\strut
258 \constructionparameter\c!text
259 \clf_savedlisttitle{\currentconstructionmain}\currentconstructionlistentry\relax}
260 \endgroup}
261
262\unexpanded\def\strc_constructions_stored_start
263 {\begingroup
264 \csname\??constructionstarthandler\currentconstructionhandler\endcsname}
265
266\unexpanded\def\strc_constructions_stored_stop
267 {\csname\??constructionstophandler\currentconstructionhandler\endcsname}
268
269\newconstant\c_strc_constructions_nested_state
270
271\def\resetconstructions
272 {\c_strc_constructions_nested_state\zerocount}
273
274\unexpanded\setvalue{\??constructioncommandhandler\v!construction}
275 {\endgroup}
276
277\let\p_strc_constructions_sample \empty
278\let\p_strc_constructions_align \empty
279\let\p_strc_constructions_indenting \empty
280\let\p_strc_constructions_width \empty
281\let\p_strc_constructions_aligntitle \empty
282\let\p_strc_constructions_renderingsetup\empty
283\let\p_strc_constructions_headalign \empty
284\let\p_strc_constructions_hang \empty
285\let\p_strc_constructions_inbetween \empty
286\let\p_strc_constructions_closesymbol \empty
287\let\p_strc_constructions_distance \empty
288
289\newconditional\c_strc_constructions_distance_none
290
291\def\strc_constructions_set_width_and_distance
292 {\assignwidth
293 \p_strc_constructions_width
294 \constructionsheadwidth
295 {\unhcopy\constructionheadbox}
296 \constructionsheaddistance}
297
298\def\strc_constructions_preroll_head#content
299 {\setbox\constructionheadbox\hbox
300 {\forgetall
301 \dontcomplain
302 \settrialtypesetting
303 \csname\??constructionmainhandler\currentconstructionhandler\endcsname#content}}
304
305\def\strc_constructions_ignore_head
306 {\constructionsheaddistance\zeropoint
307 \constructionsheadwidth \zeropoint
308
309 \settrue\c_strc_constructions_distance_none}
310
311\let\currentconstructionhash\??construction
312
313\unexpanded\setvalue{\??constructionstarthandler\v!construction}
314 {\dostarttaggedchained\t!construction\currentconstruction\currentconstructionhash
315
316 \constructionparameter\c!before
317 \begingroup
318 \edef\currentconstructionalternative{\constructionparameter\c!alternative}
319 \edef\p_strc_constructions_renderingsetup{\constructionalternativeparameter\c!renderingsetup}
320
321 \ifx\p_strc_constructions_renderingsetup\empty
322 \letconstructionparameter\c!alternative\v!left
323 \let\currentconstructionalternative\v!left
324 \edef\p_strc_constructions_renderingsetup{\constructionalternativeparameter\c!renderingsetup}
325 \else
326 \doifnotsetups\p_strc_constructions_renderingsetup
327 {\letconstructionparameter\c!alternative\v!left
328 \let\currentconstructionalternative\v!left
329 \edef\p_strc_constructions_renderingsetup{\constructionalternativeparameter\c!renderingsetup}}
330 \fi
331
332 \doadaptleftskip{\constructionparameter\c!margin}
333 \setlocalhsize
334 \edef\p_strc_constructions_distance{\constructionalternativeparameter\c!distance}
335 \edef\p_strc_constructions_width{\constructionalternativeparameter\c!width}
336 \ifx\p_strc_constructions_distance\v!none
337 \settrue\c_strc_constructions_distance_none
338 \constructionsheaddistance\zeropoint
339 \else
340 \setfalse\c_strc_constructions_distance_none
341 \constructionsheaddistance\p_strc_constructions_distance\relax
342 \ifdim\constructionsheaddistance=\zeropoint
343 \ifx\p_strc_constructions_width\v!broad
344 \constructionsheaddistance\emwidth
345 \else\ifx\p_strc_constructions_width\v!line
346 \constructionsheaddistance\emwidth
347 \fi\fi
348 \fi
349 \fi
350
351
352
353
354
355
356
357
358
359
360
361
362
363 \strc_constructions_preroll_head\currentconstructiontext
364 \ifzeropt\wd\constructionheadbox
365 \strc_constructions_ignore_head
366 \else
367 \edef\p_strc_constructions_sample{\constructionparameter\c!sample}
368 \ifx\p_strc_constructions_sample\empty
369 \strc_constructions_set_width_and_distance
370 \else
371 \strc_constructions_preroll_head\currentconstructionsample
372 \ifzeropt\wd\constructionheadbox
373 \strc_constructions_ignore_head
374 \else
375 \strc_constructions_set_width_and_distance
376 \fi
377 \fi
378 \fi
379
380 \dostarttagged\t!constructiontag\empty
381 \setbox\constructionheadbox\hbox
382 {\forgetall
383 \dontcomplain
384 \ifx\currentconstructionalternative\v!serried
385 \csname\??constructionmainhandler\currentconstructionhandler\endcsname\currentconstructiontext
386 \else
387 \csname\??constructionmainhandler\currentconstructionhandler\endcsname{\boxedconstructionhead\currentconstructiontext}
388 \fi}
389 \edef\p_strc_constructions_aligntitle{\constructionparameter\c!aligntitle}
390 \ifx\p_strc_constructions_aligntitle\v!no
391 \leftconstructionskip \leftskip
392 \rightconstructionskip\rightskip
393 \else
394 \ifcase\c_strc_constructions_nested_state
395 \leftconstructionskip \leftskip
396 \rightconstructionskip\rightskip
397 \fi
398 \fi
399 \edef\p_strc_constructions_align{\constructionparameter\c!align}
400 \ifx\p_strc_constructions_align\empty \else
401 \setupalign[\p_strc_constructions_align]
402 \fi
403 \ifcase\c_strc_constructions_nested_state
404 \c_strc_constructions_nested_state\plusone
405 \or
406 \c_strc_constructions_nested_state\plustwo
407 \fi
408 \strc_constructions_close_symbol_reset
409
410 \edef\p_strc_constructions_headalign{\constructionparameter\c!headalign}
411
412 \directsetup\p_strc_constructions_renderingsetup\relax
413
414 \edef\p_strc_constructions_indenting{\constructionparameter\c!indenting}
415 \ifx\p_strc_constructions_indenting\empty \else
416 \indenting[\p_strc_constructions_indenting]
417 \fi
418
419 \dostoptagged
420 \dostarttagged\t!constructioncontent\empty
421
422 \updateparagraphshapes
423 \ignorespaces}
424
425\unexpanded\setvalue{\??constructionstophandler\v!construction}
426 {\strc_constructions_close_symbol_place
427 \doifnot{\constructionparameter\c!display}\v!no\par
428 \dostoptagged
429 \dostoptagged
430 \endgroup
431 \constructionparameter\c!after
432 \useindentnextparameter\constructionparameter
433 \strc_constructions_finalize
434
435 \dorechecknextindentation}
436
437\unexpanded\def\boxedconstructionhead#1
438 {\doifelse{\constructionalternativeparameter\c!alignbottom}{\v!yes}\vbox\vtop
439 {\hsize\constructionsheadwidth
440 \edef\p_strc_constructions_headalign{\constructionparameter\c!headalign}
441 \ifx\p_strc_constructions_headalign\empty \else
442 \setupalign[\p_strc_constructions_headalign]
443 \fi
444 #1}}
445
446\installcorenamespace{constructionalternative}
447\installcorenamespace{constructionrenderings}
448
449
450
451
452
453\installcommandhandler \??constructionalternative {constructionalternative} \??constructionalternative
454
455\setupconstructionalternative
456 [
457
458 \c!width=\constructionparameter\c!width,
459 \c!distance=\constructionparameter\c!distance,
460 \c!stretch=\constructionparameter\c!stretch,
461 \c!shrink=\constructionparameter\c!shrink]
462
463\defineconstructionalternative
464 [\v!left]
465 [
466
467 \c!renderingsetup=\??constructionrenderings:\v!left]
468
469\defineconstructionalternative
470 [\v!right]
471 [
472
473 \c!renderingsetup=\??constructionrenderings:\v!right]
474
475\defineconstructionalternative
476 [\v!inmargin]
477 [\c!renderingsetup=\??constructionrenderings:\v!inmargin]
478
479\defineconstructionalternative
480 [\v!inleft]
481 [\c!renderingsetup=\??constructionrenderings:\v!inleft]
482
483\defineconstructionalternative
484 [\v!inright]
485 [\c!renderingsetup=\??constructionrenderings:\v!inright]
486
487\defineconstructionalternative
488 [\v!margin]
489 [\c!renderingsetup=\??constructionrenderings:\v!margin]
490
491\defineconstructionalternative
492 [\v!leftmargin]
493 [\c!renderingsetup=\??constructionrenderings:\v!leftmargin]
494
495\defineconstructionalternative
496 [\v!rightmargin]
497 [\c!renderingsetup=\??constructionrenderings:\v!rightmargin]
498
499\defineconstructionalternative
500 [\v!innermargin]
501 [\c!renderingsetup=\??constructionrenderings:\v!innermargin]
502
503\defineconstructionalternative
504 [\v!outermargin]
505 [\c!renderingsetup=\??constructionrenderings:\v!outermargin]
506
507\defineconstructionalternative
508 [\v!serried]
509 [\c!renderingsetup=\??constructionrenderings:\v!serried]
510
511\defineconstructionalternative
512 [\v!hanging]
513 [
514 \c!renderingsetup=\??constructionrenderings:\v!hanging]
515
516\defineconstructionalternative
517 [\v!top]
518 [\c!renderingsetup=\??constructionrenderings:\v!top,
519 \c!width=\localhsize]
520
521\defineconstructionalternative
522 [\v!command]
523 [\c!renderingsetup=\??constructionrenderings:\v!command]
524
525\defineconstructionalternative
526 [\v!empty]
527 [\c!renderingsetup=\??constructionrenderings:\v!empty]
528
529\defineconstructionalternative
530 [\v!label]
531 [\c!renderingsetup=\??constructionrenderings:\v!label,
532 \c!width=]
533
534\newbox \constructionheadbox
535\newskip \leftconstructionskip
536\newskip \rightconstructionskip
537\newdimen \constructionsheadwidth
538\newdimen \constructionsheaddistance
539
540\def\strc_constructions_set_hang_box#1
541 {\setbox\constructionheadbox\vtop
542 {\forgetall
543 \dontcomplain
544 \hsize\constructionsheadwidth\relax
545 \ifx\p_strc_constructions_headalign\empty
546 \setupalign[#1]
547 \else
548 \setupalign[\p_strc_constructions_headalign]
549 \fi
550 \ifconditional\c_strc_constructions_distance_none \else
551 \advance\ifx#1\v!flushleft\rightskip\else\leftskip\fi\constructionsheaddistance
552 \fi
553 \flushconstructionheadbox}
554 \setbox\constructionheadbox\hpack{\box\constructionheadbox}
555 \ht\constructionheadbox\strutht
556 \dp\constructionheadbox\strutdp}
557
558\def\strc_constructions_set_pure_box#1
559 {\setbox\constructionheadbox\vtop
560 {\forgetall
561 \dontcomplain
562 \hsize\constructionsheadwidth\relax
563 \ifx\p_strc_constructions_headalign\empty
564 \setupalign[#1]
565 \else
566 \setupalign[\p_strc_constructions_headalign]
567 \fi
568 \flushconstructionheadbox}
569 \setbox\constructionheadbox\hpack{\box\constructionheadbox}
570 \ht\constructionheadbox\strutht
571 \dp\constructionheadbox\strutdp}
572
573\def\strc_constructions_set_hang#1
574 {\ifx\p_strc_constructions_hang\empty
575
576 \else\ifx\p_strc_constructions_hang\v!fit
577 \scratchdimen\htdp\constructionheadbox
578 \getnoflines\scratchdimen
579 \hangafter\noflines
580 \else\ifx\p_strc_constructions_hang\v!broad
581 \scratchdimen\dimexpr\htdp\constructionheadbox.5\strutht\relax
582 \getnoflines\scratchdimen
583 \hangafter\noflines
584 \else
585 \hangafter\p_strc_constructions_hang
586 \fi\fi\fi
587 \relax
588 \hangindent\ifx#1\v!right\fi\constructionsheadwidth}
589
590
591
592
593\unexpanded\def\flushconstructionheadbox
594 {\ifhbox\constructionheadbox\unhbox\else\box\fi\constructionheadbox}
595
596
597
598
599
600
601
602
603
604\startsetups[\??constructionrenderings:\v!left]
605 \edef\p_strc_constructions_hang{\constructionparameter\c!hang}
606 \doifelsesetups{\??constructionrenderings:\v!left:\p_strc_constructions_hang} {
607 \directsetup{\??constructionrenderings:\v!left:\p_strc_constructions_hang}
608 } {
609 \directsetup{\??constructionrenderings:\v!left:\v!hanging}
610 }
611\stopsetups
612
613\startsetups[\??constructionrenderings:\v!right]
614 \edef\p_strc_constructions_hang{\constructionparameter\c!hang}
615 \doifelsesetups{\??constructionrenderings:\v!right:\p_strc_constructions_hang} {
616 \directsetup{\??constructionrenderings:\v!right:\p_strc_constructions_hang}
617 } {
618 \directsetup{\??constructionrenderings:\v!right:\v!hanging}
619 }
620\stopsetups
621
622\startsetups[\??constructionrenderings:\v!left:\v!none]
623 \let\\\crlf
624 \noindent
625 \strc_constructions_set_pure_box\v!flushleft
626 \leftskip\dimexpr\leftconstructionskip\constructionsheadwidth\constructionsheaddistance\relax
627 \rightskip\rightconstructionskip\relax
628 \llap {
629 \hpack to \leftskip {
630 \hskip\leftconstructionskip
631 \box\constructionheadbox
632 \hss
633 }
634 }
635 \nobreak
636 \useconstructionstyleandcolor\c!style\c!color
637 \ignorespaces
638\stopsetups
639
640\startsetups[\??constructionrenderings:\v!left:0]
641 \directsetup{\??constructionrenderings:\v!left:\v!none}
642\stopsetups
643
644\startsetups[\??constructionrenderings:\v!left:]
645 \directsetup{\??constructionrenderings:\v!left:\v!none}
646\stopsetups
647
648\startsetups[\??constructionrenderings:\v!right:\v!none]
649 \let\\\crlf
650 \noindent
651 \leftskip\leftconstructionskip
652 \rightskip\dimexpr\rightconstructionskip\constructionsheadwidth\relax
653
654 \strc_constructions_set_pure_box\v!flushright
655 \rlap {
656 \hskip\dimexpr\hsize\leftskip\rightskip\relax
657 \copy\constructionheadbox
658 \hskip\rightconstructionskip
659 }
660 \nobreak
661 \advance\rightskip \constructionsheaddistance
662 \useconstructionstyleandcolor\c!style\c!color
663 \ignorespaces
664\stopsetups
665
666\startsetups[\??constructionrenderings:\v!right:0]
667 \directsetup{\??constructionrenderings:\v!right:\v!none}
668\stopsetups
669
670\startsetups[\??constructionrenderings:\v!right:]
671 \directsetup{\??constructionrenderings:\v!right:\v!none}
672\stopsetups
673
674\startsetups[\??constructionrenderings:\v!left:\v!margin]
675 \let\\\crlf
676 \noindent
677 \strc_constructions_set_pure_box\v!flushleft
678 \llap {
679 \hpack to \constructionsheadwidth {
680 \box\constructionheadbox
681 \hss
682 }
683 \hskip\constructionsheaddistance
684 }
685 \useconstructionstyleandcolor\c!style\c!color
686 \ignorespaces
687\stopsetups
688
689\startsetups[\??constructionrenderings:\v!right:\v!margin]
690 \let\\\crlf
691 \noindent
692 \strc_constructions_set_pure_box\v!flushright
693 \rlap {
694 \hskip\constructionsheaddistance
695 \hpack to \constructionsheadwidth {
696 \box\constructionheadbox
697 \hss
698 }
699 }
700 \useconstructionstyleandcolor\c!style\c!color
701 \ignorespaces
702\stopsetups
703
704\startsetups[\??constructionrenderings:\v!left:\v!hanging]
705 \let\\\crlf
706 \dontcomplain
707 \advance\constructionsheadwidth \constructionsheaddistance
708 \strc_constructions_set_hang_box\v!flushleft
709 \strc_constructions_set_hang\v!left
710 \noindent
711 \llap {
712 \tpack to \zeropoint {
713 \box\constructionheadbox
714 }
715 }
716 \nobreak
717 \useconstructionstyleandcolor\c!style\c!color
718 \ignorespaces
719\stopsetups
720
721\startsetups[\??constructionrenderings:\v!right:\v!hanging]
722 \let\\\crlf
723 \dontcomplain
724 \advance\constructionsheadwidth \constructionsheaddistance
725 \strc_constructions_set_hang_box\v!flushright
726 \strc_constructions_set_hang\v!right
727 \noindent
728 \rlap {
729 \hpack to \dimexpr\hsize\leftskip\rightskip\relax {
730 \hss
731 \tpack to \zeropoint {
732 \box\constructionheadbox
733 }
734 }
735 }
736 \nobreak
737 \useconstructionstyleandcolor\c!style\c!color
738 \ignorespaces
739\stopsetups
740
741\startsetups[\??constructionrenderings:\v!top]
742
743 \let\\\space
744 \noindent
745 \copy\constructionheadbox
746 \par
747 \nobreak
748 \edef\p_strc_constructions_inbetween{\constructionparameter\c!inbetween}
749 \ifx\p_strc_constructions_inbetween\empty \else
750 \p_strc_constructions_inbetween
751
752 \directcheckedvspacing\v!samepage
753 \fi
754 \useconstructionstyleandcolor\c!style\c!color
755 \ignorespaces
756\stopsetups
757
758
759
760\startsetups[\??constructionrenderings:\v!margin]
761 \let\\\crlf
762 \noindent
763 \inmargin[\c!scope=\v!local]{\flushconstructionheadbox}
764 \useconstructionstyleandcolor\c!style\c!color
765 \ignorespaces
766\stopsetups
767
768\startsetups[\??constructionrenderings:\v!leftmargin]
769 \let\\\crlf
770 \noindent
771 \inleft[\c!scope=\v!local]{\flushconstructionheadbox}
772 \useconstructionstyleandcolor\c!style\c!color
773 \ignorespaces
774\stopsetups
775
776\startsetups[\??constructionrenderings:\v!rightmargin]
777 \let\\\crlf
778 \noindent
779 \inright[\c!scope=\v!local]{\flushconstructionheadbox}
780 \useconstructionstyleandcolor\c!style\c!color
781 \ignorespaces
782\stopsetups
783
784\startsetups[\??constructionrenderings:\v!innermargin]
785 \let\\\crlf
786 \noindent
787 \ininner[\c!scope=\v!local]{\flushconstructionheadbox}
788 \useconstructionstyleandcolor\c!style\c!color
789 \ignorespaces
790\stopsetups
791
792\startsetups[\??constructionrenderings:\v!outermargin]
793 \let\\\crlf
794 \noindent
795 \inouter[\c!scope=\v!local]{\flushconstructionheadbox}
796 \useconstructionstyleandcolor\c!style\c!color
797 \ignorespaces
798\stopsetups
799
800\startsetups[\??constructionrenderings:\v!inmargin]
801 \directsetup{\??constructionrenderings:\v!margin}
802\stopsetups
803
804\startsetups[\??constructionrenderings:\v!inleft]
805 \directsetup{\??constructionrenderings:\v!leftmargin}
806\stopsetups
807
808\startsetups[\??constructionrenderings:\v!inright]
809 \directsetup{\??constructionrenderings:\v!rightmargin}
810\stopsetups
811
812\startsetups[\??constructionrenderings:\v!serried]
813
814 \edef\p_strc_constructions_width{\constructionparameter\c!width}
815 \doifelsesetups{\??constructionrenderings:\v!serried:\p_strc_constructions_width} {
816 \directsetup{\??constructionrenderings:\v!serried:\p_strc_constructions_width}
817 } {
818 \directsetup{\??constructionrenderings:\v!serried:\v!wide}
819 }
820\stopsetups
821
822\startsetups[\??constructionrenderings:\v!serried:\v!fit]
823 \let\\\crlf
824 \noindent
825 \flushconstructionheadbox
826 \nobreak
827 \hskip\constructionsheaddistance\relax
828 \useconstructionstyleandcolor\c!style\c!color
829 \ignorespaces
830\stopsetups
831
832\startsetups[\??constructionrenderings:\v!serried:\v!broad]
833 \let\\\crlf
834 \noindent
835 \flushconstructionheadbox
836 \ifconditional\c_strc_constructions_distance_none \else
837 \nobreak
838 \hskip\constructionsheaddistance
839 \s!plus \constructionalternativeparameter\c!stretch\constructionsheaddistance
840 \s!minus\constructionalternativeparameter\c!shrink \constructionsheaddistance
841 \relax
842 \fi
843 \useconstructionstyleandcolor\c!style\c!color
844 \ignorespaces
845\stopsetups
846
847\startsetups[\??constructionrenderings:\v!serried:]
848 \directsetup{\??constructionrenderings:\v!serried:\v!broad}
849\stopsetups
850
851\startsetups[\??constructionrenderings:\v!serried:\v!wide]
852 \let\\\crlf
853 \noindent
854 \hbox to \constructionsheadwidth {
855 \flushconstructionheadbox
856 \hss
857 }
858 \nobreak
859 \hskip\constructionsheaddistance\relax
860 \useconstructionstyleandcolor\c!style\c!color
861 \ignorespaces
862\stopsetups
863
864\startsetups[\??constructionrenderings:\v!hanging]
865
866 \let\\\crlf
867 \noindent
868 \advance\leftskip\leftskipadaption\relax
869 \ifdim\leftskipadaption=\zeropoint
870 \leftskipadaption1.5\emwidth\relax
871 \ifnum\c_strc_constructions_nested_state=\plusone
872 \ifdim\leftskip>\zeropoint \relax
873 \leftskipadaption\leftskip
874 \fi
875 \fi
876 \fi
877 \ifnum\c_strc_constructions_nested_state>\zerocount
878 \advance\leftskip\leftskipadaption
879 \fi
880 \hskip\leftskipadaption\relax
881 \ifhbox\constructionheadbox \unhbox\else\box\fi\constructionheadbox
882 \ifconditional\c_strc_constructions_distance_none \else
883
884 \scratchdistance\ifdim\constructionsheaddistance=\zeropoint .75\emwidth\else\constructionsheaddistance\fi
885 \hskip \scratchdistance
886 \s!plus \constructionalternativeparameter\c!stretch\scratchdistance
887 \s!minus\constructionalternativeparameter\c!shrink \scratchdistance
888 \fi
889 \ifhmode
890 \ifx\p_strc_constructions_width\v!line
891 \hfill\break
892 \else
893 \allowbreak
894 \fi
895 \fi
896 \useconstructionstyleandcolor\c!style\c!color
897 \ignorespaces
898\stopsetups
899
900
901
902
903
904\startsetups[\??constructionrenderings:\v!command]
905 \noindent
906 \constructionparameter\c!headcommand{\flushconstructionheadbox}
907 \useconstructionstyleandcolor\c!style\c!color
908 \ignorespaces
909\stopsetups
910
911\startsetups[\??constructionrenderings:\v!empty]
912 \noindent
913 \useconstructionstyleandcolor\c!style\c!color
914 \ignorespaces
915\stopsetups
916
917\startsetups[\??constructionrenderings:\v!label]
918 \dontleavehmode
919 \begingroup
920 \constructionparameter\c!headcommand{\flushconstructionheadbox}
921 \endgroup
922\stopsetups
923
924\ifcase\contextlmtxmode \else
925
926\fi
927
928
929
930
931
932
933
934\defineconstructionalternative
935 [\v!right:\v!bottom]
936 [
937
938 \c!alignbottom=\v!yes,
939 \c!renderingsetup=\??constructionrenderings:\v!right:\v!bottom]
940
941\startsetups[\??constructionrenderings:\v!right:\v!bottom]
942 \let\\\crlf
943 \noindent
944 \leftskip\leftconstructionskip
945 \rightskip\dimexpr\rightconstructionskip\constructionsheadwidth\constructionsheaddistance\relax
946 \parfillskip\zeropoint
947 \strc_constructions_set_pure_box\v!flushright
948 \directparwrapper \relax {
949 \hfilll
950 \rlap
951 {\kern\constructionsheaddistance
952 \copy\constructionheadbox}
953 }
954 \useconstructionstyleandcolor\c!style\c!color
955 \ignorespaces
956\stopsetups
957
958
959
960
961
962
963
964\installcorenamespace{constructionclosesymbol}
965
966\let\placeclosesymbol\donothing
967\let\qed \donothing
968
969\def\strc_constructions_close_symbol_reset
970 {\global\expandafter\settrue\csname\??constructionclosesymbol\currentconstruction\endcsname
971 \let\placeclosesymbol\strc_constructions_close_symbol_place
972 \let\qed \strc_constructions_close_symbol_place}
973
974\unexpanded\def\strc_constructions_close_symbol_place
975 {\ifconditional\csname\??constructionclosesymbol\currentconstruction\endcsname
976 \global\expandafter\setfalse\csname\??constructionclosesymbol\currentconstruction\endcsname
977 \edef\p_strc_constructions_closesymbol{\constructionparameter\c!closesymbol}
978 \ifx\p_strc_constructions_closesymbol\empty \else
979 \constructionparameter\c!closecommand{\p_strc_constructions_closesymbol}
980 \fi
981 \fi}
982
983\newif\ifnoconstructioncaption
984
985
986
987\let\currentconstructionlistentry\!!zerocount
988
989\unexpanded\def\strc_constructions_register
990 {\clf_doifelselisthasentry\numexpr\currentconstructionlistentry\relax
991 \strc_constructions_register_nop
992 \strc_constructions_register_yes}
993
994
995
996\def\strc_constructions_register_nop[#1][#2]
997
998 {}
999
1000\def\strc_constructions_discard
1001 {\iftrialtypesetting
1002
1003 \clf_discardfromlist\currentconstructionlistentry\relax
1004 \fi}
1005
1006\let\currentconstructionlistnumber \!!zerocount
1007\let\currentconstructionsynchronize\relax
1008\let\currentconstructionattribute \attributeunsetvalue
1009
1010\def\strc_constructions_register_yes[#1][#2]
1011 {\begingroup
1012 \setupcurrentconstruction[#2]
1013 \xdef\currentconstructionexpansion {\constructionparameter\c!expansion}
1014 \xdef\currentconstructionxmlsetup {\constructionparameter\c!xmlsetup}
1015 \xdef\currentconstructioncatcodes {\constructionparameter\s!catcodes}
1016 \xdef\currentconstructionlabel {\constructionparameter\c!label}
1017 \xdef\currentconstructionreference {\constructionparameter\c!reference}
1018 \xdef\currentconstructionreferenceprefix{\constructionparameter\c!referenceprefix}
1019
1020 \xdef\currentconstructionincrementnumber{\constructionparameter\c!incrementnumber}
1021
1022 \ifx\currentconstructionexpansion\empty
1023 \glet\currentconstructionexpansion\v!no
1024 \fi
1025
1026 \ifx\currentconstructionreferenceprefix\empty
1027 \glet\currentconstructionreferenceprefix\referenceprefix
1028 \fi
1029 \ifx\currentconstructionexpansion\s!xml
1030 \xmlstartraw
1031 \xdef\currentconstructiontitle {\constructionparameter\c!title}
1032 \xdef\currentconstructionbookmark{\constructionparameter\c!bookmark}
1033 \xdef\currentconstructionmarking {\constructionparameter\c!marking}
1034 \xdef\currentconstructionlist {\constructionparameter\c!list}
1035 \xmlstopraw
1036 \ifx\currentconstructionlist\empty
1037 \glet\currentconstructionlist\currentconstructiontitle
1038 \fi
1039 \glet\currentconstructioncoding\s!xml
1040 \else
1041 \ifx\currentconstructionexpansion\v!yes
1042 \xdef\currentconstructiontitle {\constructionparameter\c!title}
1043 \xdef\currentconstructionbookmark{\constructionparameter\c!bookmark}
1044 \xdef\currentconstructionmarking {\constructionparameter\c!marking}
1045 \xdef\currentconstructionlist {\constructionparameter\c!list}
1046 \else
1047 \xdef\currentconstructiontitle {\detokenizedconstructionparameter\c!title}
1048 \xdef\currentconstructionbookmark{\detokenizedconstructionparameter\c!bookmark}
1049 \xdef\currentconstructionmarking {\detokenizedconstructionparameter\c!marking}
1050 \xdef\currentconstructionlist {\detokenizedconstructionparameter\c!list}
1051 \iflocation \ifx\currentconstructionbookmark\empty
1052 \begingroup
1053 \simplifycommands
1054 \xdef\currentconstructionbookmark{\detokenize\expandafter{\normalexpanded{\constructionparameter\c!title}}}
1055 \endgroup
1056 \fi \fi
1057 \fi
1058 \ifx\currentconstructionlist\empty
1059 \glet\currentconstructionlist\currentconstructiontitle
1060 \fi
1061 \glet\currentconstructioncoding\s!tex
1062 \fi
1063
1064 \ifx\currentconstructiontitle\v!none
1065 \global\noconstructioncaptiontrue\global\noconstructionnumbertrue
1066 \fi
1067
1068 \ifnoconstructioncaption
1069 \endgroup
1070 \let\currentconstructionlistnumber \relax
1071 \let\currentconstructionsynchronize\relax
1072 \let\currentconstructionattribute \relax
1073 \else
1074 \setnextinternalreferences{construction}\currentconstructionmain
1075 \relax
1076 \scratchcounter\clf_addtolist
1077 metadata {
1078 kind {construction}
1079 name {\currentconstructionmain}
1080
1081 catcodes \catcodetable
1082 }
1083 references {
1084 internal \locationcount
1085 order \locationorder
1086 reference {\currentconstructionreference}
1087 prefix {\currentconstructionreferenceprefix}
1088
1089
1090 }
1091 titledata {
1092 label {\detokenize\expandafter{\currentconstructionlabel}}
1093 title {\detokenize\expandafter{\currentconstructiontitle}}
1094 \ifx\currentconstructionbookmark\currentconstructiontitle \else
1095 bookmark {\detokenize\expandafter{\currentconstructionbookmark}}
1096 \fi
1097 \ifx\currentconstructionlist\currentconstructiontitle \else
1098 list {\detokenize\expandafter{\currentconstructionlist}}
1099 \fi
1100 }
1101 \ifconditional\c_strc_constructions_number_state
1102 prefixdata {
1103 prefix {\constructionparameter\c!prefix}
1104 separatorset {\constructionparameter\c!prefixseparatorset}
1105 conversion {\constructionparameter\c!prefixconversion}
1106 conversionset {\constructionparameter\c!prefixconversionset}
1107 set {\constructionparameter\c!prefixset}
1108 segments {\constructionparameter\c!prefixsegments}
1109 connector {\constructionparameter\c!prefixconnector}
1110 }
1111 numberdata {
1112 numbers {\currentconstructionnumber}
1113 separatorset {\constructionparameter\c!numberseparatorset}
1114 conversion {\constructionparameter\c!numberconversion}
1115 conversionset {\constructionparameter\c!numberconversionset}
1116 starter {\constructionparameter\c!numberstarter}
1117 stopper {\constructionparameter\c!numberstopper}
1118 segments {\constructionparameter\c!numbersegments}
1119 }
1120 \or
1121
1122 \fi
1123 userdata {\detokenize{#1}}
1124 \relax
1125
1126 \clf_setinternalreference
1127 prefix {\currentconstructionreferenceprefix}
1128 reference {\currentconstructionreference}
1129 internal \locationcount
1130 view {\interactionparameter\c!focus}
1131 \relax
1132 \normalexpanded{
1133 \endgroup
1134 \edef\noexpand\currentconstructionlistentry {\the\scratchcounter}
1135 \edef\noexpand\currentconstructionattribute {\the\lastdestinationattribute}
1136 \edef\noexpand\currentconstructionsynchronize{\clf_deferredenhancelist\the\scratchcounter}
1137 }
1138 \fi}
1139
1140
1141
1142
1143
1144\def\reinstateconstructionnumberentry#1
1145 {\edef\currentconstructionattribute {\clf_getinternallistreference#1}
1146 \edef\currentconstructionsynchronize{\clf_deferredenhancelist\number#1}}
1147
1148\def\reinstatecachedconstructionnumberentry#1
1149 {\edef\currentconstructionattribute {\clf_getinternalcachedlistreference#1}
1150 \edef\currentconstructionsynchronize{\clf_deferredenhancelist\number#1}}
1151
1152\installstructurelistprocessor{construction}{\usestructurelistprocessor{numbertitle}}
1153
1154
1155
1156\def\currentconstructionnumber{\constructionparameter\s!counter}
1157
1158\unexpanded\def\strc_constructions_next_indeed #get#tag#level{\strc_counters_increment_sub{#get{#tag}\s!counter}{#level}}
1159\unexpanded\def\strc_constructions_reset_indeed#get#tag#level{\strc_counters_reset_sub {#get{#tag}\s!counter}{#level}}
1160
1161\protect \endinput
1162 |