1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Structure Macros Itemgroups}
15
16\unprotect
17
18\newdimension\d_strc_itemgroups_max_width
19\newinteger \c_strc_itemgroups_max_items
20
21\registerctxluafile{strcitm}{autosuffix}
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178\newconditional\c_strc_itemgroups_sub
179\newconditional\c_strc_itemgroups_head
180\newconditional\c_strc_itemgroups_intro
181\newconditional\c_strc_itemgroups_randomize
182\newconditional\c_strc_itemgroups_horizontal
183\newconditional\c_strc_itemgroups_collecting
184\newconditional\c_strc_itemgroups_auto_intro
185\newconditional\c_strc_itemgroups_pack
186\newconditional\c_strc_itemgroups_paragraph
187\newconditional\c_strc_itemgroups_text
188\newconditional\c_strc_itemgroups_no_par
189\newconditional\c_strc_itemgroups_text_saved
190\newconditional\c_strc_itemgroups_first
191\newconditional\c_strc_itemgroups_before
192\newconditional\c_strc_itemgroups_after
193\newconditional\c_strc_itemgroups_nowhite
194\newconditional\c_strc_itemgroups_joined
195\newconditional\c_strc_itemgroups_reverse
196\newconditional\c_strc_itemgroups_continue
197\newconditional\c_strc_itemgroups_fitting
198\newconditional\c_strc_itemgroups_indented_first
199\newconditional\c_strc_itemgroups_inline
200\newconditional\c_strc_itemgroups_columns
201\newconditional\c_strc_itemgroups_concat
202\newconditional\c_strc_itemgroups_txt
203\newconditional\c_strc_itemgroups_extra
204\newconditional\c_strc_itemgroups_repeat
205\newconditional\c_strc_itemgroups_inline_head
206\newconditional\c_strc_itemgroups_symbol
207\newconditional\c_strc_itemgroups_overlay
208
209
210
211
212
213\newconstant \c_strc_itemgroups_spacing_mode \c_strc_itemgroups_spacing_mode\plustwo
214\newconditional\c_strc_itemgroups_auto_concat \c_strc_itemgroups_auto_concat \conditionaltrue
215
216
217
218\newinteger \c_strc_itemgroups_optimize \c_strc_itemgroups_optimize\plusone
219
220\newboundary \c_strc_itemgroups_boundary
221\newbox \b_strc_itemgroups
222
223\newdimension \d_strc_itemgroups_list_width
224\newdimension \d_strc_itemgroups_asked_width
225
226
227
228
229\def\d_strc_itemgroups_max_width_reference{\d_strc_itemgroups_max_width}
230
231\newinteger \c_strc_itemgroups_n_of_items
232\newinteger \c_strc_itemgroups_nesting
233\newinteger \c_strc_itemgroups_column_depth
234
235\def \v_strc_itemgroups_counter {itemgroup:\currentparentitemgroup}
236\lettonothing \m_strc_itemgroups_repeat_start
237\def \v_strc_itemgroups_unknown_symbol {?}
238\lettonothing \m_strc_itemgroups_indenting
239\lettonothing \m_strc_itemgroups_destination
240
241\mutable\let \currentitemlevel \!!zerocount
242\mutable\def \currentnofitems {\the\c_strc_itemgroups_max_items}
243\mutable\def \currentitemindex {\the\c_strc_itemgroups_n_of_items}
244\mutable\def \currentitemnumber {\strc_counters_raw_sub\v_strc_itemgroups_counter\currentitemlevel}
245
246\newtoks \itemgroupcommands
247
248\mutable\def \currentitemgroupsymbol {n}
249\mutable\lettonothing \currentitemgroupconversionset
250\mutable\lettonothing \currentitemgroupsegments
251
252\def\strc_itemgroups_register_status
253 {\clf_registeritemgroup{\currentparentitemgroup}\c_strc_itemgroups_nesting\c_strc_itemgroups_n_of_items\dimexpr\itemgroupparameter\c!maxwidth\relax}
254
255\def\strc_itemgroups_check_n_of_items
256 {\clf_analyzeitemgroup{\currentparentitemgroup}\c_strc_itemgroups_nesting\relax
257 \edef\currentnofitems{\the\c_strc_itemgroups_max_items}}
258
259
260
261\def\strc_itemgroups_insert_reference
262 {\iftrialtypesetting \orelse \ifempty\currentitemreference \else
263 \strc_itemgroups_insert_reference_indeed
264 \fi}
265
266\def\strc_itemgroups_insert_extra_reference
267 {\iftrialtypesetting \orelse \ifempty\currentitemreference \else
268 \normalexpanded{\textreference[\currentitemreference]{\strc_itemgroups_extra_symbol}}
269 \fi}
270
271\def\strc_itemgroups_insert_reference_indeed
272 {
273 \setnextinternalreference
274
275 \strc_references_start_destination_nodes
276
277 \clf_setdestinationattribute
278 {
279 metadata {
280 kind {item}
281 \ifx\currentreferencecoding\s!xml
282 xmlroot {\xmldocument}
283 \fi
284 catcodes \catcodetable
285 }
286 references {
287 internal \locationcount
288
289 view {\interactionparameter\c!focus}
290 prefix {\referenceprefix}
291 reference {\currentitemreference}
292 }
293 prefixdata {
294 prefix {\namedcounterparameter\v_strc_itemgroups_counter\c!prefix}
295 separatorset {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixseparatorset}
296 conversion {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconversion}
297 conversionset {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconversionset}
298 set {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixset}
299 segments {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixsegments}
300
301 connector {\namedcounterparameter\v_strc_itemgroups_counter\c!prefixconnector}
302 }
303 numberdata {
304 numbers {\v_strc_itemgroups_counter}
305 separatorset {\namedcounterparameter\v_strc_itemgroups_counter\c!numberseparatorset}
306
307
308
309 conversionset {fixed::\currentitemgroupconversionset}
310
311
312
313 segments {\namedcounterparameter\v_strc_itemgroups_counter\c!numbersegments}
314 }
315 }
316 \relax
317 \strc_references_stop_destination_nodes
318 \xdef\currentdestinationattribute{\number\lastdestinationattribute}
319
320 \ifnum\lastdestinationattribute>\zerocount
321 \dontleavehmode\hbox attr \destinationattribute\lastdestinationattribute\bgroup
322 \strc_references_flush_destination_nodes
323 \egroup
324 \fi}
325
326
327
328\installcorenamespace{itemgroup}
329\installcorenamespace{itemgroupoption}
330\installcorenamespace{itemgroupsetting}
331\installcorenamespace{itemgroupkeyword}
332\installcorenamespace{itemgroupalign}
333\installcorenamespace{itemgrouplocal}
334\installcorenamespace{itemgroupglobal}
335\installcorenamespace{itemgroupdistance}
336\installcorenamespace{itemgroupstack}
337\installcorenamespace{itemgroupfirst}
338\installcorenamespace{itemgroupstart}
339
340\installcommandhandler \??itemgroup {itemgroup} \??itemgroup
341
342\aliased\let\setupitemgroups\setupitemgroup
343
344\appendtoks
345 \frozen\instance\protected\edefcsname\e!start\currentitemgroup \endcsname{\startitemgroup[\currentitemgroup]}
346 \frozen\instance\protected\edefcsname\e!stop \currentitemgroup \endcsname{\stopitemgroup}
347 \frozen\instance\protected\edefcsname\e!setup\currentitemgroup\e!endsetup\endcsname{\setupitemgroup[\currentitemgroup]}
348 \let\currentparentitemgroup\currentitemgroup
349 \definecounter[\v_strc_itemgroups_counter]
350\to \everydefineitemgroup
351
352
353
354\def\strc_itemgroups_store_continue_state#options#settings
355 {\xdefcsname\??itemgroupoption \currentitemgroup\endcsname{\strc_itemgroups_process_options{#options}}
356 \gdefcsname\??itemgroupsetting\currentitemgroup\endcsname{\setupcurrentitemgroup[#settings]}}
357
358\def\strc_itemgroups_fetch_continue_state
359 {\csname\??itemgroupoption \currentitemgroup\endcsname
360 \csname\??itemgroupsetting\currentitemgroup\endcsname}
361
362\def\strc_itemgroups_reset_continue_state
363 {\gletcsname\??itemgroupoption \currentitemgroup\endcsname\relax
364 \gletcsname\??itemgroupsetting\currentitemgroup\endcsname\relax}
365
366
367
368
369\definevspacing[\v!item @\v!no] [penalty:0]
370\definevspacing[\v!item @\v!yes] [penalty:10000]
371\definevspacing[\v!item @\v!tight] [penalty:500]
372\definevspacing[\v!item @\v!verytight] [penalty:5000]
373
374\definevspacing[\v!item @5] [penalty:5]
375\definevspacing[\v!item @5] [penalty:5]
376
377\def\strc_itemgroups_insert_break_when_needed#break
378 {\ifcase\c_strc_itemgroups_optimize
379
380 \orelse\ifconditional\c_strc_itemgroups_text
381
382 \else
383 #break\relax
384 \fi}
385
386\def\strc_itemgroups_insert_breakallow{\strc_itemgroups_insert_break_when_needed\strc_itemgroups_insert_breakallow_indeed}
387\def\strc_itemgroups_insert_breakno {\strc_itemgroups_insert_break_when_needed\strc_itemgroups_insert_breakno_indeed }
388\def\strc_itemgroups_insert_break {\strc_itemgroups_insert_break_when_needed\strc_itemgroups_insert_break_indeed }
389\def\strc_itemgroups_insert_nobreak {\strc_itemgroups_insert_break_when_needed\strc_itemgroups_insert_nobreak_indeed }
390
391\def\strc_itemgroups_insert_breakallow_indeed
392 {\vspacing[\v!item @\v!no]}
393
394\def\strc_itemgroups_insert_breakno_indeed
395 {\vspacing[\v!item @\v!yes]}
396
397\def\strc_itemgroups_insert_break_indeed
398 {\flushnotes
399 \vspacing[\v!item @5]}
400
401\def\strc_itemgroups_insert_nobreak_indeed
402 {\flushnotes
403 \ifinsidecolumns
404 \vspacing[\v!item @5]
405 \orelse\ifcase\c_strc_itemgroups_optimize
406 \or
407
408 \vspacing[\v!item @\v!tight]
409 \else
410
411 \vspacing[\v!item @\v!verytight]
412 \fi}
413
414\protected\def\strc_itemgroups_process_options#options
415 {\processcommacommand[#options]\strc_itemgroups_process_option}
416
417
418
419
420
421
422\mutable\lettonothing\itemgroupfirst
423\mutable\lettonothing\itemgroupsecond
424
425\def\strc_itemgroups_process_option#option
426 {\edef\scratchstringone{#option}
427 \ifempty\scratchstringone\else
428 \splitatasterisk\scratchstringone\itemgroupfirst\itemgroupsecond
429 \ifempty\itemgroupsecond
430 \let\itemgroupsecond\itemgroupfirst
431 \let\itemgroupfirst\!!plusone
432 \fi
433 \ifcsname\??itemgroupkeyword\itemgroupsecond\endcsname
434 \lastnamedcs
435 \else
436 \strc_itemgroups_set_symbol\scratchstringone
437 \fi
438 \fi}
439
440\def\strc_itemgroups_process_set_option_pack
441 {\ifcase\c_strc_itemgroups_nesting \else
442 \c_strc_itemgroups_pack\conditionaltrue
443 \fi}
444
445\def\strc_itemgroups_process_set_option_unpack
446 {\ifcase\c_strc_itemgroups_nesting\else
447 \c_strc_itemgroups_pack\conditionalfalse
448 \fi}
449
450\defcsname\??itemgroupkeyword\!!zerocount\endcsname
451 {}
452
453\defcsname\??itemgroupkeyword\v!packed\endcsname
454 {\strc_itemgroups_process_set_option_pack}
455
456\defcsname\??itemgroupkeyword\v!unpacked\endcsname
457 {\strc_itemgroups_process_set_option_unpack}
458
459\defcsname\??itemgroupkeyword\v!intro\endcsname
460 {\c_strc_itemgroups_intro\conditionaltrue}
461
462\defcsname\??itemgroupkeyword\v!autointro\endcsname
463 {\c_strc_itemgroups_auto_intro\conditionaltrue}
464
465\defcsname\??itemgroupkeyword\v!broad\endcsname
466 {\ifempty\itemgroupfirst
467 \let\itemgroupfirst\!!plusone
468 \fi
469 \letitemgroupparameter\c!factor\itemgroupfirst}
470
471\defcsname\??itemgroupkeyword\v!text\endcsname
472 {\c_strc_itemgroups_text\conditionaltrue
473 \c_strc_itemgroups_inline\conditionaltrue
474 \c_strc_itemgroups_joined\conditionaltrue
475 \strc_itemgroups_process_set_option_pack}
476
477\defcsname\??itemgroupkeyword\v!before\endcsname
478 {\c_strc_itemgroups_before\conditionaltrue}
479
480\defcsname\??itemgroupkeyword\v!after\endcsname
481 {\c_strc_itemgroups_after\conditionaltrue}
482
483\defcsname\??itemgroupkeyword\v!nowhite\endcsname
484 {\c_strc_itemgroups_nowhite\conditionaltrue}
485
486\defcsname\??itemgroupkeyword\v!margin\endcsname
487 {\setitemgroupparameter\c!width{2em}}
488
489\defcsname\??itemgroupkeyword\v!inmargin\endcsname
490 {\setitemgroupparameter\c!width{2em}}
491
492\defcsname\??itemgroupkeyword\v!atmargin\endcsname
493 {\ifnum\c_strc_itemgroups_nesting>\plusone
494 \setitemgroupparameter\c!width{0em}
495 \fi}
496
497\defcsname\??itemgroupkeyword\v!intext\endcsname
498 {\c_strc_itemgroups_inline\conditionaltrue}
499
500\defcsname\??itemgroupkeyword\v!headintext\endcsname
501 {\c_strc_itemgroups_inline_head\conditionaltrue}
502
503\defcsname\??itemgroupkeyword\v!loose\endcsname
504 {\c_strc_itemgroups_optimize\zerocount}
505
506\defcsname\??itemgroupkeyword\v!tight\endcsname
507 {\c_strc_itemgroups_optimize\plusone}
508
509\defcsname\??itemgroupkeyword\v!verytight\endcsname
510 {\c_strc_itemgroups_optimize\plustwo}
511
512\defcsname\??itemgroupkeyword\v!tight:\v!first\endcsname
513 {\c_strc_itemgroups_optimize\plusthree}
514
515\defcsname\??itemgroupkeyword\v!tight:\v!last\endcsname
516 {\c_strc_itemgroups_optimize\plusfour}
517
518\defcsname\??itemgroupkeyword\v!fit\endcsname
519 {\c_strc_itemgroups_fitting\conditionaltrue}
520
521\defcsname\??itemgroupkeyword\v!nofit\endcsname
522 {\c_strc_itemgroups_fitting\conditionalfalse}
523
524\defcsname\??itemgroupkeyword\v!paragraph\endcsname
525 {\c_strc_itemgroups_paragraph\conditionaltrue
526 \strc_itemgroups_process_set_option_pack}
527
528\defcsname\??itemgroupkeyword\v!joinedup\endcsname
529 {\c_strc_itemgroups_joined\conditionaltrue
530 \strc_itemgroups_process_set_option_pack}
531
532\defcsname\??itemgroupkeyword\v!notjoinedup\endcsname
533 {\c_strc_itemgroups_joined\conditionalfalse}
534
535\defcsname\??itemgroupkeyword\v!serried\endcsname
536 {\edef\itemgroupfirst{\ifempty\itemgroupfirst1\else\itemgroupfirst\fi}
537 \letitemgroupparameter\c!factor\itemgroupfirst}
538
539\defcsname\??itemgroupkeyword\v!stopper\endcsname
540 {\letitemgroupparameter\c!placestopper\v!yes}
541
542\defcsname\??itemgroupkeyword\v!nostopper\endcsname
543 {\letitemgroupparameter\c!placestopper\v!no}
544
545\defcsname\??itemgroupkeyword\v!repeat\endcsname
546 {\c_strc_itemgroups_repeat\conditionaltrue}
547
548\defcsname\??itemgroupkeyword\v!norepeat\endcsname
549 {\c_strc_itemgroups_repeat\conditionalfalse}
550
551\defcsname\??itemgroupkeyword\v!reverse\endcsname
552 {\c_strc_itemgroups_reverse\conditionaltrue}
553
554\defcsname\??itemgroupkeyword\v!columns\endcsname
555 {\c_strc_itemgroups_columns\conditionaltrue}
556
557\defcsname\??itemgroupkeyword\v!overlay\endcsname
558 {\c_strc_itemgroups_overlay\conditionaltrue}
559
560\defcsname\??itemgroupkeyword\v!one \endcsname{\letitemgroupparameter\c!n\plusone}
561\defcsname\??itemgroupkeyword\v!two \endcsname{\letitemgroupparameter\c!n\plustwo}
562\defcsname\??itemgroupkeyword\v!three\endcsname{\letitemgroupparameter\c!n\plusthree}
563\defcsname\??itemgroupkeyword\v!four \endcsname{\letitemgroupparameter\c!n\plusfour}
564\defcsname\??itemgroupkeyword\v!five \endcsname{\letitemgroupparameter\c!n\plusfive}
565\defcsname\??itemgroupkeyword\v!six \endcsname{\letitemgroupparameter\c!n\plussix}
566\defcsname\??itemgroupkeyword\v!seven\endcsname{\letitemgroupparameter\c!n\plusseven}
567\defcsname\??itemgroupkeyword\v!eight\endcsname{\letitemgroupparameter\c!n\pluseight}
568\defcsname\??itemgroupkeyword\v!nine \endcsname{\letitemgroupparameter\c!n\plusnine}
569
570\defcsname\??itemgroupkeyword\v!standard\endcsname
571 {\setitemgroupparameter \c!width {1.5\emwidth}
572 \setitemgroupparameter \c!distance {.5\emwidth}
573
574 \letitemgroupparameter \c!factor {\zerocount}
575 \setitemgroupparameter \c!packcriterium{\zerocount}
576 \resetitemgroupparameter\c!inner
577 \resetitemgroupparameter\c!beforehead
578 \letitemgroupparameter \c!afterhead \blank
579 \letitemgroupparameter \c!before \blank
580 \letitemgroupparameter \c!inbetween \blank
581 \letitemgroupparameter \c!after \blank}
582
583\def\strc_itemgroups_initialize_local
584 {\c_strc_itemgroups_inline\conditionalfalse
585 \c_strc_itemgroups_concat\conditionalfalse
586 \c_strc_itemgroups_txt\conditionalfalse
587 \c_strc_itemgroups_no_par\conditionalfalse
588
589 \c_strc_itemgroups_reverse\conditionalfalse
590 \c_strc_itemgroups_intro\conditionalfalse
591 \c_strc_itemgroups_auto_intro\conditionalfalse
592 \c_strc_itemgroups_before\conditionalfalse
593 \c_strc_itemgroups_after\conditionalfalse
594 \c_strc_itemgroups_nowhite\conditionalfalse
595 \c_strc_itemgroups_randomize\conditionalfalse
596 \c_strc_itemgroups_horizontal\conditionalfalse
597 \c_strc_itemgroups_collecting\conditionalfalse
598 \c_strc_itemgroups_intro\conditionalfalse
599 \c_strc_itemgroups_continue\conditionalfalse
600
601 \c_strc_itemgroups_head\conditionalfalse
602 \c_strc_itemgroups_sub\conditionalfalse
603 \c_strc_itemgroups_symbol\conditionalfalse
604 \c_strc_itemgroups_columns\conditionalfalse
605 \c_strc_itemgroups_overlay\conditionalfalse
606
607 \lettonothing\m_strc_itemgroups_destination
608 \lettonothing\strc_itemgroups_used_symbol
609 \lettonothing\strc_itemgroups_margin_symbol
610 \lettonothing\strc_itemgroups_extra_symbol
611
612 \global\letitemgroupparameter\c!maxwidth\!!zeropoint
613 }
614
615\defcsname\??itemgroupfirst\v!intro\endcsname
616 {\c_strc_itemgroups_intro\conditionaltrue}
617
618\defcsname\??itemgroupfirst\v!continue\endcsname
619 {\c_strc_itemgroups_continue\conditionaltrue}
620
621\defcsname\??itemgroupfirst\v!random\endcsname
622 {\c_strc_itemgroups_randomize\conditionaltrue
623 \c_strc_itemgroups_collecting\conditionaltrue}
624
625\defcsname\??itemgroupkeyword\v!horizontal\endcsname
626 {\c_strc_itemgroups_horizontal\conditionaltrue
627 \c_strc_itemgroups_collecting\conditionaltrue
628 \c_strc_itemgroups_inline\conditionaltrue
629 \c_strc_itemgroups_joined\conditionaltrue
630 \strc_itemgroups_process_set_option_pack}
631
632\def\strc_itemgroups_preset_stage_one#options
633 {\processcommacommand[#options]\strc_itemgroups_preset_stage_one_indeed}
634
635
636
637
638
639
640\def\strc_itemgroups_preset_stage_one_indeed#option
641 {\ifcsname\??itemgroupfirst#option\endcsname
642 \lastnamedcs
643 \fi}
644
645\ifdefined\dotagsetitemgroup \else \aliased\let\dotagsetitemgroup\relax \fi
646\ifdefined\dotagsetitem \else \aliased\let\dotagsetitem \gobbleoneargument \fi
647
648\def\strc_itemgroups_tag_start_group
649 {\dostarttaggedchained\t!itemgroup\currentparentitemgroup\??itemgroup
650 \dotagsetitemgroup}
651
652\def\strc_itemgroups_tag_stop_group
653 {\dostoptagged}
654
655\def\strc_itemgroups_before_command
656 {\ifconditional\c_strc_itemgroups_nowhite
657 \ifconditional\c_strc_itemgroups_before
658 \ifcase\c_strc_itemgroups_nesting\or\itemgroupparameter\c!before\fi
659 \else
660 \nowhitespace
661 \fi
662 \orelse\ifconditional\c_strc_itemgroups_joined
663
664 \else
665 \itemgroupparameter\c!before
666 \fi}
667
668\def\strc_itemgroups_after_command
669 {\ifconditional\c_strc_itemgroups_nowhite
670 \ifconditional\c_strc_itemgroups_after
671 \ifcase\c_strc_itemgroups_nesting\or\itemgroupparameter\c!after\fi
672 \else
673 \nowhitespace
674 \fi
675 \orelse\ifconditional\c_strc_itemgroups_joined
676
677 \else
678 \itemgroupparameter\c!after
679 \fi}
680
681\def\strc_itemgroups_between_command
682 {\ifconditional\c_strc_itemgroups_nowhite
683 \nowhitespace
684 \orelse\ifconditional\c_strc_itemgroups_joined
685
686 \else
687 \itemgroupparameter\c!inbetween
688 \fi}
689
690\def\strc_itemgroups_before_head_command
691 {\ifconditional\c_strc_itemgroups_nowhite
692 \nowhitespace
693 \orelse\ifconditional\c_strc_itemgroups_joined
694
695 \else
696 \itemgroupparameter\c!beforehead
697 \fi}
698
699\def\strc_itemgroups_after_head_command
700 {\ifconditional\c_strc_itemgroups_nowhite
701 \nowhitespace
702 \orelse\ifconditional\c_strc_itemgroups_joined
703
704 \else
705 \itemgroupparameter\c!afterhead
706 \fi}
707
708
709
710\let\strc_itemgroups_normal_setup\setupitemgroup
711
712\permanent\overloaded\tolerant\protected\def\setupitemgroup[#S#category]#spacer[#S#levels]#spacer[#S#options]#spacer[#S#settings]
713 {\ifarguments
714
715 \or
716 \edef\strc_itemgroups_setup_what{#levels}
717 \strc_itemgroups_normal_setup[#category]
718 \or
719 \edef\strc_itemgroups_setup_what{#levels}
720 \strc_itemgroups_setup_each{#category}{#levels}
721 \or
722 \edef\strc_itemgroups_setup_what{#levels}
723 \ifx\strc_itemgroups_setup_what\v!each
724 \strc_itemgroups_setup_each{#category}{#options}
725 \else
726 \strc_itemgroups_setup_list{#levels}{#category}{#options}
727 \fi
728 \or
729 \edef\strc_itemgroups_setup_what{#levels}
730 \ifx\strc_itemgroups_setup_what\v!each
731 \strc_itemgroups_setup_each{#category}{#options}
732 \strc_itemgroups_setup_each{#category}{#settings}
733 \else
734 \strc_itemgroups_setup_list{#levels}{#category}{#options}
735 \strc_itemgroups_setup_list{#levels}{#category}{#settings}
736 \fi
737 \fi}
738
739\def\strc_itemgroups_setup_each#category#whatever
740 {\ifhastok={#whatever}
741 \strc_itemgroups_normal_setup[#category][#whatever]
742 \else
743 \strc_itemgroups_normal_setup[#category][\c!option={#whatever}]
744 \fi}
745
746\def\strc_itemgroups_setup_list_level_a#category#whatever#level
747 {\strc_itemgroups_normal_setup[#category:#level][#whatever]}
748
749\def\strc_itemgroups_setup_list_level_b#category#whatever#level
750 {\strc_itemgroups_normal_setup[#category:#level][\c!option={#whatever}]}
751
752\def\strc_itemgroups_setup_list#subcategories#category#whatever
753 {\ifhastok={#whatever}
754 \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_a{#category}{#whatever}}
755 \else
756 \processcommalist[#subcategories]{\strc_itemgroups_setup_list_level_b{#category}{#whatever}}
757 \fi}
758
759\def\strc_itemgroups_increment_item_counter
760 {\ifconditional\c_strc_itemgroups_sub \else
761 \ifconditional\c_strc_itemgroups_symbol \else
762 \strc_counters_increment_sub\v_strc_itemgroups_counter\currentitemlevel
763 \fi
764 \fi}
765
766\protected\def\strc_itemgroups_insert_item_counter
767 {\ifconditional\c_strc_itemgroups_repeat
768 \ifcase\c_strc_itemgroups_nesting
769
770 \or
771 \strc_itemgroups_insert_item_counter_indeed
772 \else
773 \strc_itemgroups_insert_item_counter_indeed
774 \fi
775 \else
776 \strc_itemgroups_insert_item_counter_indeed
777 \fi}
778
779\installcorenamespace{itemstopper}
780
781\defcsname\??itemstopper\v!yes\endcsname
782 {\itemgroupparameter\c!stopper}
783
784\defcsname\??itemstopper\v!display\endcsname
785 {\ifconditional\c_strc_itemgroups_inline\else
786 \itemgroupparameter\c!stopper
787 \fi}
788
789\defcsname\??itemstopper\v!inline\endcsname
790 {\ifconditional\c_strc_itemgroups_inline
791 \itemgroupparameter\c!stopper
792 \fi}
793
794\def\strc_itemgroups_insert_item_counter_indeed
795 {\begingroup
796 \setupcounter
797 [\v_strc_itemgroups_counter]
798 [\c!prefix=\itemgroupparameter\c!prefix,
799 \c!prefixstopper=\itemgroupparameter\c!prefixstopper,
800 \c!prefixseparatorset=\itemgroupparameter\c!prefixseparatorset,
801 \c!prefixconversion=\itemgroupparameter\c!prefixconversion,
802 \c!prefixconversionset=\itemgroupparameter\c!prefixseparatorset,
803 \c!prefixset=\itemgroupparameter\c!prefixset,
804 \c!prefixsegments=\itemgroupparameter\c!prefixsegments,
805 \c!prefixconnector=\itemgroupparameter\c!prefixconnector,
806 \c!criterium=\itemgroupparameter\c!criterium,
807 \c!numberorder=\ifconditional\c_strc_itemgroups_reverse\v!reverse\else\v!normal\fi,
808 \c!numberstopper=\begincsname\??itemstopper\itemgroupparameter\c!placestopper\endcsname,
809 \c!numberconversionset=\v_strc_itemgroups_counter,
810 \c!numbersegments=\currentitemgroupsegments]
811
812 \normalexpanded{\defineconversionset[\v_strc_itemgroups_counter][\currentitemgroupconversionset][\currentitemgroupsymbol]}
813
814
815 \convertedcounter[\v_strc_itemgroups_counter]
816 \strc_itemgroups_insert_reference
817 \endgroup}
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849\lettonothing\strc_itemgroups_temp_symbol
850\lettonothing\strc_itemgroups_used_symbol
851\lettonothing\strc_itemgroups_asked_symbol
852\lettonothing\strc_itemgroups_margin_symbol
853\lettonothing\strc_itemgroups_extra_symbol
854
855\def\strc_itemgroups_set_symbol#symbol
856 {\edef\strc_itemgroups_temp_symbol{#symbol}
857 \ifempty\strc_itemgroups_temp_symbol \else
858 \doifelsesymboldefined\strc_itemgroups_temp_symbol
859 \strc_itemgroups_set_symbol_symbol
860 {\doifelseconversiondefined\strc_itemgroups_temp_symbol
861 \strc_itemgroups_set_symbol_conversion
862 \donothing}
863 \fi}
864
865\def\strc_itemgroups_set_symbol_symbol
866 {\let\currentitemgroupsymbol\strc_itemgroups_temp_symbol
867 \strc_itemgroups_store_global_symbol\currentitemgroupsymbol
868 \strc_itemgroups_store_local_symbol\v_strc_itemgroups_unknown_symbol
869 \let\strc_itemgroups_used_symbol\strc_itemgroups_set_symbol_symbol_item
870 \lettonothing\strc_itemgroups_asked_symbol}
871
872\def\strc_itemgroups_set_symbol_conversion
873 {\let\currentitemgroupsymbol\strc_itemgroups_temp_symbol
874 \strc_itemgroups_store_global_symbol\currentitemgroupsymbol
875 \strc_itemgroups_store_local_symbol\strc_itemgroups_insert_item_counter
876 \let\strc_itemgroups_used_symbol\strc_itemgroups_set_symbol_conversion_item
877 \lettonothing\strc_itemgroups_asked_symbol}
878
879\def\strc_itemgroups_set_symbol_symbol_item
880 {\symbol[\currentitemgroupsymbol]}
881
882\def\strc_itemgroups_set_symbol_conversion_item
883 {\ifconditional\c_strc_itemgroups_text
884
885 \itemgroupparameter\c!lefttext
886 \strc_itemgroups_fetch_local_symbol
887 \itemgroupparameter\c!righttext
888 \else
889 \itemgroupparameter\c!left
890 \strc_itemgroups_fetch_local_symbol
891 \itemgroupparameter\c!right
892 \fi}
893
894\def\strc_itemgroups_calculate_list_width#level
895 {\let\m_strc_itemgroups_saved\currentitemgroup
896 \cdef\currentitemgroup{\currentparentitemgroup:\number#level}
897 \ifdim\d_strc_itemgroups_max_width>\zeropoint
898 \d_strc_itemgroups_list_width\d_strc_itemgroups_max_width
899 \orelse\ifnum\itemgroupparameter\c!factor>\zerocount
900 \d_strc_itemgroups_list_width\itemgroupparameter\c!step\relax
901 \ifzeropt\d_strc_itemgroups_list_width \d_strc_itemgroups_list_width=.5em\fi
902 \multiplyby\d_strc_itemgroups_list_width \itemgroupparameter\c!factor
903 \advanceby\d_strc_itemgroups_list_width\itemgroupparameter\c!width\relax
904 \else
905 \d_strc_itemgroups_list_width\itemgroupparameter\c!width\relax
906 \fi
907 \advanceby\d_strc_itemgroups_list_width\itemgroupparameter\c!distance\relax
908 \let\currentitemgroup\m_strc_itemgroups_saved}
909
910\lettonothing\p_itemgroups_options
911\lettonothing\p_itemgroups_extra_options
912
913\permanent\tolerant\protected\def\startitemgroup[#S#category]#spacer[#S#options]#spacer[#S#settings]
914 {\begingroup
915 \nofarguments\lastarguments
916 \cdef\currentitemgroup{#category}
917 \let\currentparentitemgroup\currentitemgroup
918 \global\advanceby\c_strc_itemgroups_nesting\plusone
919 \def\currentitemlevel{\the\c_strc_itemgroups_nesting}
920 \normalexpanded{\chaintocurrentitemgroup{\currentparentitemgroup:\currentitemlevel}}
921 \cdef\currentitemgroup{\currentparentitemgroup:\currentitemlevel}
922
923 \edef\p_itemgroups_options{\itemgroupparameter\c!option}
924 \lettonothing\p_itemgroups_extra_options
925 \ifcase\nofarguments
926 \strc_itemgroups_start_indeed{}
927 \or
928 \strc_itemgroups_start_indeed{}
929 \or
930 \ifhastok={#options}
931 \strc_itemgroups_start_indeed{#options}
932 \else
933 \edef\p_itemgroups_extra_options{#options}
934 \strc_itemgroups_start_indeed{}
935 \fi
936 \or
937 \edef\p_itemgroups_extra_options{#options}
938 \strc_itemgroups_start_indeed{#settings}
939 \fi}
940
941\def\strc_itemgroups_start_indeed#settings
942 {\ifempty\p_itemgroups_options
943 \let\p_itemgroups_options\p_itemgroups_extra_options
944 \orelse\ifempty\p_itemgroups_extra_options
945
946 \else
947 \edef\p_itemgroups_options{\p_itemgroups_options,\p_itemgroups_extra_options}
948 \fi
949 \begingroup
950 \the\itemgroupcommands
951 \setconditional\c_strc_itemgroups_text_saved\c_strc_itemgroups_text
952 \strc_itemgroups_initialize_local
953 \strc_itemgroups_preset_stage_one\p_itemgroups_options
954 \iftrialtypesetting
955 \strc_counters_save\v_strc_itemgroups_counter
956 \fi
957\globalpushmacro\c_strc_itemgroups_n_of_items
958\global\c_strc_itemgroups_n_of_items\zerocount
959 \strc_itemgroups_check_n_of_items
960 \ifempty\p_itemgroups_options
961 \strc_itemgroups_setup_symbol_default
962 \strc_itemgroups_reset_continue_state
963 \setupcurrentitemgroup[#settings]
964 \else
965 \strc_itemgroups_process_options\p_itemgroups_options
966 \setupcurrentitemgroup[#settings]
967 \ifconditional\c_strc_itemgroups_continue
968 \strc_itemgroups_setup_symbol_continue
969 \strc_itemgroups_fetch_continue_state
970 \else
971 \strc_itemgroups_setup_symbol_asked
972 \strc_itemgroups_store_continue_state\p_itemgroups_options{#settings}
973 \fi
974 \fi
975
976 \ifhmode
977 \ifconditional\c_strc_itemgroups_auto_concat
978 \ifnum\lastboundary=\c_strc_itemgroups_boundary
979 \c_strc_itemgroups_concat\conditionaltrue
980 \fi
981 \fi
982 \ifconditional\c_strc_itemgroups_text_saved
983 \orelse\ifconditional\c_strc_itemgroups_text
984 \orelse\ifconditional\c_strc_itemgroups_no_par
985 \else
986 \par
987 \fi
988 \fi
989
990 \ifconditional\c_strc_itemgroups_pack
991 \ifnum\currentnofitems>\itemgroupparameter\c!packcriterium\relax\else
992 \c_strc_itemgroups_pack\conditionalfalse
993 \fi
994 \fi
995
996 \ifconditional\c_strc_itemgroups_text
997
998 \orelse\ifnum\c_strc_itemgroups_nesting=\plusone
999 \doadaptleftskip {\itemgroupparameter\c!margin}
1000 \doadaptleftskip {\itemgroupparameter\c!leftmargin}
1001 \doadaptrightskip{\itemgroupparameter\c!rightmargin}
1002 \fi
1003
1004 \doadaptleftskip {\itemgroupparameter\c!leftmargindistance}
1005 \doadaptrightskip{\itemgroupparameter\c!rightmargindistance}
1006
1007 \edef\m_strc_itemgroups_spacing{\itemgroupparameter\c!spacing}
1008 \ifx\m_strc_itemgroups_spacing\v!before
1009 \c_strc_itemgroups_spacing_mode\zerocount
1010 \orelse\ifx\m_strc_itemgroups_spacing\v!inbetween
1011 \c_strc_itemgroups_spacing_mode\plusone
1012 \orelse\ifx\m_strc_itemgroups_spacing\v!auto
1013 \c_strc_itemgroups_spacing_mode\plustwo
1014 \fi
1015
1016 \usealignparameter\itemgroupparameter
1017 \edef\m_strc_itemgroups_indenting{\itemgroupparameter\c!indenting}
1018 \ifnum\c_strc_itemgroups_nesting>\zerocount
1019 \c_strc_itemgroups_first\conditionaltrue
1020 \ifconditional\c_strc_itemgroups_continue \else
1021 \strc_counters_restart_sub\v_strc_itemgroups_counter\currentitemlevel{\numexpr\itemgroupparameter\c!start\plusone\relax}
1022 \fi
1023 \fi
1024 \ifempty\strc_itemgroups_used_symbol
1025 \strc_itemgroups_set_symbol\strc_itemgroups_asked_symbol
1026 \ifempty\strc_itemgroups_used_symbol
1027 \let\currentitemgroupsymbol\currentitemlevel
1028 \fi
1029 \fi
1030 \ifconditional\c_strc_itemgroups_auto_intro\ifnum\prevgraf<\plusthree
1031 \c_strc_itemgroups_intro\conditionaltrue
1032 \fi\fi
1033 \ifconditional\c_strc_itemgroups_paragraph
1034 \ifnum\c_strc_itemgroups_nesting>\plusone
1035 \resetitemgroupparameter\c!inbetween
1036 \fi
1037 \fi
1038 \ifconditional\c_strc_itemgroups_pack
1039 \resetitemgroupparameter\c!inbetween
1040 \fi
1041 \ifconditional\c_strc_itemgroups_columns
1042 \ifinsidecolumns\orelse\ifcase\c_strc_itemgroups_column_depth
1043 \global\c_strc_itemgroups_column_depth\c_strc_itemgroups_nesting
1044 \strc_itemgroups_before_command
1045 \strc_itemgroups_tag_start_group
1046 \strc_itemgroups_start_columns
1047 \fi
1048 \fi
1049 \ifconditional\c_strc_itemgroups_fitting
1050 \ifdim\d_strc_itemgroups_max_width>\zeropoint
1051 \letitemgroupparameter\c!width\d_strc_itemgroups_max_width_reference
1052 \fi
1053 \fi
1054 \strc_itemgroups_calculate_list_width\c_strc_itemgroups_nesting
1055 \ifdim\d_strc_itemgroups_list_width>\zeropoint\relax
1056 \ifconditional\c_strc_itemgroups_inline\else
1057 \frozen\advanceby\leftskip\d_strc_itemgroups_list_width\relax
1058 \fi
1059 \fi
1060 \ifempty\m_strc_itemgroups_repeat_start
1061 \let\currentitemgroupconversionset \currentitemgroupsymbol
1062 \edef\currentitemgroupsegments {\currentitemlevel}
1063 \else
1064 \edef\currentitemgroupconversionset{\currentitemgroupconversionset,\currentitemgroupsymbol}
1065 \edef\currentitemgroupsegments {\m_strc_itemgroups_repeat_start:\currentitemlevel}
1066 \fi
1067 \d_strc_itemgroups_asked_width\itemgroupparameter\c!width\relax
1068 \startcollectitems}
1069
1070\let\startcollectitems\relax
1071\let\stopcollectitems \relax
1072
1073\letcsname\??itemgroupalign\v!flushleft \endcsname\relax
1074\letcsname\??itemgroupalign\v!right \endcsname\relax
1075\letcsname\??itemgroupalign\v!flushright\endcsname\hfill
1076\letcsname\??itemgroupalign\v!left \endcsname\hfill
1077\letcsname\??itemgroupalign\v!middle \endcsname\hfil
1078\letcsname\??itemgroupalign\v!center \endcsname\hfil
1079
1080\def\strc_itemgroups_left_sym_filler
1081 {\csname\??itemgroupalign\itemgroupparameter\c!symalign\endcsname}
1082
1083
1084
1085\def\strc_itemgroups_store_global_symbol#symbol
1086 {\gletcsname\??itemgroupglobal\currentitemgroup:\currentitemlevel\endcsname#symbol}
1087
1088\def\strc_itemgroups_store_local_symbol#symbol
1089 {\gletcsname\??itemgrouplocal\currentitemgroup:\currentitemlevel\endcsname#symbol}
1090
1091\def\strc_itemgroups_fetch_global_symbol
1092 {\csname\??itemgroupglobal\currentitemgroup:\currentitemlevel\endcsname}
1093
1094\def\strc_itemgroups_fetch_local_symbol
1095 {\csname\??itemgrouplocal\currentitemgroup:\currentitemlevel\endcsname}
1096
1097\def\strc_itemgroups_setup_symbol_default
1098 {\edef\strc_itemgroups_asked_symbol{\itemgroupparameter\c!symbol}
1099 \strc_itemgroups_store_global_symbol\empty}
1100
1101\def\strc_itemgroups_setup_symbol_continue
1102 {\ifcsname\??itemgroupglobal\currentitemgroup:\currentitemlevel\endcsname
1103 \let\strc_itemgroups_asked_symbol\strc_itemgroups_fetch_global_symbol
1104 \else
1105 \let\strc_itemgroups_asked_symbol\currentitemlevel
1106 \fi}
1107
1108\def\strc_itemgroups_setup_symbol_asked
1109 {\edef\strc_itemgroups_asked_symbol{\itemgroupparameter\c!symbol}}
1110
1111\ifdefined\strc_itemgroups_start_columns
1112
1113
1114
1115\else
1116
1117
1118
1119 \ifdefined\startcolumns \else
1120 \protected\def\startcolumns[#S#settings]{}
1121 \protected\def\stopcolumns {}
1122 \fi
1123
1124 \def\strc_itemgroups_start_columns
1125 {\startcolumns
1126 [\c!n=\itemgroupparameter\c!n,
1127 \c!height=,
1128 \c!rule=\v!off,
1129 \c!balance=\v!yes,
1130 \c!align=\v!no]}
1131
1132 \def\strc_itemgroups_stop_columns
1133 {\stopcolumns}
1134
1135\fi
1136
1137\permanent\protected\def\stopitemgroup
1138 {\stopcollectitems
1139 \ifconditional\c_strc_itemgroups_text
1140 \removeunwantedspaces
1141 \space
1142 \ignorepars
1143 \else
1144 \par
1145 \fi
1146 \strc_itemgroups_register_status
1147
1148 \ifnum\c_strc_itemgroups_n_of_items>\zerocount
1149 \dostoptagged
1150 \dostoptagged
1151
1152 \fi
1153 \ifnum\c_strc_itemgroups_column_depth=\c_strc_itemgroups_nesting\relax
1154 \strc_itemgroups_stop_columns
1155 \global\c_strc_itemgroups_column_depth\zerocount
1156 \strc_itemgroups_tag_stop_group
1157 \strc_itemgroups_after_command
1158 \dontrechecknextindentation
1159 \orelse\ifnum\c_strc_itemgroups_nesting=\plusone
1160 \strc_itemgroups_insert_breakallow
1161 \strc_itemgroups_tag_stop_group
1162 \strc_itemgroups_after_command
1163 \useindentnextparameter\itemgroupparameter
1164 \else
1165
1166 \strc_itemgroups_tag_stop_group
1167 \ifcase\c_strc_itemgroups_spacing_mode
1168 \strc_itemgroups_after_command
1169 \or
1170 \strc_itemgroups_after_command
1171 \fi
1172 \dontrechecknextindentation
1173 \fi
1174
1175 \iftrialtypesetting
1176 \strc_counters_restore\v_strc_itemgroups_counter
1177 \fi
1178\globalpopmacro\c_strc_itemgroups_n_of_items
1179 \global\advanceby\c_strc_itemgroups_nesting\minusone
1180 \xdef\currentitemlevel{\the\c_strc_itemgroups_nesting}
1181
1182 \endgroup
1183 \endgroup
1184
1185
1186
1187
1188
1189 \dorechecknextindentation}
1190
1191
1192
1193\def\strc_itemgroups_start_item_first
1194 {\c_strc_itemgroups_first\conditionalfalse
1195
1196 \ifcase\c_strc_itemgroups_nesting
1197
1198 \or
1199 \strc_itemgroups_start_item_first_one
1200 \else
1201 \strc_itemgroups_start_item_first_two
1202 \fi}
1203
1204\def\strc_itemgroups_start_item_first_one
1205 {\ifcase\c_strc_itemgroups_column_depth
1206 \ifconditional\c_strc_itemgroups_intro\strc_itemgroups_insert_breakno\fi
1207 \strc_itemgroups_before_command
1208 \strc_itemgroups_tag_start_group
1209 \ifconditional\c_strc_itemgroups_intro\strc_itemgroups_insert_breakno\fi
1210 \fi}
1211
1212\newinteger\c_strc_itemgroups_prev_level
1213
1214\def\strc_itemgroups_inbetween_command
1215 {\nameditemgroupparameter{\currentparentitemgroup:\the\c_strc_itemgroups_prev_level}\c!inbetween}
1216
1217\def\strc_itemgroups_start_item_first_two
1218 {\ifconditional\c_strc_itemgroups_paragraph\else
1219 \c_strc_itemgroups_prev_level\numexpr\c_strc_itemgroups_nesting\plusone\relax
1220 \ifcase\c_strc_itemgroups_spacing_mode
1221 \strc_itemgroups_before_command
1222 \or
1223 \ifempty\strc_itemgroups_before_command
1224 \strc_itemgroups_inbetween_command
1225 \else
1226 \strc_itemgroups_before_command
1227 \fi
1228 \else
1229 \strc_itemgroups_inbetween_command
1230 \fi
1231 \strc_itemgroups_tag_start_group
1232 \fi}
1233
1234\def\strc_itemgroups_start_item_next
1235 {
1236
1237 \ifconditional\c_strc_itemgroups_text
1238 \ifhmode
1239
1240 \strc_itemgroups_set_text_item_distance
1241 \removeunwantedspaces
1242 \ifnum\numexpr\c_strc_itemgroups_n_of_items\plusone\relax=\c_strc_itemgroups_max_items
1243 \itemgroupparameter\c!lasttextseparator
1244 \else
1245 \itemgroupparameter\c!textseparator
1246 \fi
1247 \ifempty\m_strc_itemgroups_text_distance
1248
1249 \else
1250 \hskip\m_strc_itemgroups_text_distance\relax
1251 \fi
1252 \fi
1253 \else
1254 \strc_itemgroups_between_command
1255 \fi}
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270\mutable\lettonothing\currentitemreference
1271
1272\noaligned\tolerant\permanent\protected\def\startitemgroupitem[#reference]
1273 {\strc_itemgroups_begin
1274 \def\currentitemreference{#reference}
1275 \ifconditional\c_strc_itemgroups_text
1276
1277 \orelse\ifconditional\c_strc_itemgroups_no_par
1278
1279 \else
1280 \par
1281 \fi
1282 \ifconditional\c_strc_itemgroups_concat
1283 \strc_itemgroups_insert_breakno
1284 \fi
1285
1286
1287
1288
1289
1290
1291 \strc_itemgroups_increment_item_counter
1292 \ifnum\c_strc_itemgroups_n_of_items>\zerocount
1293 \dostoptagged
1294 \dostoptagged
1295 \strc_itemgroups_start_item_next
1296 \else
1297 \strc_itemgroups_start_item_first
1298 \fi
1299 \ifconditional\c_strc_itemgroups_concat
1300 \spac_overlay_lines
1301 \c_strc_itemgroups_concat\conditionalfalse
1302 \fi
1303 \dostarttagged\t!item\empty
1304
1305 \dostarttagged\t!itemtag\empty
1306 \strc_itemgroups_insert_item
1307 \dostoptagged
1308 \ifconditional\c_strc_itemgroups_pack
1309 \setupwhitespace[\v!none]
1310 \fi
1311 \itemgroupparameter\c!inner
1312 \strc_itemgroups_margin_symbol
1313 \let\strc_itemgroups_margin_symbol\relax
1314 \dostarttagged\t!itemcontent\empty
1315 \begstrut
1316 \nobreak
1317 \seteffectivehsize
1318 \boundary\c_strc_itemgroups_boundary
1319 \itemgroupparameter\c!command}
1320
1321\noaligned\protected\permanent\def\stopitemgroupitem
1322 {\ifhmode
1323 \endstrut
1324 \fi
1325 \ifconditional\c_strc_itemgroups_text
1326
1327 \else
1328 \endgraf
1329 \fi
1330 \strc_itemgroups_end}
1331
1332\lettonothing\strc_itemgroups_begin
1333\lettonothing\strc_itemgroups_end
1334
1335\tolerant\permanent\protected\def\startitemgrouphead[#reference]
1336 {\ifconditional\c_strc_itemgroups_first \else
1337 \strc_itemgroups_insert_breakallow
1338 \fi
1339 \ifconditional\c_strc_itemgroups_pack \else
1340 \strc_itemgroups_before_head_command
1341 \fi
1342 \ifconditional\c_strc_itemgroups_first
1343 \ifconditional\c_strc_itemgroups_intro \else
1344 \ifcase\c_strc_itemgroups_nesting
1345 \strc_itemgroups_insert_breakallow
1346 \fi
1347 \fi
1348 \fi
1349
1350 \startitemgroupitem[#reference]
1351 \pickupgroupedcommand
1352 \strc_itemgroups_start_head_indeed
1353 \strc_itemgroups_stop_head_indeed
1354 \strc_itemgroups_head_body_indeed}
1355
1356\permanent\protected\def\stopitemgrouphead
1357 {\dostoptagged
1358 \stopitemgroupitem}
1359
1360\protected\def\strc_itemgroups_start_head_indeed
1361 {\c_strc_itemgroups_head\conditionaltrue
1362 \dotagsetitem\s!head
1363 \dostarttagged\t!itemhead\empty
1364 \useitemgroupstyleandcolor\c!headstyle\c!headcolor
1365 \ignorepars}
1366
1367\protected\def\strc_itemgroups_stop_head_indeed
1368 {\removeunwantedspaces
1369 \dostoptagged
1370 \ifconditional\c_strc_itemgroups_inline_head
1371 \space
1372 \ignorepars
1373 \else
1374 \ifconditional\c_strc_itemgroups_text
1375 \space
1376 \ignorepars
1377 \else
1378 \par
1379 \fi
1380 \strc_itemgroups_insert_breakno
1381 \ifconditional\c_strc_itemgroups_pack\else\strc_itemgroups_after_head_command\fi
1382 \strc_itemgroups_insert_breakno
1383 \fi}
1384
1385\protected\def\strc_itemgroups_head_body_indeed
1386 {\dostarttagged\t!itembody\empty
1387 \noindentation
1388 \ignorepars}
1389
1390
1391
1392\protected\def\strc_itemgroups_start_do_item
1393 {\startitemgroupitem}
1394
1395\protected\def\strc_itemgroups_start_no_item
1396 {\lettonothing\currentitemreference
1397 \strc_itemgroups_increment_item_counter
1398
1399 \setbox\b_strc_itemgroups\emptyhbox
1400 \strc_itemgroups_check_for_repeated
1401 \ignorepars}
1402
1403\protected\def\strc_itemgroups_start_button[#destination]
1404 {\edef\m_strc_itemgroups_destination{#destination}
1405 \startitemgroupitem}
1406
1407\protected\def\strc_itemgroups_start_symbol#text
1408 {\def\strc_itemgroups_extra_symbol{#text}
1409 \c_strc_itemgroups_symbol\conditionaltrue
1410 \startitemgroupitem
1411 \dotagsetitem\s!symbol}
1412
1413\protected\def\strc_itemgroups_start_dummy
1414 {\strc_itemgroups_start_symbol
1415
1416 \begstrut}
1417
1418\protected\def\strc_itemgroups_start_subitem
1419 {\c_strc_itemgroups_sub\conditionaltrue
1420 \startitemgroupitem
1421 \dotagsetitem\s!sub}
1422
1423\protected\def\strc_itemgroups_start_edge#text
1424 {\strc_itemgroups_start_symbol
1425 {\strc_itemgroups_calculate_list_width\c_strc_itemgroups_nesting
1426 \dostarttagged\t!ignore\empty
1427 \hbox to \d_strc_itemgroups_list_width
1428 {#text\hskip\itemgroupparameter\c!distance}
1429 \dostoptagged}}
1430
1431\protected\def\strc_itemgroups_start_margin#text
1432 {\def\strc_itemgroups_margin_symbol
1433 {\dostarttagged\t!ignore\empty
1434 \llap
1435 {\begingroup
1436 \useitemgroupstyleandcolor\c!marstyle\c!marcolor
1437 #text
1438 \endgroup
1439 \hskip\dimexpr\leftskip\leftmargindistance\relax}
1440 \dostoptagged}
1441 \startitemgroupitem
1442 \dotagsetitem\s!margin}
1443
1444\protected\def\strc_itemgroups_start_text#text
1445 {\def\strc_itemgroups_extra_symbol{#text}
1446 \c_strc_itemgroups_symbol\conditionaltrue
1447 \c_strc_itemgroups_txt\conditionaltrue
1448 \startitemgroupitem}
1449
1450\protected\tolerant\def\strc_itemgroups_start_items[#1]
1451 {\strc_itemgroups_start_edge
1452 {\localcontrolledloop
1453 \plusone
1454 \ifchknumber#1\or\lastchknumber\else0\itemgroupparameter\c!items\fi
1455 \plusone
1456 {\strc_itemgroups_used_symbol\hss}
1457 \unskip}}
1458
1459\protected\permanent\def\startspecialitemgroupitem[#name]
1460 {\ifcsname\??itemgroupstart#name\endcsname
1461 \expandafter\lastnamedcs
1462 \else
1463 \expandafter\strc_itemgroups_start_do_item
1464 \fi}
1465
1466\protected\permanent\def\stopspecialitemgroupitem
1467 {\stopitemgroupitem}
1468
1469\letcsname\??itemgroupstart\v!item\endcsname\strc_itemgroups_start_do_item
1470\letcsname\??itemgroupstart\v!sub \endcsname\strc_itemgroups_start_subitem
1471\letcsname\??itemgroupstart\v!sym \endcsname\strc_itemgroups_start_symbol
1472\letcsname\??itemgroupstart\v!ran \endcsname\strc_itemgroups_start_edge
1473\letcsname\??itemgroupstart\v!its \endcsname\strc_itemgroups_start_items
1474\letcsname\??itemgroupstart\v!mar \endcsname\strc_itemgroups_start_margin
1475\letcsname\??itemgroupstart\v!txt \endcsname\strc_itemgroups_start_text
1476\letcsname\??itemgroupstart\v!no \endcsname\strc_itemgroups_start_no_item
1477
1478\def\strc_itemgroups_optimize_breaks_both
1479 {\ifcase\c_strc_itemgroups_max_items
1480 \orelse\ifnum\c_strc_itemgroups_max_items=\plusthree
1481 \ifnum\c_strc_itemgroups_n_of_items>\plusone
1482 \strc_itemgroups_insert_nobreak
1483 \fi
1484 \orelse\ifnum\c_strc_itemgroups_max_items>\plusthree
1485 \ifnum\c_strc_itemgroups_n_of_items=\plustwo
1486 \ifconditional\c_strc_itemgroups_intro
1487 \strc_itemgroups_insert_breakno
1488 \else
1489 \strc_itemgroups_insert_nobreak
1490 \fi
1491 \orelse\ifnum\c_strc_itemgroups_max_items=\c_strc_itemgroups_n_of_items\relax
1492 \strc_itemgroups_insert_nobreak
1493 \orelse\ifnum\c_strc_itemgroups_n_of_items>\plustwo
1494 \strc_itemgroups_insert_break
1495 \orelse\ifconditional\c_strc_itemgroups_intro
1496 \else
1497 \strc_itemgroups_insert_break
1498 \fi
1499 \fi}
1500
1501\def\strc_itemgroups_optimize_breaks_first
1502 {\ifcase\c_strc_itemgroups_max_items
1503 \orelse\ifnum\c_strc_itemgroups_max_items=\plusthree
1504 \ifnum\c_strc_itemgroups_n_of_items<\plusthree
1505 \strc_itemgroups_insert_nobreak
1506 \else
1507 \strc_itemgroups_insert_break
1508 \fi
1509 \orelse\ifnum\c_strc_itemgroups_max_items>\plusthree
1510 \ifnum\c_strc_itemgroups_n_of_items=\plustwo
1511 \ifconditional\c_strc_itemgroups_intro
1512 \strc_itemgroups_insert_breakno
1513 \else
1514 \strc_itemgroups_insert_nobreak
1515 \fi
1516 \orelse\ifnum\c_strc_itemgroups_max_items=\c_strc_itemgroups_n_of_items\relax
1517 \strc_itemgroups_insert_break
1518 \orelse\ifnum\c_strc_itemgroups_n_of_items>\plustwo
1519 \strc_itemgroups_insert_break
1520 \orelse\ifconditional\c_strc_itemgroups_intro
1521 \else
1522 \strc_itemgroups_insert_break
1523 \fi
1524 \fi}
1525
1526\def\strc_itemgroups_optimize_breaks_last
1527 {\ifcase\c_strc_itemgroups_max_items
1528 \orelse\ifnum\c_strc_itemgroups_max_items=\plusthree
1529 \ifnum\c_strc_itemgroups_n_of_items>\plustwo
1530 \strc_itemgroups_insert_nobreak
1531 \else
1532 \strc_itemgroups_insert_break
1533 \fi
1534 \orelse\ifnum\c_strc_itemgroups_max_items>\plusthree
1535 \ifnum\c_strc_itemgroups_n_of_items=\plustwo
1536 \ifconditional\c_strc_itemgroups_intro
1537 \strc_itemgroups_insert_breakno
1538 \else
1539 \strc_itemgroups_insert_break
1540 \fi
1541 \orelse\ifnum\c_strc_itemgroups_max_items=\c_strc_itemgroups_n_of_items\relax
1542 \strc_itemgroups_insert_nobreak
1543 \orelse\ifnum\c_strc_itemgroups_n_of_items>\plustwo
1544 \strc_itemgroups_insert_break
1545 \orelse\ifconditional\c_strc_itemgroups_intro
1546 \else
1547 \strc_itemgroups_insert_break
1548 \fi
1549 \fi}
1550
1551\def\strc_itemgroups_optimize_breaks
1552 {\ifcase\c_strc_itemgroups_column_depth
1553 \ifconditional\c_strc_itemgroups_optimize
1554 \or \strc_itemgroups_optimize_breaks_both
1555 \or \strc_itemgroups_optimize_breaks_both
1556 \or \strc_itemgroups_optimize_breaks_first
1557 \or \strc_itemgroups_optimize_breaks_last
1558 \fi
1559 \fi}
1560
1561\def\strc_itemgroups_handle_text_item
1562 {\scratchdimen\wd\b_strc_itemgroups
1563 \advanceby \scratchdimen \itemgroupparameter\c!distance\relax
1564 \ifdim\scratchdimen>\d_strc_itemgroups_list_width
1565 \advanceby\scratchdimen \d_strc_itemgroups_list_width
1566 \else
1567 \scratchdimen\zeropoint
1568 \fi
1569 \llap{\hbox to \d_strc_itemgroups_list_width{\ifconditional\c_strc_itemgroups_sub\llap{\enspace}\fi\box\b_strc_itemgroups\hss}}
1570 \hskip\scratchdimen}
1571
1572\def\strc_itemgroups_handle_lapped_item_positive
1573 {\llap
1574 {\dontcomplain
1575 \hbox to \d_strc_itemgroups_list_width
1576 {\ifconditional\c_strc_itemgroups_sub
1577 \dostarttagged\t!ignore\empty
1578 \llap{\enspace}
1579 \dostoptagged
1580 \fi
1581 \strc_itemgroups_left_sym_filler
1582 \box\b_strc_itemgroups
1583 \hfil
1584 \hskip\itemgroupparameter\c!distance}}}
1585
1586\def\strc_itemgroups_handle_lapped_item_negative
1587 {\llap
1588 {\ifconditional\c_strc_itemgroups_sub
1589 \dostarttagged\t!ignore\empty
1590 \llap{\enspace}
1591 \dostoptagged
1592 \fi
1593 \box\b_strc_itemgroups
1594 \hskip\leftmargindistance}}
1595
1596\def\strc_itemgroups_handle_groups_text_item
1597 {\hbox
1598 {\ifconditional\c_strc_itemgroups_sub
1599 \dostarttagged\t!ignore\empty
1600 \enspace
1601 \dostoptagged
1602 \fi
1603 \scratchwidth\wd\b_strc_itemgroups
1604 \box\b_strc_itemgroups
1605 \ifzerodim\scratchwidth\else
1606 \hskip\interwordspace
1607 \fi}
1608 \nobreak}
1609
1610\def\strc_itemgroups_handle_groups_inline_item
1611 {\hbox to \d_strc_itemgroups_list_width
1612 {\ifconditional\c_strc_itemgroups_sub
1613 \dostarttagged\t!ignore\empty
1614 \llap{\enspace}
1615 \dostoptagged
1616 \fi
1617 \box\b_strc_itemgroups
1618 \hss}}
1619
1620\protected\def\strc_itemgroups_start_head_sym#text
1621 {\def\strc_itemgroups_extra_symbol{#text}
1622 \c_strc_itemgroups_symbol\conditionaltrue
1623 \c_strc_itemgroups_head\conditionaltrue
1624
1625 \startitemgrouphead}
1626
1627\def\strc_itemgroups_make_symbol_box
1628 {\setbox\b_strc_itemgroups\autodirhbox
1629 {\ifconditional\c_strc_itemgroups_head
1630 \ifconditional\c_strc_itemgroups_symbol
1631 \strc_itemgroups_insert_extra_reference
1632 \useitemgroupstyleandcolor\c!symstyle\c!symcolor
1633 \strc_itemgroups_extra_symbol
1634 \else
1635 \useitemgroupstyleandcolor\c!headstyle\c!headcolor
1636 \strc_itemgroups_used_symbol
1637 \fi
1638 \else
1639 \ifconditional\c_strc_itemgroups_symbol
1640 \strc_itemgroups_insert_extra_reference
1641 \useitemgroupstyleandcolor\c!symstyle\c!symcolor
1642 \strc_itemgroups_extra_symbol
1643 \else
1644 \useitemgroupstyleandcolor\c!style\c!color
1645 \strc_itemgroups_used_symbol
1646 \fi
1647 \fi}
1648 \lettonothing\strc_itemgroups_extra_symbol
1649 \c_strc_itemgroups_symbol\conditionalfalse}
1650
1651\def\strc_itemgroups_make_fitting_box
1652 {\ifdim\wd\b_strc_itemgroups>\itemgroupparameter\c!maxwidth\relax
1653 \normalexpanded{\global\setitemgroupparameter{\c!maxwidth}{\the\wd\b_strc_itemgroups}}
1654 \fi
1655 \ifdim\d_strc_itemgroups_max_width>\zeropoint
1656 \setbox\b_strc_itemgroups\simplealignedbox
1657 {\dimexpr\d_strc_itemgroups_max_width\itemgroupparameter\c!distance\relax}
1658 {\itemgroupparameter\c!itemalign}
1659 {\box\b_strc_itemgroups\hskip\itemgroupparameter\c!distance}
1660 \fi}
1661
1662\def\strc_itemgroups_make_aligned_box
1663 {\ifempty{\itemgroupparameter\c!itemalign}\else
1664 \setbox\b_strc_itemgroups\simplealignedbox
1665 {\dimexpr\d_strc_itemgroups_asked_width\itemgroupparameter\c!distance\relax}
1666 {\itemgroupparameter\c!itemalign}
1667 {\box\b_strc_itemgroups\hskip\itemgroupparameter\c!distance}
1668 \fi}
1669
1670\def\strc_itemgroups_make_destination_box
1671 {\iftrialtypesetting \orelse \ifempty\m_strc_itemgroups_destination \else
1672 \setbox\b_strc_itemgroups\hbox{\directgotobox{\box\b_strc_itemgroups}[\m_strc_itemgroups_destination]}
1673 \fi}
1674
1675\def\strc_itemgroups_check_indenting
1676 {\c_strc_itemgroups_indented_first\conditionalfalse
1677 \ifempty\m_strc_itemgroups_indenting \else
1678 \normalexpanded{\setupindenting[\v!reset,\v!yes,\m_strc_itemgroups_indenting]}
1679 \ifconditional\c_spac_indentation_indent_first
1680 \ifcstok{\itemgroupparameter\c!alignsymbol}\v!yes\else
1681 \c_strc_itemgroups_indented_first\conditionaltrue
1682 \fi
1683 \fi
1684 \fi}
1685
1686\def\strc_itemgroups_check_for_repeated
1687 {\ifconditional\c_strc_itemgroups_repeat
1688 \ifempty\m_strc_itemgroups_repeat_start
1689 \edef\m_strc_itemgroups_repeat_start{\currentitemlevel}
1690 \fi
1691 \else
1692 \lettonothing\m_strc_itemgroups_repeat_start
1693 \fi}
1694
1695\newconditional\c_strc_itemgroups_ignore
1696
1697\noaligned\permanent\protected\def\startignoreditem
1698 {\global\c_strc_itemgroups_ignore\conditionaltrue
1699 \startitem}
1700
1701\noaligned\permanent\protected\def\stopignoreditem
1702 {\stopitem
1703 \global\c_strc_itemgroups_ignore\conditionalfalse}
1704
1705\def\strc_itemgroups_insert_item
1706 {\ifconditional\c_strc_itemgroups_text
1707
1708 \orelse\ifconditional\c_strc_itemgroups_no_par
1709
1710 \else
1711 \par
1712 \fi
1713 \iftrialtypesetting\else
1714 \global\advanceby\c_strc_itemgroups_n_of_items\plusone
1715 \fi
1716 \ifconditional\c_strc_itemgroups_ignore\else
1717 \strc_itemgroups_optimize_breaks
1718 \strc_itemgroups_check_indenting
1719 \dontleavehmode
1720 \ifconditional\c_strc_itemgroups_indented_first
1721 \hskip\parindent
1722 \fi
1723 \strc_itemgroups_make_symbol_box
1724 \strc_itemgroups_make_destination_box
1725 \ifconditional\c_strc_itemgroups_fitting
1726 \strc_itemgroups_make_fitting_box
1727 \orelse\ifdim\d_strc_itemgroups_asked_width>\zeropoint
1728 \strc_itemgroups_make_aligned_box
1729 \fi
1730 \lettonothing\m_strc_itemgroups_destination
1731 \ht\b_strc_itemgroups\strutheight
1732 \dp\b_strc_itemgroups\strutdepth
1733 \strc_itemgroups_check_for_repeated
1734 \ifdim\d_strc_itemgroups_asked_width<\zeropoint\relax
1735 \strc_itemgroups_handle_lapped_item_negative
1736 \else
1737 \ifzeropt\d_strc_itemgroups_asked_width
1738 \strc_itemgroups_calculate_list_width\plusone
1739 \else
1740 \strc_itemgroups_calculate_list_width\c_strc_itemgroups_nesting
1741 \fi
1742 \ifconditional\c_strc_itemgroups_text
1743 \strc_itemgroups_handle_groups_text_item
1744 \orelse\ifconditional\c_strc_itemgroups_inline
1745 \strc_itemgroups_handle_groups_inline_item
1746 \orelse\ifconditional\c_strc_itemgroups_txt
1747 \strc_itemgroups_handle_text_item
1748 \else
1749 \strc_itemgroups_handle_lapped_item_positive
1750 \fi
1751 \fi
1752 \c_strc_itemgroups_head\conditionalfalse
1753 \c_strc_itemgroups_sub\conditionalfalse
1754 \ifconditional\c_strc_itemgroups_indented_first
1755 \hskip\parindent
1756 \fi
1757 \fi
1758 \ignorepars}
1759
1760\def\strc_itemgroups_start_item_nop
1761 {\lettonothing\currentitemreference
1762 \strc_itemgroups_increment_item_counter
1763 \global\advanceby\c_strc_itemgroups_n_of_items\plusone
1764 \setbox\b_strc_itemgroups\hbox
1765 {\useitemgroupstyleandcolor\c!style\c!color
1766 \strc_itemgroups_used_symbol}
1767 \strc_itemgroups_check_for_repeated
1768 \ignorepars}
1769
1770\defcsname\??itemgroupdistance\v!none\endcsname
1771 {\let\m_strc_itemgroups_text_distance\zeropoint}
1772
1773\defcsname\??itemgroupdistance\v!space\endcsname
1774 {\def\m_strc_itemgroups_text_distance{\interwordspace\s!plus\interwordstretch\s!minus\interwordshrink}}
1775
1776\defcsname\??itemgroupdistance\endcsname
1777 {\let\m_strc_itemgroups_text_distance\zeropoint}
1778
1779\protected\def\strc_itemgroups_set_text_item_distance
1780 {\edef\m_strc_itemgroups_text_distance{\itemgroupparameter\c!textdistance}
1781 \ifempty\m_strc_itemgroups_text_distance
1782
1783 \orelse\ifcsname\??itemgroupdistance\m_strc_itemgroups_text_distance\endcsname
1784 \lastnamedcs
1785 \else
1786 \strc_itemgroups_set_text_item_distance_indeed
1787 \fi}
1788
1789\def\strc_itemgroups_set_text_item_distance_indeed
1790 {\assignvalue
1791 \m_strc_itemgroups_text_distance
1792 \m_strc_itemgroups_text_distance
1793 {.5\interwordspace\s!plus.5\emwidth}
1794 {\interwordspace \s!plus \emwidth}
1795 {\emwidth \s!plus \interwordstretch\s!minus\interwordshrink}}
1796
1797
1798
1799
1800
1801\protected\def\strc_itemgroups_default_command
1802 {\ignorepars}
1803
1804
1805
1806\protected\def\strc_itemgroups_head#text\par
1807 {\startitemgrouphead{#text}}
1808
1809
1810
1811\ifdefined\item \else \let\item \relax \fi
1812\ifdefined\sub \else \aliased\let\sub \relax \fi
1813\ifdefined\sym \else \aliased\let\sym \relax \fi
1814\ifdefined\ran \else \aliased\let\ran \relax \fi
1815\ifdefined\its \else \aliased\let\its \relax \fi
1816\ifdefined\mar \else \aliased\let\mar \relax \fi
1817\ifdefined\noitem \else \aliased\let\noitem \relax \fi
1818\ifdefined\itm \else \aliased\let\itm \relax \fi
1819\ifdefined\but \else \aliased\let\but \relax \fi
1820
1821\ifdefined\txt \else \aliased\let\txt \relax \fi
1822\ifdefined\head \else \let\head \relax \fi
1823\ifdefined\headsym \else \aliased\let\headsym \relax \fi
1824\ifdefined\startitem \else \let\startitem \relax \fi
1825\ifdefined\stopitem \else \aliased\let\stopitem \relax \fi
1826\ifdefined\starthead \else \aliased\let\starthead \relax \fi
1827\ifdefined\stophead \else \aliased\let\stophead \relax \fi
1828\ifdefined\startspecialitem \else \aliased\let\startspecialitem\relax \fi
1829\ifdefined\stopspecialitem \else \aliased\let\stopspecialitem \relax \fi
1830
1831\appendtoks
1832 \enforced\let\item \strc_itemgroups_start_do_item
1833 \enforced\let\sub \strc_itemgroups_start_subitem
1834 \enforced\let\sym \strc_itemgroups_start_symbol
1835 \enforced\let\ran \strc_itemgroups_start_edge
1836 \enforced\let\its \strc_itemgroups_start_items
1837 \enforced\let\mar \strc_itemgroups_start_margin
1838 \enforced\let\noitem \strc_itemgroups_start_no_item
1839 \enforced\let\itm \strc_itemgroups_start_do_item
1840 \enforced\let\but \strc_itemgroups_start_button
1841 \enforced\let\nop \strc_itemgroups_start_dummy
1842 \enforced\let\txt \strc_itemgroups_start_text
1843 \enforced\let\head \strc_itemgroups_head
1844 \enforced\let\headsym \strc_itemgroups_start_head_sym
1845 \enforced\let\startitem \startitemgroupitem
1846 \enforced\let\stopitem \stopitemgroupitem
1847 \enforced\let\starthead \startitemgrouphead
1848 \enforced\let\stophead \stopitemgrouphead
1849 \enforced\let\startspecialitem\startspecialitemgroupitem
1850 \enforced\let\stopspecialitem \stopspecialitemgroupitem
1851\to \itemgroupcommands
1852
1853\ifx\currentinterface \s!english \else
1854
1855 \def\next#1#2{\ifcsname#1\endcsname\else\enforced\aliased\letcsname#1\endcsname#2\fi}
1856
1857 \etoksapp\itemgroupcommands{
1858 \next{\v!item }\strc_itemgroups_start_do_item
1859 \next{\v!sub }\strc_itemgroups_start_subitem
1860 \next{\v!sym }\strc_itemgroups_start_symbol
1861 \next{\v!ran }\strc_itemgroups_start_edge
1862 \next{\v!head }\strc_itemgroups_head
1863 \next{\v!its }\strc_itemgroups_start_items
1864 \next{\v!mar }\strc_itemgroups_start_margin
1865 \next{\v!txt }\strc_itemgroups_start_text
1866 \next{\e!start\v!item}\startitemgroupitem
1867 \next{\e!stop \v!item}\stopitemgroupitem
1868 \next{\e!start\v!head}\startitemgrouphead
1869 \next{\e!stop \v!head}\stopitemgrouphead
1870 }
1871
1872
1873
1874\fi
1875
1876\relaxvalueifundefined \v!item
1877\relaxvalueifundefined \v!sub
1878\relaxvalueifundefined \v!sym
1879\relaxvalueifundefined \v!ran
1880\relaxvalueifundefined \v!head
1881\relaxvalueifundefined \v!its
1882\relaxvalueifundefined \v!mar
1883\relaxvalueifundefined \v!txt
1884\relaxvalueifundefined {\e!start\v!item}
1885\relaxvalueifundefined {\e!stop \v!item}
1886\relaxvalueifundefined {\e!start\v!head}
1887\relaxvalueifundefined {\e!stop \v!head}
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912\newinteger\c_strc_itemgroups_collected_stored
1913\newinteger\c_strc_itemgroups_collected_done
1914\newinteger\c_strc_itemgroups_collected_current
1915
1916\let\strc_itemgroups_collected_store\relax
1917
1918\lettonothing\m_strc_itemgroups_collected
1919
1920\normalexpanded{\def\strc_itemgroups_collected_store#1\csname\e!stop\v!item\endcsname}
1921 {\advanceby\c_strc_itemgroups_collected_stored\plusone
1922 \defcsname\??itemgroupstack\the\c_strc_itemgroups_collected_stored\endcsname
1923 {\startitemgroupitem#1\stopitemgroupitem}}
1924
1925\def\strc_itemgroups_collected_flush_randomize
1926 {\m_strc_itemgroups_collected}
1927
1928\def\strc_itemgroups_collected_flush_horizontal
1929 {\begingroup
1930 \scratchcounter\itemgroupparameter\c!n\relax
1931 \ifnum\c_strc_itemgroups_collected_done>\plusone
1932 \ifcase\modulonumber\scratchcounter\c_strc_itemgroups_collected_done\relax
1933
1934 \hfill
1935 \allowbreak
1936 \fi
1937 \fi
1938 \noindent
1939 \hbox to \dimexpr\availablehsize\scratchcounter\relax{\m_strc_itemgroups_collected\hss}
1940 \endgroup}
1941
1942\def\strc_itemgroups_collected_flush_indeed
1943 {\m_strc_itemgroups_collected
1944 \letcsname\??itemgroupstack\the\c_strc_itemgroups_collected_current\endcsname\undefined}
1945
1946\def\strc_itemgroups_collected_flush
1947 {\ifconditional\c_strc_itemgroups_randomize
1948 \getrandomcount\c_strc_itemgroups_collected_current\plusone\c_strc_itemgroups_collected_stored
1949 \else
1950 \advanceby\c_strc_itemgroups_collected_current\plusone
1951 \fi
1952 \ifcsname\??itemgroupstack\the\c_strc_itemgroups_collected_current\endcsname
1953 \edef\m_strc_itemgroups_collected{\lastnamedcs}
1954 \ifconditional\c_strc_itemgroups_horizontal
1955 \strc_itemgroups_collected_flush_horizontal
1956 \else
1957 \strc_itemgroups_collected_flush_indeed
1958 \fi
1959 \advanceby\c_strc_itemgroups_collected_done\plusone
1960 \fi
1961 \ifnum\c_strc_itemgroups_collected_done<\c_strc_itemgroups_collected_stored
1962 \expandafter\strc_itemgroups_collected_flush
1963 \fi}
1964
1965\protected\permanent\def\stopcollectitems
1966 {\ifconditional\c_strc_itemgroups_collecting
1967 \c_strc_itemgroups_collected_done \zerocount
1968 \c_strc_itemgroups_collected_current\zerocount
1969 \ifnum\c_strc_itemgroups_collected_stored>\zerocount
1970 \ifconditional\c_strc_itemgroups_horizontal
1971 \strc_itemgroups_before_command
1972 \c_strc_itemgroups_first\conditionalfalse
1973 \strc_itemgroups_collected_flush
1974
1975 \else
1976 \strc_itemgroups_collected_flush
1977 \fi
1978 \fi
1979 \fi}
1980
1981\protected\permanent\def\startcollectitems
1982 {\ifconditional\c_strc_itemgroups_collecting
1983 \c_strc_itemgroups_collected_stored\zerocount
1984 \enforced\letcsname\e!start\v!item\endcsname\strc_itemgroups_collected_store
1985 \fi}
1986
1987
1988
1989\permanent\protected\def\item
1990 {\strc_itemgroups_item_alone}
1991
1992\tolerant\def\strc_itemgroups_item_alone[#category]#:#text\par
1993 {\ifempty{#category}
1994 \startitemgroup[\v!itemize]
1995 \else
1996 \startitemgroup[#category]
1997 \fi
1998 \startitem#text\stopitem
1999 \stopitemgroup}
2000
2001\permanent\protected\def\head
2002 {\strc_itemgroups_head_alone}
2003
2004\def\strc_itemgroups_head_alone[#category]#head\par#body\par
2005 {\ifempty{#category}
2006 \startitemgroup[\v!itemize]
2007 \else
2008 \startitemgroup[#category]
2009 \fi
2010 \starthead{#head}#body\stophead
2011 \stopitemgroup}
2012
2013\pushoverloadmode
2014
2015\permanent\protected\defcsname\e!start\v!item\endcsname
2016 {\startitemgroup[\v!itemize]
2017 \startitemgroupitem
2018 \enforced\letcsname\e!stop\v!item\endcsname\strc_itemgroups_stop_item}
2019
2020\aliased\letcsname\e!stop\v!item\endcsname\relax
2021
2022\permanent\protected\def\strc_itemgroups_stop_item
2023 {\stopitemgroupitem
2024 \stopitemgroup}
2025
2026\popoverloadmode
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040\permanent\tolerant\protected\def\itemtag[#reference]
2041 {
2042 \def\currentitemreference{#reference}
2043 \iftrialtypesetting
2044 \strc_counters_save\v_strc_itemgroups_counter
2045 \strc_itemgroups_increment_item_counter
2046 \strc_itemgroups_insert_item_tag_indeed
2047 \strc_counters_restore\v_strc_itemgroups_counter
2048 \else
2049 \strc_itemgroups_increment_item_counter
2050 \strc_itemgroups_insert_item_tag_indeed
2051 \fi}
2052
2053\def\strc_itemgroups_insert_item_tag_indeed
2054 {\letitemgroupparameter\c!distance\zeropoint
2055
2056 \strc_itemgroups_make_symbol_box
2057 \strc_itemgroups_make_destination_box
2058 \lettonothing\m_strc_itemgroups_destination
2059 \ht\b_strc_itemgroups\strutheight
2060 \dp\b_strc_itemgroups\strutdepth
2061 \box\b_strc_itemgroups
2062 \ignorepars}
2063
2064
2065
2066\newdimension\d_strc_itemgroups_inbetween_table
2067\newdimension\d_strc_itemgroups_column_distance
2068\newdimension\d_strc_itemgroups_column_width
2069
2070\def\strc_itemgroups_table_begin
2071 {\NC}
2072
2073\def\strc_itemgroups_table_end_row
2074 {\NR
2075 \ifzerodim\d_strc_itemgroups_inbetween_table\orelse\ifnum
2076 \numexpression
2077 \c_strc_itemgroups_n_of_items\c_strc_itemgroups_columns
2078 \relax<\numexpression
2079 \c_strc_itemgroups_max_items \c_strc_itemgroups_columns
2080 \relax
2081 \noalign{\m_strc_itemgroups_inbetween}
2082
2083 \fi}
2084
2085\noaligned\def\strc_itemgroups_table_end
2086 {\ifcase\numexpression\c_strc_itemgroups_n_of_items mod \c_strc_itemgroups_columns\relax
2087 \expandafter\strc_itemgroups_table_end_row
2088 \fi}
2089
2090\protected\def\strc_itemgroups_table_wrapup
2091 {\iftrialtypesetting\orelse\ifcase\c_tabl_tabulate_column\else
2092 \beginlocalcontrol
2093 \expandafter\endlocalcontrol\expandedloop
2094 \numexpr\c_tabl_tabulate_column\plusone\relax
2095 \c_tabl_tabulate_nofcolumns
2096 \plusone
2097 {\startignoreditem\strut\stopignoreditem}
2098 \fi}
2099
2100\let\strc_itemgroups_table_pickup\relax
2101
2102\setupitemgroup[\c!columndistance=\emwidth]
2103
2104\lettonothing\m_strc_itemgroups_after
2105\lettonothing\m_strc_itemgroups_inbetween
2106
2107\tolerant\permanent\protected\def\strc_itemgroups_start_table[#1]#*[#S#2]#*[#S#3]
2108 {\ifcase\currentitemlevel\relax
2109 \startitemgroup[#1][#2][#3]
2110 \itemgroupparameter\c!before
2111 \orelse\ifhmode
2112 \strut
2113 \startitemgroup[#1][#2][#3]
2114 \ifconditional\c_strc_itemgroups_overlay
2115 \blank[\v!overlay]
2116 \else
2117 \itemgroupparameter\c!before
2118 \fi
2119 \else
2120 \startitemgroup[#1][#2][#3]
2121 \itemgroupparameter\c!before
2122 \fi
2123 \edef\m_strc_itemgroups_after {\itemgroupparameter\c!after}
2124 \edef\m_strc_itemgroups_inbetween{\itemgroupparameter\c!inbetween}
2125 \setbox\scratchbox\vbox{\m_strc_itemgroups_inbetween}
2126 \d_strc_itemgroups_inbetween_table\htdp\scratchbox
2127 \letitemgroupparameter\c!before\relax
2128 \letitemgroupparameter\c!after\relax
2129 \letitemgroupparameter\c!inbetween\relax
2130 \c_strc_itemgroups_columns\itemgroupparameter\c!n
2131 \let\strc_itemgroups_begin\strc_itemgroups_table_begin
2132 \let\strc_itemgroups_end \strc_itemgroups_table_end
2133
2134
2135
2136 \scratchdistance\itemgroupparameter\c!columndistance
2137 \d_strc_itemgroups_column_distance\dimexpr\leftskip\rightskip\relax
2138 \d_strc_itemgroups_column_width\hsize
2139 \c_strc_itemgroups_no_par\conditionaltrue
2140 \advanceby\d_strc_itemgroups_column_width \c_strc_itemgroups_columns\d_strc_itemgroups_column_distance
2141 \divideby \d_strc_itemgroups_column_width \c_strc_itemgroups_columns
2142 \advanceby\d_strc_itemgroups_column_distance \scratchdistance
2143 \advanceby\d_strc_itemgroups_column_width \scratchdistance
2144 \advanceby\d_strc_itemgroups_column_width \dimexpr\scratchdistance\c_strc_itemgroups_columns\relax
2145
2146 \c_strc_itemgroups_optimize\zerocount
2147
2148 \normalexpanded{\strc_itemgroups_table_bootstrap
2149 \csname\e!start#1\v!table\endcsname
2150 \csname\e!stop #1\v!table\endcsname
2151 {\expandedrepeat \c_strc_itemgroups_columns {p(\the\d_strc_itemgroups_column_width)l}}}}
2152
2153\protected\def\strc_itemgroups_table_bootstrap#1#2#3
2154 {\protected\def\strc_itemgroups_table_pickup##L#1##R#2##1
2155 {\tabl_tabulate_disable_tagging
2156 \starttabulate[#3][\c!before=,\c!after=,\c!split=\v!no,\c!unit=\the\d_strc_itemgroups_column_distance]
2157 ##1\relax\strc_itemgroups_table_wrapup
2158 \stoptabulate
2159 \normalexpanded{\stopitemgroup\m_strc_itemgroups_after}}
2160 \strc_itemgroups_table_pickup}
2161
2162\appendtoks
2163 \frozen\instance\protected\edefcsname\e!stop \currentitemgroup\v!table\endcsname
2164 {}
2165 \frozen\instance\protected\edefcsname\e!start\currentitemgroup\v!table\endcsname
2166 {\strc_itemgroups_start_table[\currentitemgroup]}
2167\to \everydefineitemgroup
2168
2169
2170
2171\setupitemgroup
2172 [\c!margin=\zeropoint,
2173 \c!leftmargin=\zeropoint,
2174 \c!rightmargin=\zeropoint,
2175 \c!leftmargindistance=\zeropoint,
2176 \c!rightmargindistance=\zeropoint,
2177 \c!indentnext=\v!yes,
2178 \c!width=1.5\emwidth,
2179 \c!factor=0,
2180
2181 \c!step=.5\emwidth,
2182 \c!distance=\zeropoint,
2183
2184
2185
2186
2187
2188 \c!marstyle=\v!type,
2189
2190
2191
2192
2193
2194
2195 \c!symcolor=\itemgroupparameter\c!color,
2196 \c!symstyle=\itemgroupparameter\c!style,
2197 \c!afterhead=\blank,
2198 \c!before=\blank,
2199 \c!inbetween=\blank,
2200 \c!after=\blank,
2201
2202 \c!placestopper=\v!yes,
2203 \c!stopper=.,
2204
2205 \c!n=2,
2206 \c!items=4,
2207 \c!levels=10,
2208 \c!lefttext=(,
2209 \c!righttext=),
2210 \c!start=1,
2211 \c!packcriterium=\zerocount,
2212 \c!criterium=\v!all,
2213
2214 \c!textdistance=\v!space,
2215 \c!lasttextseparator=\itemgroupparameter\c!textseparator,
2216
2217 \c!command=\strc_itemgroups_default_command,
2218 \c!indenting=\v!next,
2219
2220 \c!symbol=\currentitemlevel,
2221 \c!prefix=\v!no,
2222
2223
2224
2225
2226
2227
2228 \c!prefixconnector=.,
2229 \c!numberseparatorset=,
2230 \c!numberconversionset=,
2231 \c!numberstopper=.,
2232 \c!numbersegments=1]
2233
2234\defineitemgroup
2235 [\v!itemize]
2236
2237
2238
2239
2240
2241
2242
2243\defineitemgroup
2244 [\v!itemize:\v!note]
2245
2246\def\strc_itemgroups_push
2247 {\edef\strc_itemgroups_pop
2248 {\xdef\noexpand\currentitemlevel{\currentitemlevel}
2249 \global\c_strc_itemgroups_nesting \the\c_strc_itemgroups_nesting \relax
2250 \global\c_strc_itemgroups_column_depth\the\c_strc_itemgroups_column_depth\relax}
2251 \global\c_strc_itemgroups_column_depth\zerocount
2252 \global\c_strc_itemgroups_nesting \zerocount
2253 \glet\currentitemlevel\!!zerocount
2254 \enforced\permanent\protected\def\startitemize{\startitemgroup[\v!itemize:\v!note]}
2255 \enforced\permanent\protected\def\stopitemize {\stopitemgroup}}
2256
2257\let\strc_itemgroups_pop\relax
2258
2259\protect \endinput
2260 |