1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus
{
loading
}{
ConTeXt
Table
Macros
Tabulation
}
15
16\unprotect
17
18\registerctxluafile
{
tabl
tbl
}{}
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149\newtoks
\t_tabl_tabulate_preamble
150\newtoks
\t_tabl_tabulate_before
151\newtoks
\t_tabl_tabulate_after
152\newtoks
\t_tabl_tabulate_bmath
153\newtoks
\t_tabl_tabulate_emath
154\newtoks
\t_tabl_tabulate_font
155\newtoks
\t_tabl_tabulate_settings
156\newtoks
\t_tabl_tabulate_dummy
157\newtoks
\t_tabl_tabulate_every_row
158\newtoks
\t_tabl_tabulate_every_after_row
159\newtoks
\t_tabl_tabulate_every_real_row
160
161\newtoks
\t_tabl_tabulate_initializers_first
162\newtoks
\t_tabl_tabulate_initializers_second
163
164\newcount
\c_tabl_tabulate_nofauto
165\newcount
\c_tabl_tabulate_columns
166\newcount
\c_tabl_tabulate_column
167\newcount
\c_tabl_tabulate_plines_min
168\newcount
\c_tabl_tabulate_plines_max
169\newcount
\c_tabl_tabulate_max_colorcolumn
170\newcount
\c_tabl_tabulate_max_vrulecolumn
171\newcount
\c_tabl_tabulate_repeathead
172\newcount
\c_tabl_tabulate_noflines
173\newcount
\c_tabl_tabulate_totalnoflines
174\newcount
\c_tabl_tabulate_minusnoflines
175\newcount
\c_tabl_tabulate_align
176\newcount
\c_tabl_tabulate_nofrealrows
177\newcount
\c_tabl_tabulate_autocolor
178
179\newcount
\c_tabl_tabulate_nofcolumns
180\newcount
\c_tabl_tabulate_has_rule_spec_first
181\newcount
\c_tabl_tabulate_has_rule_spec_last
182
183\newconditional
\c_tabl_tabulate_nopbreak
184\newconditional
\c_tabl_tabulate_firstflushed
185\newconditional
\c_tabl_tabulate_equal
186\newconditional
\c_tabl_tabulate_split
\settrue
\c_tabl_tabulate_split
187\newconditional
\c_tabl_tabulate_automode
188\newconditional
\c_tabl_tabulate_handlepbreak
\settrue
\c_tabl_tabulate_handlepbreak
189\newconditional
\c_tabl_tabulate_autorulespacing
\settrue
\c_tabl_tabulate_autorulespacing
190\newconditional
\c_tabl_tabulate_someamble
191\newconditional
\c_tabl_tabulate_tolerant_break
192\newconditional
\c_tabl_tabulate_splitoff_whitespace
193\newconditional
\c_tabl_tabulate_pwidth_set
194\newconditional
\c_tabl_tabulate_reshape
195
196\newdimen
\d_tabl_tabulate_width_p
197\newdimen
\d_tabl_tabulate_width_w
198\newdimen
\d_tabl_tabulate_width
199\newdimen
\d_tabl_tabulate_unit
200\newdimen
\d_tabl_tabulate_height_p_max
201\newdimen
\d_tabl_tabulate_vrulethickness_default
202\newdimen
\d_tabl_tabulate_hrulethickness_default
203\newdimen
\d_tabl_tabulate_vrulethickness
204\newdimen
\d_tabl_tabulate_hrulethickness
205\newdimen
\d_tabl_tabulate_vrulethickness_local
206\newdimen
\d_tabl_tabulate_hrulethickness_local
207\newdimen
\d_tabl_tabulate_indent
208\newdimen
\d_tabl_tabulate_splitoff_betweenskip
209\newdimen
\d_tabl_tabulate_margin
210
211\newskip
\s_tabl_tabulate_pre
212\newskip
\s_tabl_tabulate_post
213\newskip
\s_tabl_tabulate_first
214\newskip
\s_tabl_tabulate_last
215\newskip
\s_tabl_tabulate_separator
216
217\newbox
\b_tabl_tabulate
218
219\newconstant
\c_tabl_tabulate_pass
220\newconstant
\c_tabl_tabulate_type
221\newconstant
\c_tabl_tabulate_kind
222\newconstant
\c_tabl_tabulate_splitlinemode
\c_tabl_tabulate_splitlinemode
\plusone
223\newconstant
\c_tabl_tabulate_colorspan
224\newconstant
\c_tabl_tabulate_localcolorspan
225\newconstant
\c_tabl_tabulate_modus
226
227\let
\tabulatesplitlinemode
\c_tabl_tabulate_splitlinemode
228
229\let
\m_tabl_tabulate_separator_factor
\empty
230
231\newtoks
\everytabulatepar
232\newtoks
\everytabulate
233
234\unexpanded
\def
\tolerantTABLEbreaktrue
{
\settrue
\c_tabl_tabulate_tolerant_break
}
235\unexpanded
\def
\handletabulatepbreakfalse
{
\setfalse
\c_tabl_tabulate_handlepbreak
}
236
237\def
\noftabulaterows
{
\number
\c_tabl_tabulate_noflines
}
238
239\installcorenamespace
{
tabulatebox
}
240\installcorenamespace
{
tabulatesetup
}
241\installcorenamespace
{
tabulatehook
}
242\installcorenamespace
{
tabulatesplit
}
243\installcorenamespace
{
tabulateseparator
}
244\installcorenamespace
{
tabulatecolor
}
245\installcorenamespace
{
tabulateheader
}
246\installcorenamespace
{
tabulatealigning
}
247\installcorenamespace
{
tabulatepreamble
}
248\installcorenamespace
{
tabulatevrule
}
249
250\installcorenamespace
{
tabulatehead
}
251\installcorenamespace
{
tabulatefoot
}
252\installcorenamespace
{
tabulatenext
}
253
254\prependtoks
255 \global
\c_tabl_tabulate_nofrealrows
\zerocount
256\to
\t_tabl_tabulate_initializers_first
257
258\prependtoks
259 \global
\c_tabl_tabulate_nofrealrows
\zerocount
260\to
\t_tabl_tabulate_initializers_second
261
262\prependtoks
263 \global\advance
\c_tabl_tabulate_nofrealrows
\plusone
264\to
\t_tabl_tabulate_every_real_row
265
266\def
\b_tabl_tabulate_current
#
1
267 {
\csname
\??tabulatebox
\number
#
1
\endcsname
}
268
269\def
\tabl_tabulate_initialize_boxes
#
1
270 {
\scratchcounter
#
1
\relax
271 \tabl_tabulate_initialize_boxes_step
}
272
273\def
\tabl_tabulate_initialize_boxes_step
274 {
\ifnum
\scratchcounter
>
\zerocount
275 \tabl_tabulate_initialize_box
\scratchcounter
276 \advance
\scratchcounter
\minusone
277 \expandafter
\tabl_tabulate_initialize_boxes_step
278 \fi
}
279
280\def
\tabl_tabulate_initialize_box
#
1
281 {
\ifcsname
\??tabulatebox
\number
#
1
\endcsname
282 \tabl_tabulate_initialize_box_yes
283 \else
284 \tabl_tabulate_initialize_box_nop
#
1
285 \fi
}
286
287\def
\tabl_tabulate_initialize_box_yes
{
\global
\setbox\lastnamedcs
\emptybox
}
288\def
\tabl_tabulate_initialize_box_nop
#
1
{
\expandafter
\newbox
\csname
\??tabulatebox
\number
#
1
\endcsname
}
289
290\tabl_tabulate_initialize_boxes
{
1
6
}
291
292\let
\initializetablebox
\tabl_tabulate_initialize_box
293\let
\initializetableboxes
\tabl_tabulate_initialize_boxes
294\let
\tablebox
\b_tabl_tabulate_current
295
296
297
298
299
300
301
302\def
\tabulatenoalign
303 {
\noalign
304 \bgroup
305 \let\noalign\relax
306 \let
\tabulatenoalign
\relax
307 \let
\next
=
}
308
309\def
\starttabulatenoalign
310 {
\tabulatenoalign
\bgroup
}
311
312\let
\stoptabulatenoalign
\egroup
313
314
315
316\def
\tabl_tabulate_nobreak_inject_tracer
317 {
\red
318 \hrule
\s!height
.
5
\linewidth
\s!depth
.
5
\linewidth
319 \par
320 \kern
\linewidth
321 \tabl_tabulate_break_no
}
322
323\installtextracker
324 {
tables
.
tabulate
.
breaks
}
325 {
\let
\tabl_tabulate_break_no_tracer
\tabl_tabulate_nobreak_inject_tracer
}
326 {
\let
\tabl_tabulate_break_no_tracer
\donothing
}
327
328\let
\tabl_tabulate_break_no_tracer
\donothing
329
330\def
\tabl_tabulate_nobreak_inject_indeed
331 {
\tabl_tabulate_break_no
332 \tabl_tabulate_break_no_tracer
}
333
334\def
\tabl_tabulate_nobreak_inject
335 {
\tabulatenoalign
{
\tabl_tabulate_nobreak_inject_indeed
}}
336
337\unexpanded
\def
\tabl_tabulate_hook_check
338 {
\ifnum
\c_tabl_tabulate_type
<
\plustwo
339 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_nop
340 \else
341 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
342 \fi
}
343
344\unexpanded
\def
\tabl_tabulate_setups_check
345 {
\begincsname
\??tabulatesetup
\the
\c_tabl_tabulate_column
\endcsname
}
346
347\unexpanded
\def
\tabl_tabulate_entry_before
{
\ignorespaces
\tabl_tabulate_hook
}
348\unexpanded
\def
\tabl_tabulate_entry_after
{
\unskip\unskip\ifmmode\else
\endgraf
\fi
}
349
350\unexpanded
\def
\tabl_tabulate_shaped_par_begin
351 {
\dowithnextboxcs
\tabl_tabulate_shaped_par_finish
\vbox
\bgroup
}
352
353\def
\tabl_tabulate_shaped_par_finish
354 {
\clf_doreshapeframedbox
\nextbox
\relax
355 \ifvmode
\unvbox\else\box\fi
\nextbox
}
356
357\let
\tabl_tabulate_shaped_par_end
\egroup
358
359\ifdefined
\dotagtabulatecell
\else
\let
\dotagtabulatecell
\relax
\fi
360\ifdefined
\dotagtabulatesignal
\else
\let
\dotagtabulatesignal
\relax
\fi
361
362\unexpanded
\def
\tabl_tabulate_check_local_color_first
#
1
#
2
363 {
\relax
}
364
365\unexpanded
\def
\tabl_tabulate_check_local_color_second
#
1
#
2
366 {
\relax
367 \ifx
\m_tabl_tabulate_color_local
\empty
368 \xdef
\m_tabl_tabulate_color
{
#
1
}
369 \else
370 \glet
\m_tabl_tabulate_color
\m_tabl_tabulate_color_local
371 \glet
\m_tabl_tabulate_color_local
\empty
372 \fi
373 \ifcase
\c_tabl_tabulate_localcolorspan
374 \global
\c_tabl_tabulate_colorspan
#
2
\relax
375 \else
376 \global
\c_tabl_tabulate_colorspan
\c_tabl_tabulate_localcolorspan
377 \global
\c_tabl_tabulate_localcolorspan
\zerocount
378 \fi
}
379
380\unexpanded
\def
\tabl_tabulate_check_local_vrule_thickness
#
1
381 {
\relax
382 \ifcase
\d_tabl_tabulate_vrulethickness_local
383 \global
\d_tabl_tabulate_vrulethickness
#
1
\relax
384 \else
385 \global
\d_tabl_tabulate_vrulethickness
\d_tabl_tabulate_vrulethickness_local
386 \global
\d_tabl_tabulate_vrulethickness_local
\zeropoint
387 \fi
}
388
389\unexpanded
\def
\tabl_tabulate_check_local_vrule_color_first
#
1
390 {
\relax
}
391
392\unexpanded
\def
\tabl_tabulate_check_local_vrule_color_second
#
1
393 {
\relax
394 \ifx
\m_tabl_tabulate_vrule_color_local
\empty
395 \xdef
\m_tabl_tabulate_vrule_color
{
#
1
}
396 \else
397 \glet
\m_tabl_tabulate_vrule_color
\m_tabl_tabulate_vrule_color_local
398 \glet
\m_tabl_tabulate_vrule_color_local
\empty
399 \fi
}
400
401\let
\tabl_tabulate_check_local_color
\gobbletwoarguments
402\let
\tabl_tabulate_check_local_vrule_color
\gobbleoneargument
403
404\appendtoks
405 \let
\tabl_tabulate_check_local_color
\tabl_tabulate_check_local_color_first
406 \let
\tabl_tabulate_check_local_vrule_color
\tabl_tabulate_check_local_vrule_color_first
407\to
\t_tabl_tabulate_initializers_first
408
409\appendtoks
410 \let
\tabl_tabulate_check_local_color
\tabl_tabulate_check_local_color_second
411 \let
\tabl_tabulate_check_local_vrule_color
\tabl_tabulate_check_local_vrule_color_second
412\to
\t_tabl_tabulate_initializers_second
413
414
415\def
\tabl_tabulate_inject_pre_skip
#
1
416 {
\ifdim
#
1
>
\zeropoint
417 \kern
#
1
\relax
418 \else\ifnum
\c_tabl_tabulate_column
=
\zerocount
419 \ifconditional
\c_tabl_tabulate_autorulespacing
420 \ifcase
\c_tabl_tabulate_has_rule_spec_first
\else
421 \kern
\s_tabl_tabulate_first
\relax
422 \fi
423 \fi
424 \fi\fi
}
425
426
427\def
\tabl_tabulate_inject_post_skip
#
1
428 {
\ifdim
#
1
>
\zeropoint
429 \kern
#
1
\relax
430 \else\ifnum
\c_tabl_tabulate_columns
=
\c_tabl_tabulate_nofcolumns
431 \ifconditional
\c_tabl_tabulate_autorulespacing
432 \ifcase
\c_tabl_tabulate_has_rule_spec_last
\else
433 \kern
\s_tabl_tabulate_last
\relax
434 \fi
435 \fi
436 \fi\fi
}
437
438\let
\tabl_tabulate_hook_b
\donothing
439\let
\tabl_tabulate_hook_e
\donothing
440
441\let
\tabl_tabulate_hook_g
\donothing
442
443\def
\tabl_tabulate_set_preamble_step
#
1
#
2
444 {
\etoksapp
\t_tabl_tabulate_preamble
{
445 \tabl_tabulate_check_local_vrule_thickness
\constantdimenargument
\d_tabl_tabulate_vrulethickness
446 \tabl_tabulate_check_local_vrule_color
\constantemptyargument
\m_tabl_tabulate_vrule_color
447 \tabl_tabulate_check_local_color
\constantemptyargument
\m_tabl_tabulate_color
\constantnumberargument
\c_tabl_tabulate_colorspan
448 \tabl_tabulate_color_side_right
449 \aligntab
450 \tabl_tabulate_column_vrule_inject
451 \tabl_tabulate_color_side_left
452 \tabl_tabulate_inject_pre_skip
{
\the\dimexpr
\s_tabl_tabulate_pre
}
453 \alignmark\alignmark
454 \aligntab
455 \tabl_tabulate_color_side_both
456 \global
\c_tabl_tabulate_colorspan
\zerocount
457 \global
\c_tabl_tabulate_column
\constantnumber
\c_tabl_tabulate_columns
458 \tabl_tabulate_hook_g
459 \tabl_tabulate_setups_check
460 \tabl_tabulate_hook_check
461 \ifzeropt
\d_tabl_tabulate_width
462 \ifcase
\c_tabl_tabulate_modus
\else
463 \settrue
\c_tabl_tabulate_automode
464 \fi
465 \else
466 \ifcase
\c_tabl_tabulate_modus
467 \hbox
to
468 \else
469 \hsize
470 \fi
471 \the
\d_tabl_tabulate_width
472 \fi
473 \bgroup
474 \tabl_tabulate_bbskip
475 \bgroup
476 \tabl_tabulate_hook_b
477 \c_tabl_tabulate_align
\constantnumber
\c_tabl_tabulate_align
478 \ifx
\m_tabl_tabulate_alignment
\empty
\else
479 \spac_align_use_now
{
\m_tabl_tabulate_alignment
}
480 \fi
481 \noexpand
\dostarttagged
\noexpand
\t!tabulatecell
\noexpand
\empty
482 \noexpand
\dotagtabulatecell
483 \noexpand
#
1
484 \ifconditional
\c_tabl_tabulate_reshape
485 \tabl_tabulate_shaped_par_begin
486 \fi
487 \dotagtabulatesignal
488 \noexpand\ifnum\noexpand
\c_tabl_tabulate_type
=
\plusone
\noexpand\else
489 \the
\t_tabl_tabulate_bmath
490 \the
\t_tabl_tabulate_font
491 \the
\t_tabl_tabulate_settings
492 \the
\t_tabl_tabulate_before
493 \ifx
\m_tabl_tabulate_text_color
\empty
494 \expandafter
\gobbleoneargument
495 \else
496 \expandafter
\dofastcoloractivation
497 \fi
\m_tabl_tabulate_text_color
498 \noexpand\fi
499
500
501 \bgroup
502 \tabl_tabulate_entry_before
503 \alignmark\alignmark
504 \tabl_tabulate_entry_after
505 \egroup
506 \noexpand\ifnum\noexpand
\c_tabl_tabulate_type
=
\plusone
\noexpand\else
507 \the
\t_tabl_tabulate_after
508 \the
\t_tabl_tabulate_emath
509 \noexpand\fi
510 \ifconditional
\c_tabl_tabulate_reshape
511 \tabl_tabulate_shaped_par_end
512 \fi
513 \noexpand
#
2
514 \tabl_tabulate_hook_e
515 \egroup
516 \egroup
517 \aligntab
518 \noexpand
\dostoptagged
519 \tabl_tabulate_inject_post_skip
{
\the\dimexpr
\s_tabl_tabulate_post
}
520 \alignmark\alignmark
521 }
522 \toksapp
\t_tabl_tabulate_dummy
{
\NC
}
523 \s_tabl_tabulate_pre
.
5
\d_tabl_tabulate_unit
\relax
524 \ifnum
\c_tabl_tabulate_columns
<
\numexpr
\c_tabl_tabulate_nofcolumns
\plusone
\relax
525 \s_tabl_tabulate_post
\s_tabl_tabulate_pre
526 \else
527 \s_tabl_tabulate_post
\zeropoint
528 \fi
529
530 \d_tabl_tabulate_width
\zeropoint
}
531
532\unexpanded
\def
\installtabulatepreambleoption
#
1
#
2
533 {
\setvalue
{
\??tabulatepreamble
\string
#
1
}{
#
2
}}
534
535\installtabulatepreambleoption
{
x
}{
\c_tabl_tabulate_align
\zerocount
536 \tabl_tabulate_set_preamble
}
537\installtabulatepreambleoption
{
l
}{
\c_tabl_tabulate_align
\plusone
538 \tabl_tabulate_set_preamble
}
539\installtabulatepreambleoption
{
r
}{
\c_tabl_tabulate_align
\plustwo
540 \tabl_tabulate_set_preamble
}
541\installtabulatepreambleoption
{
c
}{
\c_tabl_tabulate_align
\plusthree
542 \tabl_tabulate_set_preamble
}
543\installtabulatepreambleoption
{
p
}{
\tabl_tabulate_set_paragraph
}
544\installtabulatepreambleoption
{
s
}{
\tabl_tabulate_set_setups
}
545\installtabulatepreambleoption
{
w
}{
\tabl_tabulate_set_width
}
546\installtabulatepreambleoption
{
f
}{
\tabl_tabulate_set_font
}
547\installtabulatepreambleoption
{
B
}{
\t_tabl_tabulate_font
{
\bf
}
548 \tabl_tabulate_set_preamble
}
549\installtabulatepreambleoption
{
I
}{
\t_tabl_tabulate_font
{
\it
}
550 \tabl_tabulate_set_preamble
}
551\installtabulatepreambleoption
{
S
}{
\t_tabl_tabulate_font
{
\sl
}
552 \tabl_tabulate_set_preamble
}
553\installtabulatepreambleoption
{
T
}{
\t_tabl_tabulate_font
{
\tt
}
554 \tabl_tabulate_set_preamble
}
555\installtabulatepreambleoption
{
R
}{
\t_tabl_tabulate_font
{
\rm
}
556 \tabl_tabulate_set_preamble
}
557\installtabulatepreambleoption
{
m
}{
\t_tabl_tabulate_bmath
{
\normalstartimath
}
558 \t_tabl_tabulate_emath
{
\normalstopimath
}
559 \tabl_tabulate_set_preamble
}
560\installtabulatepreambleoption
{
M
}{
\t_tabl_tabulate_bmath
{
\normalstartimath
\displaystyle
}
561 \t_tabl_tabulate_emath
{
\normalstopimath
}
562 \tabl_tabulate_set_preamble
}
563\installtabulatepreambleoption
{
h
}{
\tabl_tabulate_set_hook
}
564\installtabulatepreambleoption
{
b
}{
\tabl_tabulate_set_before
}
565\installtabulatepreambleoption
{
a
}{
\tabl_tabulate_set_after
}
566\installtabulatepreambleoption
{
i
}{
\tabl_tabulate_set_preskip
}
567\installtabulatepreambleoption
{
j
}{
\tabl_tabulate_set_posskip
}
568\installtabulatepreambleoption
{
k
}{
\tabl_tabulate_set_preposskip
}
569\installtabulatepreambleoption
{
e
}{
\toksapp
\t_tabl_tabulate_settings
{
\global
\settrue
\c_tabl_tabulate_equal
}
570 \tabl_tabulate_set_preamble
}
571\installtabulatepreambleoption
{
g
}{
\tabl_tabulate_set_align
}
572\installtabulatepreambleoption
{
.
}{
\tabl_tabulate_set_align
.
}
573\installtabulatepreambleoption
{
,
}{
\tabl_tabulate_set_align
,
}
574\installtabulatepreambleoption
{
C
}{
\tabl_tabulate_set_color_span
}
575\installtabulatepreambleoption
{
d
}{
\toksapp
\t_tabl_tabulate_settings
{
\fixedspaces
}
576 \tabl_tabulate_set_preamble
}
577\installtabulatepreambleoption
{
}{
\tabl_tabulate_set_preamble
}
578\installtabulatepreambleoption
{
A
}{
\tabl_tabulate_set_alignment
}
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606\installtabulatepreambleoption
\relax
607 {}
608
609\def
\tabl_tabulate_set_preamble
#
1
610 {
\ifcsname
\??tabulatepreamble
\string
#
1
\endcsname
611
612 \expandafter\expandafter\expandafter\lastnamedcs\expandafter
\gobbleoneargument
613 \else
614 \expandafter
\tabl_tabulate_set_preamble_nop
615 \fi
{
#
1
}}
616
617\def
\tabl_tabulate_set_preamble_yes
#
1
618 {
\csname
\??tabulatepreamble
\string
#
1
\expandafter\endcsname
}
619
620\def
\tabl_tabulate_set_preamble_nop
#
1
621 {
\writestatus
{
tabulate
}{
unknown
preamble
key
:
#
1
}
622 \tabl_tabulate_set_preamble
}
623
624\def
\tabl_tabulate_set_preskip
#
1
625 {
\doifelsenumber
{
#
1
}
626 {
\s_tabl_tabulate_pre
#
1
\d_tabl_tabulate_unit
\tabl_tabulate_set_preamble
}
627 {
\s_tabl_tabulate_pre
.
5
\d_tabl_tabulate_unit
\tabl_tabulate_set_preamble
#
1
}}
628
629\def
\tabl_tabulate_set_posskip
#
1
630 {
\doifelsenumber
{
#
1
}
631 {
\s_tabl_tabulate_post
#
1
\d_tabl_tabulate_unit
\tabl_tabulate_set_preamble
}
632 {
\s_tabl_tabulate_post
.
5
\d_tabl_tabulate_unit
\tabl_tabulate_set_preamble
#
1
}}
633
634\def
\tabl_tabulate_set_preposskip
#
1
635 {
\doifelsenumber
{
#
1
}
636 {
\s_tabl_tabulate_pre
#
1
\d_tabl_tabulate_unit
\s_tabl_tabulate_post
\s_tabl_tabulate_pre
\tabl_tabulate_set_preamble
}
637 {
\s_tabl_tabulate_pre
.
5
\d_tabl_tabulate_unit
\s_tabl_tabulate_post
\s_tabl_tabulate_pre
\tabl_tabulate_set_preamble
#
1
}}
638
639\def
\tabl_tabulate_set_setups
#
1
640 {
\setvalue
{
\??tabulatesetup
\the
\c_tabl_tabulate_columns
}{
\setups
[#
1
]
}
641 \tabl_tabulate_set_preamble
}
642
643\def
\tabl_tabulate_set_hook
#
1
644 {
\setvalue
{
\??tabulatehook
\the
\c_tabl_tabulate_columns
}{
#
1
}
645 \tabl_tabulate_set_preamble
}
646
647
648
649\newconditional
\c_tabl_auto_align_mode
650
651\def
\tabl_tabulate_hook_g
652 {
\ifconditional
\c_tabl_auto_align_mode
653 \signalcharacteralign
\c_tabl_tabulate_column
{
\c_tabl_tabulate_noflines
\plusone
}
654 \typo_charalign_adapt_font
655 \fi
}
656
657\def
\tabl_tabulate_set_align
#
1
658 {
\global
\settrue
\c_tabl_auto_align_mode
659 \setcharacteralign
\c_tabl_tabulate_columns
{
#
1
}
660 \tabl_tabulate_set_preamble
}
661
662
663
664\def
\tabl_tabulate_set_before
#
1
665 {
\t_tabl_tabulate_before
{
#
1
}
666 \tabl_tabulate_set_preamble
}
667
668\def
\tabl_tabulate_set_after
#
1
669 {
\t_tabl_tabulate_after
{
#
1
}
670 \tabl_tabulate_set_preamble
}
671
672\def
\tabl_tabulate_set_font
#
1
673 {
\t_tabl_tabulate_font
{
#
1
}
674 \tabl_tabulate_set_preamble
}
675
676\def
\tabl_tabulate_pickup_width
677 {
\doifelsenextparenthesis
\tabl_tabulate_set_width_indeed
\tabl_tabulate_set_preamble
}
678
679\def
\tabl_tabulate_set_width
680 {
\setfalse
\c_tabl_tabulate_pwidth_set
681 \c_tabl_tabulate_modus
\zerocount
682 \tabl_tabulate_pickup_width
}
683
684\def
\tabl_tabulate_set_alignment
#
1
685 {
\edef
\m_tabl_tabulate_alignment
{
#
1
}
686 \spac_align_use_later
\m_tabl_tabulate_alignment
687 \tabl_tabulate_set_preamble
}
688
689\def
\tabl_tabulate_set_paragraph
690 {
\doifelsenextparenthesis
691 {
\c_tabl_tabulate_modus
\plusone
692 \settrue
\c_tabl_tabulate_pwidth_set
693 \tabl_tabulate_pickup_width
}
694 {
\c_tabl_tabulate_modus
\plustwo
695 \setfalse
\c_tabl_tabulate_pwidth_set
696 \tabl_tabulate_set_preamble
}}
697
698
699
700
701
702
703
704
705
706
707
708\def
\tabl_tabulate_set_width_indeed
(#
1
)
709 {
\processallactionsinset
710 [#
1
]
711 [
\v!fit
=>
\c_tabl_tabulate_modus
\plusthree
,
712 \v!fixed
=>
\c_tabl_tabulate_modus
\plusthree
713 \settrue
\c_tabl_tabulate_nopbreak
,
714 \v!auto
=>
\c_tabl_tabulate_modus
\plusthree
715 \settrue
\c_tabl_tabulate_reshape
,
716 \s!unknown
=>
\d_tabl_tabulate_width
#
1
\relax
]
717 \ifconditional
\c_tabl_tabulate_pwidth_set
718 \global\advance
\d_tabl_tabulate_width_p
\d_tabl_tabulate_width
719 \fi
720 \tabl_tabulate_set_preamble
}
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744\def
\tabl_tabulate_set_raggedright
{
\ifnum
\c_tabl_tabulate_type
=
\plusone
\else
\raggedright
\fi
}
745\def
\tabl_tabulate_set_raggedcenter
{
\ifnum
\c_tabl_tabulate_type
=
\plusone
\else
\raggedcenter
\fi
}
746\def
\tabl_tabulate_set_raggedleft
{
\ifnum
\c_tabl_tabulate_type
=
\plusone
\else
\raggedleft
\fi
}
747\def
\tabl_tabulate_set_notragged
{
\ifnum
\c_tabl_tabulate_type
=
\plusone
\else
\notragged
\fi
}
748\def
\tabl_tabulate_set_hss
{
\ifnum
\c_tabl_tabulate_type
=
\plusone
\else\hss
\fi
}
749
750\def
\tabl_tabulate_bskip_raggedright
{
\tabl_tabulate_bskip
\tabl_tabulate_set_raggedright
}
751\def
\tabl_tabulate_bskip_raggedleft
{
\tabl_tabulate_bskip
\tabl_tabulate_set_raggedleft
}
752\def
\tabl_tabulate_bskip_raggedcenter
{
\tabl_tabulate_bskip
\tabl_tabulate_set_raggedcenter
}
753
754\def
\tabl_tabulate_set_width_normal
755 {
\ifcase
\c_tabl_tabulate_align
\relax
756 \tabl_tabulate_set_preamble_step
\empty
\tabl_tabulate_set_hss
\or
757 \tabl_tabulate_set_preamble_step
\empty
\tabl_tabulate_set_hss
\or
758 \tabl_tabulate_set_preamble_step
\tabl_tabulate_set_hss
\empty
\or
759 \tabl_tabulate_set_preamble_step
\tabl_tabulate_set_hss
\tabl_tabulate_set_hss
\fi
}
760
761\def
\tabl_tabulate_set_width_fixed
762 {
\ifcase
\c_tabl_tabulate_align
\relax
763 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip
\tabl_tabulate_eskip
\or
764 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedright
\tabl_tabulate_eskip
\or
765 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedleft
\tabl_tabulate_eskip
\or
766 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedcenter
\tabl_tabulate_eskip
\fi
}
767
768\def
\tabl_tabulate_set_width_auto
769 {
\global\advance
\c_tabl_tabulate_nofauto
\plusone
770 \ifcase
\c_tabl_tabulate_align
\relax
771 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip
\tabl_tabulate_eskip
\or
772 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedright
\tabl_tabulate_eskip
\or
773 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedleft
\tabl_tabulate_eskip
\or
774 \tabl_tabulate_set_preamble_step
\tabl_tabulate_bskip_raggedcenter
\tabl_tabulate_eskip
\fi
}
775
776\def
\tabl_tabulate_set_width_simple
777 {
\tabl_tabulate_set_preamble_step
\tabl_tabulate_xbskip
\tabl_tabulate_xeskip
}
778
779
780
781
782
783
784\installcorenamespace
{
tabulatecolorspec
}
785
786\setvalue
{
\??tabulatecolorspec
C
}
#
1
{
\xdef
\m_tabl_tabulate_color
{
#
1
}
\global
\c_tabl_tabulate_colorspan
\zerocount
}
787\setvalue
{
\??tabulatecolorspec
L
}
#
1
{
\xdef
\m_tabl_tabulate_color
{
#
1
}
\global
\c_tabl_tabulate_colorspan
\plusone
}
788\setvalue
{
\??tabulatecolorspec
M
}
#
1
{
\xdef
\m_tabl_tabulate_color
{
#
1
}
\global
\c_tabl_tabulate_colorspan
\plustwo
}
789\setvalue
{
\??tabulatecolorspec
R
}
#
1
{
\xdef
\m_tabl_tabulate_color
{
#
1
}
\global
\c_tabl_tabulate_colorspan
\plusthree
}
790\setvalue
{
\??tabulatecolorspec
T
}
#
1
{
\xdef
\m_tabl_tabulate_text_color
{
#
1
}}
791
792\def
\tabl_tabulate_set_color_span
#
1
#
2
793 {
\csname
\??tabulatecolorspec
#
1
\endcsname
{
#
2
}
794 \tabl_tabulate_set_preamble
}
795
796\def
\tabl_tabulate_set_vrule_command
#
1
797 {
\doifelsenumber
{
#
1
}
798 {
\global
\d_tabl_tabulate_vrulethickness
#
1
\d_tabl_tabulate_vrulethickness_default
}
799 {
\xdef
\m_tabl_tabulate_vrule_color
{
#
1
}}}
800
801\def
\tabl_tabulate_set_entry
#
1
#
2
802 {
\c_tabl_tabulate_align
\v_tabl_tabulate_align
803 \c_tabl_tabulate_modus
\zerocount
804 \setfalse
\c_tabl_tabulate_pwidth_set
805 \setfalse
\c_tabl_tabulate_reshape
806 \t_tabl_tabulate_before
\emptytoks
807 \t_tabl_tabulate_after
\emptytoks
808 \t_tabl_tabulate_bmath
\emptytoks
809 \t_tabl_tabulate_emath
\emptytoks
810 \t_tabl_tabulate_font
\emptytoks
811 \t_tabl_tabulate_settings
\emptytoks
812 \glet
\m_tabl_tabulate_alignment
\empty
813 \glet
\m_tabl_tabulate_color
\empty
814 \glet
\m_tabl_tabulate_text_color
\empty
815 \glet
\m_tabl_tabulate_vrule_color
\empty
816 \global
\c_tabl_tabulate_colorspan
\zerocount
817 \global
\setfalse
\c_tabl_auto_align_mode
818 \global\advance
\c_tabl_tabulate_columns
\plusone
819 \expandafter\let\csname
\??tabulatesetup
\the
\c_tabl_tabulate_columns
\endcsname
\donothing
820 \edef
\currenttabulationtrulespec
{
#
1
}
821 \ifx
\currenttabulationtrulespec
\empty
822 \global
\d_tabl_tabulate_vrulethickness
\zeropoint
823 \else
824 \global
\d_tabl_tabulate_vrulethickness
\d_tabl_tabulate_vrulethickness_default
825 \rawprocesscommalist
[#
1
]
\tabl_tabulate_set_vrule_command
826 \fi
827 \tabl_tabulate_set_preamble
#
2
\relax\relax
828 \ifcase
\c_tabl_tabulate_modus
\relax
829 \tabl_tabulate_set_width_normal
830 \or
831 \tabl_tabulate_set_width_fixed
832 \or
833 \tabl_tabulate_set_width_auto
834 \or
835 \tabl_tabulate_set_width_simple
836 \fi
}
837
838\def
\tabl_tabulate_set_last_entry
#
1
839 {
\glet
\m_tabl_tabulate_color
\empty
840 \glet
\m_tabl_tabulate_vrule_color
\empty
841 \edef
\currenttabulationtrulespec
{
#
1
}
842 \ifx
\currenttabulationtrulespec
\empty
843 \global
\d_tabl_tabulate_vrulethickness
\zeropoint
844 \else
845 \global
\d_tabl_tabulate_vrulethickness
\d_tabl_tabulate_vrulethickness_default
846 \rawprocesscommalist
[#
1
]
\tabl_tabulate_set_vrule_command
847 \fi
848 \etoksapp
\t_tabl_tabulate_preamble
{
849 \tabl_tabulate_check_local_vrule_thickness
\constantdimenargument
\d_tabl_tabulate_vrulethickness
850 \tabl_tabulate_check_local_vrule_color
\constantemptyargument
\m_tabl_tabulate_vrule_color
851 \tabl_tabulate_column_vrule_inject
}}
852
853\let
\settabulateentry
\tabl_tabulate_set_entry
854\let
\settabulatelastentry
\tabl_tabulate_set_last_entry
855
856\def
\tabl_tabulate_normalize_splitline
857 {
\ifcase
\c_tabl_tabulate_splitlinemode
858
859 \or
860 \ht
\b_tabl_tabulate
\strutht
861 \dp
\b_tabl_tabulate
\strutdp
862 \or
863 \ifdim
\ht
\b_tabl_tabulate
<
\strutht
864 \ht
\b_tabl_tabulate
\strutht
865 \fi
866 \ifdim
\dp
\b_tabl_tabulate
<
\strutdp
867 \dp
\b_tabl_tabulate
\strutdp
868 \fi
869 \fi
}
870
871\def
\tabl_tabulate_whitespace
872 {
\ifdim
\d_tabl_tabulate_splitoff_betweenskip
>
\zeropoint
873 \vskip
\d_tabl_tabulate_splitoff_betweenskip
874 \global
\d_tabl_tabulate_splitoff_betweenskip
\zeropoint
875 \fi
}
876
877\def
\tabl_tabulate_check_whitespace
878 {
\setbox
\scratchbox
\vpack
879 {
\splitdiscards
880 \unskip
881 \ifdim
\lastskip
>
\d_tabl_tabulate_splitoff_betweenskip
882 \global
\d_tabl_tabulate_splitoff_betweenskip
\lastskip
883 \fi
}}
884
885\installtexdirective
886 {
tabulate
.
linenumbers
}
887 {
\def
\tabl_tabulate_check_linenumbers
{
\page_postprocessors_linenumbers_deepbox
\b_tabl_tabulate
}}
888 {
\let
\tabl_tabulate_check_linenumbers
\relax
}
889
890\let
\tabl_tabulate_check_linenumbers
\relax
891
892\def
\tabl_tabulate_splitoff_box
893 {
\dontcomplain
894 \global\setbox
\b_tabl_tabulate
\vsplit
\b_tabl_tabulate_current
\c_tabl_tabulate_column
to
\lineheight
895 \setbox
\b_tabl_tabulate
\vbox
896 {
\unvbox
\b_tabl_tabulate
}
897 \ifconditional
\c_tabl_tabulate_splitoff_whitespace
898 \tabl_tabulate_check_whitespace
899 \fi
900 \tabl_tabulate_color_repeat
901 \setbox
\b_tabl_tabulate
\hpack
to
\wd
\b_tabl_tabulate
902 {
\hss
\tabl_tabulate_hook_yes
{
\box
\b_tabl_tabulate
}
\hss
}
903 \tabl_tabulate_normalize_splitline
904 \tabl_tabulate_check_linenumbers
905 \box
\b_tabl_tabulate
}
906
907\unexpanded
\def
\tabl_tabulate_hook_nop
908 {}
909
910\let
\tabl_tabulate_hook
\tabl_tabulate_hook_nop
911
912\def
\tabl_tabulate_hook_yes
{
\begincsname
\??tabulatehook
\the
\c_tabl_tabulate_column
\endcsname
}
913
914\def
\tabl_tabulate_pheight_reset
915 {
\global
\c_tabl_tabulate_plines_min
\plusone
916 \ifdim
\d_tabl_tabulate_height_p_max
>
\zeropoint
917 \getnoflines
\d_tabl_tabulate_height_p_max
918 \global
\c_tabl_tabulate_plines_max
\noflines
919 \else
920 \global
\c_tabl_tabulate_plines_max
\zerocount
921 \fi
922 \global
\d_tabl_tabulate_height_p_max
\zeropoint
}
923
924\def
\tabl_tabulate_pheight_set
925 {
\scratchdimen
\ht
\b_tabl_tabulate_current
\c_tabl_tabulate_column
\relax
926 \ifdim
\scratchdimen
>
\d_tabl_tabulate_height_p_max
927 \global
\d_tabl_tabulate_height_p_max
\scratchdimen
928 \fi
}
929
930\def
\tabl_tabulate_pbreak_inject
931 {
\ifconditional
\c_tabl_tabulate_handlepbreak
932 \ifconditional
\c_tabl_tabulate_nopbreak
933 \tabl_tabulate_nobreak_inject
934 \else\ifnum
\c_tabl_tabulate_plines_max
>
\plusone
935 \ifnum
\c_tabl_tabulate_plines_min
=
\plusone
936 \tabl_tabulate_nobreak_inject
937 \fi
938 \global\advance
\c_tabl_tabulate_plines_min
\plusone
939 \ifnum
\c_tabl_tabulate_plines_min
=
\c_tabl_tabulate_plines_max
\relax
940 \tabl_tabulate_nobreak_inject
941 \fi
942 \fi
\fi
943 \fi
}
944
945\def
\tabl_tabulate_pbreak_check
946 {
\starttabulatenoalign
947 \tabl_tabulate_pbreak_inject
948 \ifconditional
\c_tabl_tabulate_splitoff_whitespace
949 \tabl_tabulate_whitespace
950 \fi
951 \stoptabulatenoalign
}
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017\installcorenamespace
{
tabulation
}
1018
1019\installcommandhandler
\??tabulation
{
tabulation
}
\??tabulation
1020
1021\setuptabulation
1022 [
\c!unit
=
1
em
,
1023 EQ
=
{
:
}
,
1024 \c!format
=
{
l
p
}
,
1025 \c!frame
=
\v!off
,
1026
1027 \c!rule
=
\v!normal
,
1028
1029 \c!rulethickness
=
\linewidth
,
1030
1031 \c!before
=
\blank
,
1032 \c!after
=
\blank
,
1033 \c!distance
=
{
\v!depth
,
\v!medium
}
,
1034 \c!align
=
\v!normal
,
1035 \c!margin
=
\!!zeropoint
,
1036 \c!split
=
\v!auto
,
1037 \c!header
=
\v!yes
,
1038
1039 \c!indenting
=
\v!no
]
1040
1041\unexpanded
\def
\definetabulate
1042 {
\dotripleempty
\tabl_tabulate_define
}
1043
1044\def
\tabl_tabulate_define
[#
1
][#
2
][#
3
]
1045 {
\ifthirdargument
1046
1047 \ifcsname
\namedtabulationhash
{
#
1
}
\s!check
\endcsname
\else
1048 \definetabulation
[#
1
][
\c!format
=
{
#
3
}
,
\s!check
=]
1049 \fi
1050 \definetabulation
[#
1
:
#
2
][#
1
][
\c!format
=
{
#
3
}
,
\s!check
=]
1051 \else
\ifsecondargument
1052
1053 \definetabulation
[#
1
][
\c!format
=
{
#
2
}
,
\s!check
=]
1054 \else
1055
1056 \definetabulation
[#
1
][
\c!format
=
{
l
p
}
,
\s!check
=]
1057 \fi\fi
}
1058
1059\unexpanded
\def
\setuptabulate
1060 {
\dotripleempty
\tabl_tabulate_setup
}
1061
1062\def
\tabl_tabulate_setup
[#
1
][#
2
][#
3
]
1063 {
\ifthirdargument
1064
1065 \setuptabulation
[#
1
:
#
2
][#
3
]
1066 \else
\ifsecondargument
1067
1068 \setuptabulation
[#
1
][#
2
]
1069 \else
1070
1071 \setuptabulation
[#
1
]
1072 \fi\fi
}
1073
1074\appendtoks
1075 \setuevalue
{
\e!start
\currenttabulation
}{
\tabl_start_defined
[
\currenttabulation
]
}
1076 \letvalue
{
\e!stop
\currenttabulation
}
\relax
1077 \letvalue
{
\??tabulatehead
\currenttabulation
}
\empty
1078 \letvalue
{
\??tabulatefoot
\currenttabulation
}
\empty
1079\to
\everydefinetabulation
1080
1081\let
\tabulateparameter
\tabulationparameter
1082\def
\currenttabulate
{
\currenttabulation
}
1083
1084
1085
1086\let
\tabl_tabulate_insert_head
\empty
1087\let
\tabl_tabulate_insert_body
\empty
1088\let
\tabl_tabulate_insert_foot
\empty
1089
1090\def
\tabl_tabulate_insert_head_content
1091 {
\tabulatenoalign
{
\global
\settrue
\c_tabl_tabulate_someamble
}
1092 \begincsname
\??tabulatehead
\currenttabulation
\endcsname
1093 \tabulatenoalign
{
\global
\setfalse
\c_tabl_tabulate_someamble
}}
1094
1095\def
\tabl_tabulate_insert_foot_content
1096 {
\tabulatenoalign
{
\global
\settrue
\c_tabl_tabulate_someamble
}
1097 \begincsname
\??tabulatefoot
\currenttabulation
\endcsname
1098 \tabulatenoalign
{
\global
\setfalse
\c_tabl_tabulate_someamble
}}
1099
1100\def
\tabl_tabulate_check_full_content
1101 {
\ifcsname
\??tabulatehead
\currenttabulation
\endcsname
1102
1103 \expandafter\ifx\lastnamedcs
\empty
1104 \let
\tabl_tabulate_insert_head
\empty
1105 \else
1106 \let
\tabl_tabulate_insert_head
\tabl_tabulate_insert_head_content
1107 \fi
1108 \else
1109 \let
\tabl_tabulate_insert_head
\empty
1110 \fi
1111 \ifcsname
\??tabulatefoot
\currenttabulation
\endcsname
1112
1113 \expandafter\ifx\lastnamedcs
\empty
1114 \let
\tabl_tabulate_insert_foot
\empty
1115 \else
1116 \let
\tabl_tabulate_insert_foot
\tabl_tabulate_insert_foot_content
1117 \fi
1118 \else
1119 \let
\tabl_tabulate_insert_foot
\empty
1120 \fi
}
1121
1122\def
\tabl_tabulate_insert_content
1123 {
\tabl_tabulate_insert_head
1124 \ifcase
\c_tabl_tabulate_repeathead
\else
1125 \tabulatenoalign
{
\penalty
\zerocount
}
1126 \fi
1127 \tabl_tabulate_insert_body
1128 \tabl_tabulate_insert_foot
1129 \tabl_tabulate_remove_funny_line
}
1130
1131\def
\tabl_tabulate_remove_funny_line
1132 {
\ifhmode
1133 \strut
\crcr
1134 \tabulatenoalign
{
\kern
\lineheight
}
1135 \fi
}
1136
1137
1138
1139\setuvalue
{
\e!start\v!tabulatehead
}{
\doifelsenextoptionalcs
\tabl_tabulate_start_head_yes
\tabl_tabulate_start_head_nop
}
1140\setuvalue
{
\e!start\v!tabulatetail
}{
\doifelsenextoptionalcs
\tabl_tabulate_start_foot_yes
\tabl_tabulate_start_foot_nop
}
1141
1142\let
\m_tabl_tabulate_data
\empty
1143
1144\def
\tabl_tabulate_start_head_yes
[#
1
]
1145 {
\processcontent
{
\e!stop\v!tabulatehead
}
\m_tabl_tabulate_data
{
\letvalue
{
\??tabulatehead
#
1
}
\m_tabl_tabulate_data
}}
1146
1147\def
\tabl_tabulate_start_foot_yes
[#
1
]
1148 {
\processcontent
{
\e!stop\v!tabulatetail
}
\m_tabl_tabulate_data
{
\letvalue
{
\??tabulatefoot
#
1
}
\m_tabl_tabulate_data
}}
1149
1150\def
\tabl_tabulate_start_head_nop
{
\tabl_tabulate_start_head_yes
[
\v!tabulate
]
}
1151\def
\tabl_tabulate_start_foot_nop
{
\tabl_tabulate_start_foot_yes
[
\v!tabulate
]
}
1152
1153\unexpanded
\def
\tabl_start_defined
[#
1
]
1154 {
\bgroup
1155 \edef
\currenttabulationparent
{
#
1
}
1156 \let
\currenttabulation
\currenttabulationparent
1157 \edef
\p_format
{
\tabulationparameter
\c!format
}
1158 \ifx
\p_format
\v!none
1159
1160
1161 \expandafter
\dodoubleempty
\expandafter
\tabl_start_regular
1162 \else
1163 \expandafter
\dodoubleargument
\expandafter
\tabl_start_defined_indeed
1164 \fi
}
1165
1166\def
\tabl_start_defined_indeed
1167 {
\iffirstargument
1168 \ifsecondargument
1169 \doubleexpandafter
\tabl_start_defined_two
1170 \else
1171 \doubleexpandafter
\tabl_start_defined_one
1172 \fi
1173 \else
1174 \singleexpandafter
\tabl_start_defined_zero
1175 \fi
}
1176
1177\def
\tabl_start_defined_one
[#
1
][#
2
]
1178 {
\ifcondition
\validassignment
{
#
1
}
1179 \setuptabulation
[
\currenttabulation
][#
1
]
1180 \else
1181 \edef
\currenttabulation
{
\currenttabulation
:
#
1
}
1182 \fi
1183 \tabl_tabulate_start_building
}
1184
1185\def
\tabl_start_defined_two
[#
1
][#
2
]
1186 {
\edef
\currenttabulation
{
\currenttabulation
:
#
1
}
1187 \setuptabulation
[
\currenttabulation
][#
2
]
1188 \tabl_tabulate_start_building
}
1189
1190\def
\tabl_start_defined_zero
[#
1
][#
2
]
1191 {
\tabl_tabulate_start_building
}
1192
1193
1194
1195\unexpanded\setuvalue
{
\e!start\v!tabulate
}
1196 {
\bgroup
1197 \let
\currenttabulationparent
\empty
1198 \dodoubleempty
\tabl_start_regular
}
1199
1200\def
\tabl_start_regular
1201 {
\let
\currenttabulation
\currenttabulationparent
1202 \ifsecondargument
1203 \expandafter
\tabl_start_regular_two
1204 \else
1205 \expandafter
\tabl_start_regular_one
1206 \fi
}
1207
1208\def
\tabl_default_format
{
l
p
}
1209
1210\def
\tabl_start_regular_one
[#
1
][#
2
]
1211 {
\ifcondition
\validassignment
{
#
1
}
1212 \lettabulationparameter
\c!format
\tabl_default_format
1213 \setupcurrenttabulation
[#
1
]
1214 \else
1215 \def
\p_format
{
#
1
}
1216 \ifx
\p_format
\empty
1217 \def
\p_format
{
l
p
}
1218 \fi
1219 \lettabulationparameter
\c!format
\p_format
1220 \fi
1221 \tabl_tabulate_start_building
}
1222
1223\def
\tabl_start_regular_two
[#
1
][#
2
]
1224 {
\def
\p_format
{
#
1
}
1225 \ifx
\p_format
\empty
1226 \let
\p_format
\tabl_default_format
1227 \fi
1228 \lettabulationparameter
\c!format
\p_format
1229 \setupcurrenttabulation
[#
2
]
1230 \tabl_tabulate_start_building
}
1231
1232\letvalue
{
\e!stop\v!tabulate
}
\relax
1233\letvalue
{
\e!stop\v!tabulatehead
}
\relax
1234\letvalue
{
\e!stop\v!tabulatetail
}
\relax
1235
1236\unexpanded
\def
\tabl_tabulate_start_ignore
1237 {
\em
Nested
tabulate
is
not
(
yet
)
supported
.
\relax
1238 \expandafter
\gobbleuntil
\csname
\ifconditional
\c_tabl_generic
stoptabulate
\else
\e!stop\v!tabulate
\fi\endcsname
}
1239
1240\appendtoks
1241 \letvalue
{
\e!start\v!tabulate
}
\tabl_tabulate_start_ignore
1242\to
\everytabulate
1243
1244\setvalue
{
\??tabulatesplit\v!yes
}{
\settrue
\c_tabl_tabulate_split
}
1245\setvalue
{
\??tabulatesplit\v!repeat
}{
\settrue
\c_tabl_tabulate_split
}
1246\setvalue
{
\??tabulatesplit\v!no
}{
\setfalse
\c_tabl_tabulate_split
}
1247\setvalue
{
\??tabulatesplit\v!auto
}{
\ifinsidefloat\ifinsidesplitfloat
\else
\setfalse
\c_tabl_tabulate_split
\fi\fi
}
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279\let
\tabl_tabulate_inside_after
\relax
1280\let
\tabl_tabulate_outside_after
\relax
1281\let
\tabl_tabulate_inside_inbetween
\relax
1282\let
\tabl_tabulate_outside_inbetween
\relax
1283
1284\unexpanded
\def
\tabl_tabulate_inside_before
1285 {
\ifhmode
\par\fi
1286 \ifhmode
1287 \ifinsidesplitfloat
1288 \let
\tabl_tabulate_inside_after
\relax
1289 \else
1290 \vbox
\bgroup
1291 \let
\tabl_tabulate_inside_after
\egroup
1292 \fi
1293 \else
1294 \let
\tabl_tabulate_inside_after
\relax
1295 \fi
}
1296
1297\unexpanded
\def
\tabl_tabulate_outside_before
1298 {
\ifhmode
\par\fi
1299 \ifhmode
1300 \vbox
\bgroup
1301 \let
\tabl_tabulate_outside_after
\egroup
1302 \let
\tabl_tabulate_outside_inbetween
\relax
1303 \else\ifinner
1304 \let
\tabl_tabulate_outside_after
\relax
1305 \let
\tabl_tabulate_outside_inbetween
\relax
1306 \else
1307 \whitespace
1308 \tabulationparameter
\c!before
1309 \relax
1310 \let
\tabl_tabulate_outside_after
\tabl_tabulate_outside_after_indeed
1311 \let
\tabl_tabulate_outside_inbetween
\tabl_tabulate_outside_inbetween_indeed
1312 \fi\fi
}
1313
1314\def
\tabl_tabulate_outside_after_indeed
1315 {
\tabulationparameter
\c!after
}
1316
1317\def
\tabl_tabulate_outside_inbetween_indeed
1318 {
\doifempty
{
\tabulationparameter
\c!after
}
1319 {
\vskip
\strutdp
1320 \verticalstrut
1321 \vskip
\struttotal
}}
1322
1323\def
\tabl_tabulate_inside_inbetween
1324 {
\doifempty
{
\tabulationparameter
\c!after
}
1325 {
\vskip
\strutdp
1326 \verticalstrut
1327 \vskip
\struttotal
}}
1328
1329\unexpanded
\def
\tabl_tabulate_start_building
1330 {
\ifinsidefloat
1331 \tabl_tabulate_inside_before
1332 \else
1333 \tabl_tabulate_outside_before
1334 \fi
1335 \bgroup
1336
1337 \t_tabl_tabulate_preamble
\emptytoks
1338 \t_tabl_tabulate_dummy
\emptytoks
1339
1340 \resetcharacteralign
1341
1342 \edef
\p_distance
{
\tabulationparameter
\c!distance
}
1343 \edef
\p_align
{
\tabulationparameter
\c!align
}
1344 \edef
\p_line
{
\tabulationparameter
\c!rule
}
1345 \edef
\p_rulecolor
{
\tabulationparameter
\c!rulecolor
}
1346 \edef
\p_rulethickness
{
\tabulationparameter
\c!rulethickness
}
1347 \edef
\p_bodyfont
{
\tabulationparameter
\c!bodyfont
}
1348 \edef
\p_indenting
{
\tabulationparameter
\c!indenting
}
1349 \edef
\p_keeptogether
{
\tabulationparameter
\c!keeptogether
}
1350 \edef
\p_blank
{
\tabulationparameter
\c!blank
}
1351
1352 \ifx
\p_keeptogether
\v!no
1353 \settrue
\c_tabl_tabulate_tolerant_break
1354
1355 \else
1356 \setfalse
\c_tabl_tabulate_tolerant_break
1357
1358 \fi
1359
1360 \settrue
\c_tabl_tabulate_split
1361 \begincsname
\??tabulatesplit
\tabulationparameter
\c!split
\endcsname
1362
1363 \let
\m_tabl_tabulate_blank_default
\p_blank
1364
1365 \d_tabl_tabulate_unit
\tabulationparameter
\c!unit
1366 \d_tabl_tabulate_margin
\tabulationparameter
\c!margin
1367 \let
\m_tabl_tabulate_vrule_color_default
\p_rulecolor
1368 \let
\m_tabl_tabulate_hrule_color_default
\p_rulecolor
1369 \d_tabl_tabulate_vrulethickness_default
\p_rulethickness
1370 \d_tabl_tabulate_hrulethickness_default
\p_rulethickness
1371 \ifx
\p_bodyfont
\empty
\else
1372 \switchtobodyfont
[
\p_bodyfont
]
1373 \fi
1374 \postponenotes
1375 \widowpenalty
\zerocount
1376 \clubpenalty
\zerocount
1377 \the
\everytabulate
1378 \tabulationparameter
\c!inner
1379 \d_tabl_tabulate_indent
\dimexpr\leftskip
\hangindent\ifx
\p_indenting
\v!yes
\parindent\fi\relax
1380 \global
\c_tabl_tabulate_column
\zerocount
1381 \processcontent
1382 {
\ifconditional
\c_tabl_generic
stoptabulate
\else
\e!stop
\ifx
\currenttabulationparent
\empty
\v!tabulate
\else
\currenttabulationparent
\fi\fi
}
1383 \tabl_tabulate_insert_body
1384 \tabl_tabulate_process
}
1385
1386\def
\tabulateEQ
1387 {
\ifconditional
\c_tabl_tabulate_firstflushed
\else
1388 \dostarttaggedchained
\t!ignore
\empty\empty
1389 \dostarttagged
\t!ignore
\empty
1390 \tabulationparameter
{
EQ
}
1391 \dostoptagged
1392 \dostoptagged
1393 \fi
1394 \global
\setfalse
\c_tabl_tabulate_equal
}
1395
1396
1397
1398\let
\tabulatenormalpos
\relax
1399\let
\tabulateequalpos
\relax
1400
1401
1402
1403\let
\m_tabl_tabulate_color_previous
\empty
1404\let
\m_tabl_tabulate_color
\empty
1405\let
\m_tabl_tabulate_text_color
\empty
1406\let
\m_tabl_tabulate_color_local
\empty
1407\let
\m_tabl_tabulate_vrule_color
\empty
1408\let
\m_tabl_tabulate_vrule_color_local
\empty
1409\let
\m_tabl_tabulate_vrule_color_default
\empty
1410\let
\m_tabl_tabulate_hrule_color_default
\empty
1411\let
\m_tabl_tabulate_blank_default
\empty
1412
1413\appendtoks
1414 \glet
\m_tabl_tabulate_color_previous
\empty
1415 \glet
\m_tabl_tabulate_color
\empty
1416 \glet
\m_tabl_tabulate_text_color
\empty
1417 \glet
\m_tabl_tabulate_color_local
\empty
1418 \glet
\m_tabl_tabulate_vrule_color
\empty
1419 \glet
\m_tabl_tabulate_vrule_color_local
\empty
1420 \global
\d_tabl_tabulate_vrulethickness_local
\zeropoint
1421\to
\t_tabl_tabulate_every_row
1422
1423\unexpanded
\def
\tabl_tabulate_color_side_right_second
1424 {
\ifx
\m_tabl_tabulate_color_previous
\empty
\else
1425 \tabl_tabulate_color_set
\m_tabl_tabulate_color_previous
1426 \glet
\m_tabl_tabulate_color_previous
\empty
1427 \fi
}
1428
1429\unexpanded
\def
\tabl_tabulate_color_side_left_second
1430 {
\ifx
\m_tabl_tabulate_color
\empty
\else
1431 \ifcase
\c_tabl_tabulate_colorspan
1432 \or
1433 \tabl_tabulate_color_set
\m_tabl_tabulate_color
1434 \or
1435 \tabl_tabulate_color_set
\m_tabl_tabulate_color
1436 \fi
1437 \fi
}
1438
1439\unexpanded
\def
\tabl_tabulate_color_side_both_second
1440 {
\ifx
\m_tabl_tabulate_color
\empty
\else
1441 \tabl_tabulate_color_set
\m_tabl_tabulate_color
1442 \ifcase
\c_tabl_tabulate_colorspan
1443
1444 \or
1445 \glet
\m_tabl_tabulate_color_previous
\empty
1446 \or
1447 \glet
\m_tabl_tabulate_color_previous
\m_tabl_tabulate_color
1448 \or
1449 \glet
\m_tabl_tabulate_color_previous
\m_tabl_tabulate_color
1450 \fi
1451 \fi
}
1452
1453\let
\tabl_tabulate_color_side_right
\relax
1454\let
\tabl_tabulate_color_side_left
\relax
1455\let
\tabl_tabulate_color_side_both
\relax
1456
1457\appendtoks
1458 \let
\tabl_tabulate_color_side_right
\tabl_tabulate_color_side_right_second
1459 \let
\tabl_tabulate_color_side_left
\tabl_tabulate_color_side_left_second
1460 \let
\tabl_tabulate_color_side_both
\tabl_tabulate_color_side_both_second
1461\to
\t_tabl_tabulate_initializers_second
1462
1463\def
\tabl_tabulate_set_color_column
#
1
1464 {
\unskip
1465 \doifelsefastoptionalcheck
{
\tabl_tabulate_set_color_column_yes
#
1
}{
\tabl_tabulate_set_color_column_nop
#
1
}}
1466
1467\def
\tabl_tabulate_set_color_column_nop
1468 {
\tabl_tabulate_column_normal
\zerocount
}
1469
1470\def
\tabl_tabulate_set_color_column_yes
#
1
[#
2
]
1471 {
\xdef
\m_tabl_tabulate_color_local
{
#
2
}
1472 \tabl_tabulate_column_normal
\zerocount
#
1
}
1473
1474
1475
1476\def
\tabl_tabulate_column_normal
#
1
#
2
1477 {
\unskip
1478 \aligntab
1479 \ifconditional
\c_tabl_tabulate_equal
\tabulateequalpos
\else
\tabulatenormalpos
\fi
1480 \ifnum
\c_tabl_tabulate_column
>
\c_tabl_tabulate_max_vrulecolumn
\else
1481 \tabl_tabulate_column_vrule_setup
1482 \fi
1483 \aligntab
1484 \global
\c_tabl_tabulate_kind
#
1
1485 \global
\c_tabl_tabulate_type
#
2
1486 \aligntab
}
1487
1488
1489
1490\def
\tabl_tabulate_column_equal
#
1
#
2
1491 {
\unskip
1492 \aligntab
1493 \tabulateequalpos
1494 \aligntab
1495 \global
\c_tabl_tabulate_kind
#
1
1496 \global
\c_tabl_tabulate_type
#
2
1497 \aligntab
}
1498
1499
1500
1501\def
\tabl_tabulate_column_vruled_preset
1502 {
\glet
\m_tabl_tabulate_vrule_color_local
\m_tabl_tabulate_vrule_color_default
1503 \global
\d_tabl_tabulate_vrulethickness_local
\d_tabl_tabulate_vrulethickness_default
}
1504
1505\def
\tabl_tabulate_column_vruled
#
1
#
2
1506 {
\unskip
1507
1508
1509
1510
1511
1512 \ifnum
\c_tabl_tabulate_column
>
\c_tabl_tabulate_max_vrulecolumn
1513 \global
\c_tabl_tabulate_max_vrulecolumn
\c_tabl_tabulate_column
1514 \fi
1515 \doifelsefastoptionalcheck
{
\tabl_tabulate_column_vruled_yes
#
1
#
2
}{
\tabl_tabulate_column_vruled_nop
#
1
#
2
}}
1516
1517\def
\tabl_tabulate_column_vrule_setup
1518 {
\begincsname
\??tabulatevrule
\the
\c_tabl_tabulate_column
\endcsname
}
1519
1520\def
\tabl_tabulate_column_vruled_nop
1521 {
\expandafter
\glet
\csname
\??tabulatevrule
\the
\c_tabl_tabulate_column
\endcsname
\tabl_tabulate_column_vruled_preset
1522 \tabl_tabulate_column_normal
}
1523
1524\def
\tabl_tabulate_column_vruled_step
#
1
1525 {
\doifelsenumber
{
#
1
}
1526 {
\global
\d_tabl_tabulate_vrulethickness_local
#
1
\d_tabl_tabulate_vrulethickness_default
}
1527 {
\xdef
\m_tabl_tabulate_vrule_color_local
{
#
1
}}}
1528
1529\def
\tabl_tabulate_column_vruled_yes
#
1
#
2
[#
3
]
1530 {
\expandafter\gdef\csname
\??tabulatevrule
\the
\c_tabl_tabulate_column
\endcsname
1531 {
\tabl_tabulate_column_vruled_preset
1532 \rawprocesscommalist
[#
3
]
\tabl_tabulate_column_vruled_step
}
1533 \tabl_tabulate_column_normal
#
1
#
2
}
1534
1535\def
\tabl_tabulate_vrule_reset
1536 {
\ifcase
\c_tabl_tabulate_max_vrulecolumn
\else
1537 \tabl_tabulate_vrule_reset_indeed
1538 \fi
}
1539
1540\def
\tabl_tabulate_vrule_reset_indeed
1541 {
\dofastloopcs
\c_tabl_tabulate_max_vrulecolumn
\tabl_tabulate_vrule_reset_step
1542 \global
\c_tabl_tabulate_max_vrulecolumn
\zerocount
}
1543
1544\def
\tabl_tabulate_vrule_reset_step
1545 {
\expandafter
\glet
\csname
\??tabulatevrule
\the
\fastloopindex
\endcsname
\undefined
}
1546
1547\appendtoks
1548 \tabl_tabulate_vrule_reset
1549\to
\t_tabl_tabulate_every_after_row
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560\def
\tabl_tabulate_column_vruled_normal
1561 {
\vrule
\s!width
\d_tabl_tabulate_vrulethickness
\relax
}
1562
1563\def
\tabl_tabulate_column_vruled_colored
1564 {
\dousecolorparameter
\m_tabl_tabulate_vrule_color
1565 \vrule
\s!width
\d_tabl_tabulate_vrulethickness
\relax
}
1566
1567\unexpanded
\def
\tabl_tabulate_column_vrule_inject_first
1568 {
\ifcase
\d_tabl_tabulate_vrulethickness
\else
1569 \tabl_tabulate_column_vruled_normal
1570 \fi
1571 \global
\d_tabl_tabulate_vrulethickness
\zeropoint
}
1572
1573\unexpanded
\def
\tabl_tabulate_column_vrule_inject_second
1574 {
\ifcase
\d_tabl_tabulate_vrulethickness
\else
1575 \ifx
\m_tabl_tabulate_vrule_color
\empty
1576 \tabl_tabulate_column_vruled_normal
1577 \else
1578 \tabl_tabulate_column_vruled_colored
1579 \fi
1580 \fi
1581 \global
\d_tabl_tabulate_vrulethickness
\zeropoint
}
1582
1583\let
\tabl_tabulate_column_vrule_inject
\relax
1584
1585\appendtoks
1586 \let
\tabl_tabulate_column_vrule_inject
\tabl_tabulate_column_vrule_inject_first
1587\to
\t_tabl_tabulate_initializers_first
1588
1589\appendtoks
1590 \let
\tabl_tabulate_column_vrule_inject
\tabl_tabulate_column_vrule_inject_second
1591\to
\t_tabl_tabulate_initializers_second
1592
1593
1594
1595\def
\tabl_tabulate_column_inject_auto
1596 {
\tabl_tabulate_column_normal
\zerocount\zerocount
1597 \ifnum
\c_tabl_tabulate_column
>
\c_tabl_tabulate_columns
\relax
1598 \expandafter
\NR
1599 \else
1600 \expandafter\ignorespaces
1601 \fi
}
1602
1603\unexpanded
\def
\setquicktabulate
#
1
1604 {
\let
#
1
\tabl_tabulate_column_inject_auto
1605 \let
\\
\tabl_tabulate_column_inject_auto
}
1606
1607\setvalue
{
\??tabulateseparator\v!blank
}{
\s_tabl_tabulate_separator
\bigskipamount
}
1608\setvalue
{
\??tabulateseparator\v!depth
}{
\s_tabl_tabulate_separator
\strutdp
}
1609\setvalue
{
\??tabulateseparator\v!small
}{
\def
\m_tabl_tabulate_separator_factor
{
.
2
5
}}
1610\setvalue
{
\??tabulateseparator\v!medium
}{
\def
\m_tabl_tabulate_separator_factor
{
.
5
}}
1611\setvalue
{
\??tabulateseparator\v!big
}{}
1612\setvalue
{
\??tabulateseparator\v!none
}{
\s_tabl_tabulate_separator
\zeropoint
\let
\m_tabl_tabulate_separator_factor
\zerocount
}
1613\setvalue
{
\??tabulateseparator\v!grid
}{
\s_tabl_tabulate_separator
\zeropoint
\let
\m_tabl_tabulate_separator_factor
\zerocount
}
1614
1615\def
\tabl_tabulate_column_rule_separator_step
#
1
1616 {
\ifcsname
\??tabulateseparator
#
1
\endcsname
1617 \lastnamedcs
1618 \else
1619 \s_tabl_tabulate_separator
#
1
\relax
1620 \fi
}
1621
1622\def
\tabl_tabulate_column_rule_separator_inject
1623 {
\bgroup
1624 \s_tabl_tabulate_separator
\strutdp
1625 \ifx
\p_distance
\empty
\else
1626 \let
\m_tabl_tabulate_separator_factor
\plusone
1627 \processcommacommand
[
\p_distance
]
\tabl_tabulate_column_rule_separator_step
1628 \s_tabl_tabulate_separator
\m_tabl_tabulate_separator_factor
\s_tabl_tabulate_separator
1629 \fi
1630
1631
1632
1633
1634 \directvskip
\s_tabl_tabulate_separator
1635 \egroup
}
1636
1637\def
\tabl_tabulate_hrule_spec_ignore
#
1
1638 {
1639
1640 \doifelsefastoptionalcheck
#
1
#
1
}
1641
1642\def
\tabl_tabulate_hrule_spec_pickup
#
1
1643 {
\glet
\currenttabulationlocalhrulecolor
\m_tabl_tabulate_hrule_color_default
1644 \global
\d_tabl_tabulate_hrulethickness_local
\d_tabl_tabulate_hrulethickness_default
1645 \doifelsefastoptionalcheck
{
\tabl_tabulate_hrule_preset
#
1
}
#
1
}
1646
1647\def
\tabl_tabulate_hrule_preset_step
#
1
1648 {
\doifelsenumber
{
#
1
}
1649 {
\global
\d_tabl_tabulate_hrulethickness_local
#
1
\d_tabl_tabulate_hrulethickness_default
}
1650 {
\xdef
\currenttabulationlocalhrulecolor
{
#
1
}}}
1651
1652\def
\tabl_tabulate_hrule_preset
#
1
[#
2
]
1653 {
\rawprocesscommalist
[#
2
]
\tabl_tabulate_hrule_preset_step
1654 #
1
}
1655
1656\def
\tabl_tabulate_hrule_inject_normal
1657 {
\autorule
1658 \s!height
.
5
\d_tabl_tabulate_hrulethickness_local
1659 \s!depth
.
5
\d_tabl_tabulate_hrulethickness_local
1660 \s!left
\d_tabl_tabulate_indent
1661 \relax
}
1662
1663\def
\tabl_tabulate_hrule_inject_colored
1664 {
\dousecolorparameter
\currenttabulationlocalhrulecolor
1665 \tabl_tabulate_hrule_inject_normal
}
1666
1667\unexpanded
\def
\tabl_tabulate_hrule_inject_first
1668 {
\ifcase
\d_tabl_tabulate_hrulethickness_local
\else
1669 \tabl_tabulate_hrule_inject_normal
1670 \fi
}
1671
1672\unexpanded
\def
\tabl_tabulate_hrule_inject_second
1673 {
\ifcase
\d_tabl_tabulate_hrulethickness_local
\else
1674 \ifx
\currenttabulationlocalhrulecolor
\empty
1675 \tabl_tabulate_hrule_inject_normal
1676 \else
1677 \tabl_tabulate_hrule_inject_colored
1678 \fi
1679 \fi
}
1680
1681\let
\tabl_tabulate_hrule_inject
\relax
1682
1683\appendtoks
1684 \let
\tabl_tabulate_hrule_inject
\tabl_tabulate_hrule_inject_first
1685\to
\t_tabl_tabulate_initializers_first
1686
1687\appendtoks
1688 \let
\tabl_tabulate_hrule_inject
\tabl_tabulate_hrule_inject_second
1689\to
\t_tabl_tabulate_initializers_second
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716\unexpanded
\def
\tabl_tabulate_color_set
#
1
1717 {
\begingroup
1718 \clf_enablebackgroundalign
1719 \glet
\tabl_tabulate_color_repeat
\tabl_tabulate_color_repeat_second
1720 \global
\settrue
\c_tabl_tabulate_has_colors
1721 \ifnum
\c_tabl_tabulate_column
>
\c_tabl_tabulate_max_colorcolumn
1722 \global
\c_tabl_tabulate_max_colorcolumn
\c_tabl_tabulate_column
1723 \fi
1724 \expandafter\xdef\csname
\??tabulatecolor
\the
\c_tabl_tabulate_column
\endcsname
{
#
1
}
1725 \hpack
\thealignbackgroundcolorattr
{
#
1
}{}
1726 \endgroup
}
1727
1728\def
\tabl_tabulate_color_repeat_second
1729 {
\begingroup
1730 \scratchcounter
\numexpr
\c_tabl_tabulate_column
\plusone
\relax
1731 \ifcsname
\??tabulatecolor
\the
\scratchcounter
\endcsname
1732
1733 \hpack
\expandafter
\thealignbackgroundcolorattr
\expandafter
{
\lastnamedcs
}{}
1734 \fi
1735 \endgroup
}
1736
1737\let
\tabl_tabulate_color_repeat
\relax
1738
1739\appendtoks
1740 \let
\tabl_tabulate_color_repeat
\relax
1741\to
\everytabulate
1742
1743\def
\tabl_tabulate_color_reset
1744 {
\ifcase
\c_tabl_tabulate_max_colorcolumn
\else
1745 \tabl_tabulate_color_reset_indeed
1746 \fi
}
1747
1748
1749
1750
1751\def
\tabl_tabulate_color_reset_indeed
1752 {
\dofastloopcs
\c_tabl_tabulate_max_colorcolumn
\tabl_tabulate_color_reset_step
}
1753
1754\def
\tabl_tabulate_color_reset_step
1755 {
\expandafter
\glet
\csname
\??tabulatecolor
\number
\fastloopindex
\endcsname
\undefined
}
1756
1757\appendtoks
1758 \tabl_tabulate_color_reset
1759\to
\t_tabl_tabulate_every_after_row
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777\def
\tabl_tabulate_register_par_options_first
1778 {}
1779
1780\def
\tabl_tabulate_register_par_options_second
1781 {
\registerparoptions
1782 \ifinsidefloat
1783
1784 \glet
\tabl_tabulate_register_par_options
\empty
1785 \else
1786
1787
1788 \fi
}
1789
1790\let
\tabl_tabulate_register_par_options
\relax
1791
1792\appendtoks
1793 \let
\tabl_tabulate_register_par_options
\tabl_tabulate_register_par_options_first
1794\to
\t_tabl_tabulate_initializers_first
1795
1796\appendtoks
1797 \let
\tabl_tabulate_register_par_options
\tabl_tabulate_register_par_options_second
1798\to
\t_tabl_tabulate_initializers_second
1799
1800\appendtoks
1801 \tabl_tabulate_register_par_options
1802\to
\t_tabl_tabulate_every_row
1803
1804\def
\tabl_tabulate_flush_indent_indeed
1805 {
\hbox
to
\d_tabl_tabulate_indent
1806 {
1807
1808
1809 \advance\hsize
\d_tabl_tabulate_indent
1810
1811
1812 \the
\t_tabl_tabulate_every_row
1813 \hss
}}
1814
1815\def
\tabl_tabulate_flush_indent
1816 {
\ifnum
\c_tabl_tabulate_column
=
\zerocount
1817 \tabl_tabulate_flush_indent_indeed
1818 \fi
}
1819
1820\def
\tabl_tabulate_digits
{
\digits
}
1821
1822
1823
1824
1825\setvalue
{
\??tabulatealigning\v!normal
}{
0
}
1826\setvalue
{
\??tabulatealigning\v!right
}{
1
}
1827\setvalue
{
\??tabulatealigning\v!left
}{
2
}
1828\setvalue
{
\??tabulatealigning\v!middle
}{
3
}
1829
1830\setvalue
{
\??tabulateheader\v!repeat
}{
\plusone
}
1831\setvalue
{
\??tabulateheader\v!text
}{
\plustwo
}
1832
1833\unexpanded
\def
\tabl_tabulate_bskip_first
{
\setbox
\b_tabl_tabulate
\vbox
\bgroup
\glet
\tabl_tabulate_hook
\tabl_tabulate_hook_nop
}
1834\unexpanded
\def
\tabl_tabulate_eskip_first
{
\par
\egroup
\glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
}
1835\unexpanded
\def
\tabl_tabulate_xbskip_first
{
\hpack
\bgroup
\vbox
\bgroup
\glet
\tabl_tabulate_hook
\tabl_tabulate_hook_nop
}
1836\unexpanded
\def
\tabl_tabulate_xeskip_first
{
\par
\egroup\egroup
\glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
}
1837
1838\let
\tabl_tabulate_bbskip
\relax
1839\let
\tabl_tabulate_eeskip
\relax
1840\let
\tabl_tabulate_bskip
\relax
1841\let
\tabl_tabulate_eskip
\relax
1842\let
\tabl_tabulate_xbskip
\relax
1843\let
\tabl_tabulate_xeskip
\relax
1844
1845\appendtoks
1846 \let
\tabl_tabulate_bbskip
\relax
1847
1848 \let
\tabl_tabulate_bskip
\tabl_tabulate_bskip_first
1849 \let
\tabl_tabulate_eskip
\tabl_tabulate_eskip_first
1850 \let
\tabl_tabulate_xbskip
\tabl_tabulate_xbskip_first
1851 \let
\tabl_tabulate_xeskip
\tabl_tabulate_xeskip_first
1852\to
\t_tabl_tabulate_initializers_first
1853
1854\def
\tabl_tabulate_baselinecorrection
1855 {
\def
\dobaselinecorrection
{
\vskip\dimexpr
\prevdepth
\strutdp
\strutdp
\relax
}
1856 \baselinecorrection
}
1857
1858
1859
1860
1861
1862\installcorenamespace
{
tabulatenobreak
}
1863
1864\def
\tabl_tabulate_break_allow
{
\directvpenalty
\zerocount
}
1865\def
\tabl_tabulate_break_maybe
{
\directvpenalty
\zerocount
}
1866\def
\tabl_tabulate_break_no
{
\directvpenalty
\plustenthousand
}
1867
1868\let
\tabl_tabulate_break_state_set
\relax
1869\let
\tabl_tabulate_break_state_reset
\relax
1870\let
\tabl_tabulate_break_state_allowbreak
\tabl_tabulate_break_maybe
1871
1872
1873
1874\unexpanded
\def
\tabl_tabulate_VL_first
{
\tabl_tabulate_column_vruled
\zerocount\zerocount
}
1875\unexpanded
\def
\tabl_tabulate_NC_first
{
\tabl_tabulate_column_normal
\zerocount\zerocount
}
1876\unexpanded
\def
\tabl_tabulate_RC_first
{
\tabl_tabulate_column_normal
\zerocount\plusone
}
1877\unexpanded
\def
\tabl_tabulate_HC_first
{
\tabl_tabulate_column_normal
\zerocount\plustwo
}
1878\unexpanded
\def
\tabl_tabulate_EQ_first
{
\tabl_tabulate_column_equal
\plustwo
\zerocount
}
1879\unexpanded
\def
\tabl_tabulate_RQ_first
{
\tabl_tabulate_column_equal
\zerocount\plusone
}
1880\unexpanded
\def
\tabl_tabulate_HQ_first
{
\tabl_tabulate_column_equal
\zerocount\plustwo
}
1881
1882\unexpanded
\def
\tabl_tabulate_NG_first
{
\tabl_tabulate_column_normal
\zerocount\zerocount
}
1883\unexpanded
\def
\tabl_tabulate_NN_first
{
\tabl_tabulate_column_normal
\zerocount\zerocount
\tabl_tabulate_digits
}
1884\unexpanded
\def
\tabl_tabulate_ND_first
{
\tabl_tabulate_column_normal
\zerocount\zerocount
\tabl_tabulate_digits
}
1885
1886\unexpanded
\def
\tabl_tabulate_NR_first
{
\tabl_tabulate_NR_common
\conditionaltrue
\tabl_tabulate_check_penalties
}
1887\unexpanded
\def
\tabl_tabulate_NB_first
{
\tabl_tabulate_NR_common
\conditionaltrue
\tabl_tabulate_nobreak_inject
}
1888
1889\unexpanded
\def
\tabl_tabulate_NR_second
{
\tabl_tabulate_NR_common
\conditionalfalse
\tabl_tabulate_check_penalties
}
1890\unexpanded
\def
\tabl_tabulate_NB_second
{
\tabl_tabulate_NR_common
\conditionalfalse
\tabl_tabulate_nobreak_inject
}
1891
1892\unexpanded
\def
\tabl_tabulate_CC_first
{
\global
\c_tabl_tabulate_localcolorspan
\zerocount
\tabl_tabulate_set_color_column
\zerocount
}
1893\unexpanded
\def
\tabl_tabulate_CL_first
{
\global
\c_tabl_tabulate_localcolorspan
\plusone
\tabl_tabulate_set_color_column
\zerocount
}
1894\unexpanded
\def
\tabl_tabulate_CM_first
{
\global
\c_tabl_tabulate_localcolorspan
\plustwo
\tabl_tabulate_set_color_column
\zerocount
}
1895\unexpanded
\def
\tabl_tabulate_CR_first
{
\global
\c_tabl_tabulate_localcolorspan
\plusthree
\tabl_tabulate_set_color_column
\zerocount
}
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921\unexpanded
\def
\tabl_tabulate_NI_first
{
\doifelsefastoptionalcheck
\tabl_tbl_NI_yes
\tabl_tbl_NI_nop
}
1922
1923\def
\tabl_tbl_NI_yes
[#
1
]
{
\NC
\itemtag
[#
1
]
\NC
}
1924\def
\tabl_tbl_NI_nop
{
\NC
\itemtag
\NC
}
1925
1926
1927
1928\unexpanded
\def
\tabl_tabulate_BC_first
1929 {
\tabl_tabulate_column_normal
\plusone\zerocount
1930 \let
\fontstyle
\globalfontstyle
1931 \bf
}
1932
1933\appendtoks
1934 \let
\VL
\tabl_tabulate_VL_first
1935 \let
\NC
\tabl_tabulate_NC_first
1936 \let
\BC
\tabl_tabulate_BC_first
1937 \let
\RC
\tabl_tabulate_RC_first
1938 \let
\HC
\tabl_tabulate_HC_first
1939 \let
\EQ
\tabl_tabulate_EQ_first
1940 \let
\RQ
\tabl_tabulate_RQ_first
1941 \let
\HQ
\tabl_tabulate_HQ_first
1942 \let
\NG
\tabl_tabulate_NG_first
1943 \let
\NN
\tabl_tabulate_NN_first
1944 \let
\ND
\tabl_tabulate_ND_first
1945 \let
\NR
\tabl_tabulate_NR_first
1946 \let
\NB
\tabl_tabulate_NB_first
1947 \let
\CC
\tabl_tabulate_CC_first
1948 \let
\CL
\tabl_tabulate_CL_first
1949 \let
\CM
\tabl_tabulate_CM_first
1950 \let
\CR
\tabl_tabulate_CR_first
1951 \let
\NI
\tabl_tabulate_NI_first
1952\to
\t_tabl_tabulate_initializers_first
1953
1954\appendtoks
1955 \let
\NR
\tabl_tabulate_NR_second
1956 \let
\NB
\tabl_tabulate_NB_second
1957\to
\t_tabl_tabulate_initializers_second
1958
1959\appendtoks
1960 \let
\SR
\NR
1961 \let
\FR
\NR
1962 \let
\MR
\NR
1963 \let
\LR
\NR
1964 \let
\AR
\NR
1965\to
\t_tabl_tabulate_initializers_first
1966
1967\unexpanded
\def
\tabl_tabulate_NR_common
#
1
#
2
1968 {
\global\advance
\c_tabl_tabulate_noflines
\plusone
1969 \global
\setfalse
\c_tabl_tabulate_firstflushed
1970 \global
\setfalse
\c_tabl_tabulate_equal
1971 \global
\c_tabl_tabulate_column
\zerocount
1972 \ifconditional
#
1
\relax
1973 \tabl_tabulate_break_state_reset
1974 \fi
1975 \tabl_tabulate_pheight_reset
1976 \unskip\unskip\crcr
\tabl_tabulate_flush_collected
1977
1978 \starttabulatenoalign
1979 \the
\t_tabl_tabulate_every_after_row
1980 #
2
1981 \stoptabulatenoalign
}
1982
1983\def
\tabl_tabulate_check_penalties
1984 {
\ifconditional
\c_tabl_tabulate_tolerant_break
\else
1985 \ifnum
\c_tabl_tabulate_totalnoflines
=
\plusone
1986
1987 \else
1988 \ifconditional
\c_tabl_tabulate_someamble
\ifcase
\c_tabl_tabulate_repeathead
\else
1989 \tabl_tabulate_break_allow
1990 \fi
\fi
1991 \ifnum
\c_tabl_tabulate_noflines
=
\plusone
1992 \tabl_tabulate_nobreak_inject
1993 \else
\ifnum
\c_tabl_tabulate_noflines
=
\c_tabl_tabulate_minusnoflines
1994 \ifnum
\c_tabl_tabulate_plines_max
<
\plustwo
1995 \tabl_tabulate_nobreak_inject
1996 \else
1997 \tabl_tabulate_break_allow
1998 \fi
1999 \else
2000 \tabl_tabulate_break_state_allowbreak
2001 \fi
\fi
2002 \fi
2003 \fi
2004 \global
\setfalse
\c_tabl_tabulate_firstflushed
}
2005
2006\unexpanded
\def
\tabl_tabulate_bbskip_second_split_yes
2007 {
\ifvoid
\b_tabl_tabulate_current
\c_tabl_tabulate_column
2008 \ifx
\tabl_tabulate_flush_collected_indeed
\empty
\else
2009 \setbox
0
\hbox
2010 \fi
2011 \fi
}
2012
2013\unexpanded
\def
\tabl_tabulate_eskip_second
2014 {
\par
\egroup
2015 \tabl_tabulate_pheight_set
2016 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
2017 \tabl_tabulate_splitoff_box
}
2018
2019\unexpanded
\def
\tabl_tabulate_bskip_second_split_yes
2020 {
\ifvoid
\b_tabl_tabulate_current
\c_tabl_tabulate_column
2021
2022 \global\setbox
\b_tabl_tabulate_current
\c_tabl_tabulate_column
\vbox
2023 \bgroup
2024 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_nop
2025 \ifconditional
\c_tabl_tabulate_automode
\hsize
\d_tabl_tabulate_width
\fi
2026
2027
2028 \ignorespaces
2029 \let
\tabl_tabulate_eskip
\tabl_tabulate_eskip_second
2030 \else
2031
2032 \let
\tabl_tabulate_eskip
\empty
2033 \dontcomplain
2034 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
2035 \expandafter
\tabl_tabulate_splitoff_box
2036 \fi
}
2037
2038\unexpanded
\def
\tabl_tabulate_xbskip_second
{
\tabl_tabulate_bskip
}
2039\unexpanded
\def
\tabl_tabulate_xeskip_second
{
\tabl_tabulate_eskip
}
2040
2041\unexpanded
\def
\tabl_tabulate_flush_second_indeed
2042 {
\glet
\tabl_tabulate_flush_collected_indeed
\empty
2043 \global
\c_tabl_tabulate_column
\zerocount
2044 \tabl_tabulate_pbreak_check
2045 \dofastloopcs
\c_tabl_tabulate_columns
\tabl_tabulate_flush_second_step
2046 \global
\settrue
\c_tabl_tabulate_firstflushed
}
2047
2048\unexpanded
\def
\tabl_tabulate_flush_second_step
2049 {
\ifvoid
\b_tabl_tabulate_current
\fastloopindex
\else
2050 \gdef
\tabl_tabulate_flush_collected_indeed
{
\the
\t_tabl_tabulate_dummy
}
2051 \fi
}
2052
2053\def
\tabl_tabulate_flush_second
2054 {
\tabulatenoalign
{
\tabl_tabulate_flush_second_indeed
}
2055 \tabl_tabulate_flush_collected_indeed
}
2056
2057\unexpanded
\def
\tabl_tabulate_bskip_second_split_nop
2058 {
\vtop
\bgroup
2059 \ifconditional
\c_tabl_tabulate_automode
\hsize
\d_tabl_tabulate_width
\fi
2060
2061
2062 \ignorespaces
}
2063
2064\unexpanded
\def
\tabl_tabulate_eskip_second_split_nop
2065 {
\par
\verticalstrut
2066 \vskip
\struttotal
2067 \egroup
}
2068
2069
2070
2071
2072\appendtoks
2073 \let
\tabl_tabulate_xbskip
\tabl_tabulate_xbskip_second
2074 \let
\tabl_tabulate_xeskip
\tabl_tabulate_xeskip_second
2075 \ifconditional
\c_tabl_tabulate_split
2076 \let
\tabl_tabulate_bskip
\tabl_tabulate_bskip_second_split_yes
2077 \let
\tabl_tabulate_bbskip
\tabl_tabulate_bbskip_second_split_yes
2078 \else
2079 \let
\tabl_tabulate_bskip
\tabl_tabulate_bskip_second_split_nop
2080 \let
\tabl_tabulate_eskip
\tabl_tabulate_eskip_second_split_nop
2081 \fi
2082\to
\t_tabl_tabulate_initializers_second
2083
2084
2085
2086
2087
2088
2089
2090
2091\def
\tabl_tabulate_XX_none
2092 {
\starttabulatenoalign
2093 \tabl_tabulate_break_state_set
2094 \tabl_tabulate_hrule_spec_ignore
2095 \stoptabulatenoalign
}
2096
2097\def
\tabl_tabulate_FL_second
{
\starttabulatenoalign
\tabl_tabulate_hrule_spec_pickup
\tabl_tabulate_FL_second_indeed
}
2098\def
\tabl_tabulate_ML_second
{
\starttabulatenoalign
\tabl_tabulate_hrule_spec_pickup
\tabl_tabulate_ML_second_indeed
}
2099\def
\tabl_tabulate_LL_second
{
\starttabulatenoalign
\tabl_tabulate_hrule_spec_pickup
\tabl_tabulate_LL_second_indeed
}
2100\def
\tabl_tabulate_TL_second
{
\starttabulatenoalign
\tabl_tabulate_hrule_spec_pickup
\tabl_tabulate_TL_second_indeed
}
2101\def
\tabl_tabulate_BL_second
{
\starttabulatenoalign
\tabl_tabulate_hrule_spec_pickup
\tabl_tabulate_BL_second_indeed
}
2102
2103\unexpanded
\def
\tabl_tabulate_FL_second_indeed
2104 {
\ifinsidefloat
\else
2105 \doifempty
{
\tabulationparameter
\c!before
}
\tabl_tabulate_baselinecorrection
2106 \fi
2107 \tabl_tabulate_hrule_inject
2108 \tabl_tabulate_nobreak_inject
2109 \tabl_tabulate_column_rule_separator_inject
2110 \prevdepth
\strutdp
2111 \tabl_tabulate_nobreak_inject
2112 \stoptabulatenoalign
}
2113
2114\def
\spac_vspacing_no_topskip
2115 {
\c_attr_skipcategory
\plusten
}
2116
2117\unexpanded
\def
\tabl_tabulate_ML_second_indeed
2118 {
\tabl_tabulate_break_no
2119 \tabl_tabulate_column_rule_separator_inject
2120 \tabl_tabulate_break_no
2121 \tabl_tabulate_hrule_inject
2122 \vskip
\p_rulethickness
\relax
2123 \begingroup
2124 \spac_vspacing_no_topskip
2125 \tabl_tabulate_hrule_inject
2126 \endgroup
2127 \tabl_tabulate_break_no
2128 \tabl_tabulate_column_rule_separator_inject
2129 \stoptabulatenoalign
}
2130
2131\unexpanded
\def
\tabl_tabulate_LL_second_indeed
2132 {
\tabl_tabulate_nobreak_inject
2133 \tabl_tabulate_column_rule_separator_inject
2134 \tabl_tabulate_nobreak_inject
2135 \tabl_tabulate_hrule_inject
2136 \ifinsidefloat
2137 \tabl_tabulate_inside_inbetween
2138 \else
2139 \tabl_tabulate_outside_inbetween
2140 \fi
2141 \stoptabulatenoalign
}
2142
2143\unexpanded
\def
\tabl_tabulate_TL_second_indeed
2144 {
\tabl_tabulate_nobreak_inject
2145 \tabl_tabulate_column_rule_separator_inject
2146 \tabl_tabulate_nobreak_inject
2147 \tabl_tabulate_hrule_inject
2148 \tabl_tabulate_nobreak_inject
2149 \tabl_tabulate_column_rule_separator_inject
2150
2151 \tabl_tabulate_nobreak_inject
2152 \stoptabulatenoalign
}
2153
2154\let
\tabl_tabulate_BL_second_indeed
\tabl_tabulate_TL_second_indeed
2155
2156\def
\tabl_tabulate_HL_second
2157 {
\csname
2158 \ifnum
\c_tabl_tabulate_noflines
=
\zerocount
F
\else
2159 \ifnum
\c_tabl_tabulate_noflines
=
\c_tabl_tabulate_totalnoflines
L
\else
2160 M
\fi\fi
2161 L
\endcsname
}
2162
2163\appendtoks
2164 \let
\FL
\tabl_tabulate_XX_none
2165 \let
\ML
\tabl_tabulate_XX_none
2166 \let
\LL
\tabl_tabulate_XX_none
2167 \let
\TL
\tabl_tabulate_XX_none
2168 \let
\BL
\tabl_tabulate_XX_none
2169 \let
\HL
\tabl_tabulate_XX_none
2170 \let
\HR
\tabl_tabulate_XX_none
2171\to
\t_tabl_tabulate_initializers_first
2172
2173\appendtoks
2174 \let
\FL
\tabl_tabulate_FL_second
2175 \let
\ML
\tabl_tabulate_ML_second
2176 \let
\LL
\tabl_tabulate_LL_second
2177 \let
\TL
\tabl_tabulate_TL_second
2178 \let
\BL
\tabl_tabulate_BL_second
2179 \let
\HL
\tabl_tabulate_HL_second
2180 \let
\HR
\tabl_tabulate_HL_second
2181\to
\t_tabl_tabulate_initializers_second
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231\def
\tabulaterule
{
\HR
}
2232\def
\tabulateline
{
\HL
}
2233\def
\tabulateautorule
{
\HR
}
2234\def
\tabulateautoline
{
\HL
}
2235
2236
2237
2238
2239
2240
2241
2242
2243\let
\tabl_tabulate_flush_collected
\empty
2244\let
\tabl_tabulate_flush_collected_indeed
\empty
2245
2246\let
\v_tabl_tabulate_align
\!!zerocount
2247
2248\def
\tabl_tabulate_check_side_float
2249 {
\ifdefined
\page_sides_check_floats_indeed
2250 \page_sides_check_floats_indeed
2251 \ifdim
\hangindent
>
\zeropoint
2252 \advance
\d_tabl_tabulate_indent
\hangindent
2253 \fi
2254 \fi
}
2255
2256\def
\tabl_tabulate_set_local_hsize
2257 {
\setlocalhsize
2258 \hsize
\localhsize
}
2259
2260\def
\tabl_tabulate_process
2261 {
\c_tabl_tabulate_pass
\plusone
2262 \tabl_tabulate_check_full_content
2263 \edef
\v_tabl_tabulate_align
{
\ifcsname
\??tabulatealigning
\p_align
\endcsname\lastnamedcs\else
0
\fi
}
2264 \s_tabl_tabulate_first
.
5
\d_tabl_tabulate_unit
2265 \s_tabl_tabulate_last
\s_tabl_tabulate_first
2266 \s_tabl_tabulate_pre
\zeropoint
2267 \s_tabl_tabulate_post
\s_tabl_tabulate_first
2268 \global
\c_tabl_tabulate_columns
\zerocount
2269 \global
\c_tabl_tabulate_nofauto
\zerocount
2270 \global
\c_tabl_tabulate_noflines
\zerocount
2271 \c_tabl_tabulate_totalnoflines
\zerocount
2272 \c_tabl_tabulate_minusnoflines
\zerocount
2273 \global
\d_tabl_tabulate_width_p
\zeropoint
2274 \global
\d_tabl_tabulate_width_w
\zeropoint
2275 \global
\setfalse
\c_tabl_tabulate_equal
2276 \tabl_tabulate_pheight_reset
2277 \tabskip
\zeropoint
2278 \ifinsidesplitfloat
2279 \donetrue
2280 \else
\ifinsidefloat
2281 \donefalse
2282 \else
2283 \donetrue
2284 \fi\fi
2285 \global
\c_tabl_tabulate_repeathead
2286 \ifdone
2287 \ifcsname
\??tabulateheader
\tabulationparameter
\c!header
\endcsname
2288 \lastnamedcs
2289 \else
2290 \zerocount
2291 \fi
2292 \else
2293 \zerocount
2294 \fi
2295
2296 \the
\t_tabl_tabulate_initializers_first
2297
2298 \glet
\tabl_tabulate_flush_collected
\empty
2299 \ifdim
\d_tabl_tabulate_margin
>
\zeropoint
2300 \t_tabl_tabulate_preamble
2301 {
\aligntab
2302 \tabl_tabulate_flush_indent
2303 \strut
2304 \alignmark\alignmark
2305 \tabskip
\d_tabl_tabulate_margin
2306 \strut
2307 \aligntab
2308 \alignmark\alignmark
2309 \tabskip
\zeropoint
}
2310 \else
2311 \t_tabl_tabulate_preamble
2312 {
\aligntab
2313 \tabl_tabulate_flush_indent
2314 \strut
2315 \alignmark\alignmark
2316 \aligntab
2317 \alignmark\alignmark
2318 \tabskip
\zeropoint
}
2319 \fi
2320 \d_tabl_tabulate_width
\zeropoint
2321
2322 \c_tabl_tabulate_nofcolumns
\zerocount
2323 \c_tabl_tabulate_has_rule_spec_first
\zerocount
2324 \c_tabl_tabulate_has_rule_spec_last
\zerocount
2325 \clf_presettabulate
{
\detokenizedtabulationparameter
\c!format
}
2326
2327 \d_tabl_tabulate_width
\zeropoint
2328 \tabl_tabulate_initialize_boxes
\c_tabl_tabulate_columns
2329 \toksapp
\t_tabl_tabulate_preamble
{
2330 \aligntab\alignmark\alignmark
2331 \global\advance
\c_tabl_tabulate_column
\plusone
2332 }
2333 \toksapp
\t_tabl_tabulate_dummy
{
2334 \NC
\unskip\unskip\crcr
\tabl_tabulate_flush_collected
2335 }
2336 \global
\c_tabl_tabulate_column
\zerocount
2337 \tabl_tabulate_pheight_reset
2338 \glet
\tabl_tabulate_hook
\tabl_tabulate_hook_yes
2339 \ifx
\p_indenting
\v!no
2340 \forgetparindent
2341 \fi
2342 \ifinsidefloat
2343 \d_tabl_tabulate_indent
\zeropoint
2344 \else
2345 \tabl_tabulate_check_side_float
2346 \tabl_tabulate_set_local_hsize
2347 \fi
2348 \dontcomplain
2349 \forgetall
2350 \everypar
\everytabulatepar
2351 \setbox
\scratchbox
\vbox
2352 {
\notesenabledfalse
2353 \d_tabl_tabulate_indent
\zeropoint
2354 \settrialtypesetting
2355 \anch_backgrounds_text_level_start
2356 \expandafter\halign\expandafter
{
\the
\t_tabl_tabulate_preamble
\crcr
\tabl_tabulate_insert_content
\crcr
}}
2357 \anch_backgrounds_text_level_stop
2358 \ifcase
\c_anch_backgrounds_text_state
\else
2359 \global
\settrue
\tablehaspositions
2360 \fi
2361 \ifnum
\c_tabl_tabulate_nofauto
>
\zerocount
2362
2363 \d_tabl_tabulate_width
\dimexpr\hsize
\wd
\scratchbox
\d_tabl_tabulate_width_p
\d_tabl_tabulate_width_w
\relax
2364 \ifnum
\c_tabl_tabulate_nofauto
>
\zerocount
2365 \divide
\d_tabl_tabulate_width
\c_tabl_tabulate_nofauto
\relax
2366 \fi
2367 \fi
2368 \setbox
\scratchbox
\emptybox
2369 \ifconditional
\c_tabl_tabulate_split
2370 \splittopskip
\strutht
2371 \glet
\tabl_tabulate_flush_collected_indeed
\empty
2372 \glet
\tabl_tabulate_flush_collected
\tabl_tabulate_flush_second
2373 \fi
2374 \c_tabl_tabulate_totalnoflines
\c_tabl_tabulate_noflines
2375 \c_tabl_tabulate_minusnoflines
\numexpr
\c_tabl_tabulate_noflines
\minusone
\relax
2376 \global
\c_tabl_tabulate_noflines
\zerocount
2377
2378 \c_tabl_tabulate_pass
\plustwo
2379 \the
\t_tabl_tabulate_initializers_second
2380
2381 \ifx
\p_line
\v!line
2382 \let
\HL
\HR
2383 \let
\tabulateautoline\tabulateautorule
2384 \let
\tabulateline\tabulaterule
2385 \fi
2386
2387 \ifcase
\c_tabl_tabulate_repeathead
2388 \ifinsidesplitfloat
2389 \global\setbox
\b_tabl_tabulate
\vbox
\bgroup
2390 \else
2391 \startframedcontent
[
\tabulationparameter
\c!frame
]
2392 \fi
2393 \else
2394 \global\setbox
\b_tabl_tabulate
\vbox
\bgroup
2395 \fi
2396
2397 \dostarttaggedchained
\t!tabulate
\empty
\??tabulation
2398 \dostarttagged
\t!tabulaterow
\empty
2399 \setfalse
\inhibitmargindata
2400 \toksapp\everycr
{
2401 \noalign
{
\the
\t_tabl_tabulate_every_real_row
}
2402 \dostoptagged
2403 \dostarttagged
\t!tabulaterow
\empty
2404 }
2405
2406 \synchronizedisplaydirection
2407 \synchronizeinlinedirection
2408 \halign
2409 \usedirectionparameterreverse
\tabulateparameter
2410 \expandafter
{
\the
\t_tabl_tabulate_preamble
\crcr
\tabl_tabulate_insert_content
\crcr
}
2411 \dostoptagged
2412 \dostoptagged
2413 \ifhmode
\par\prevdepth
\strutdp
\fi
2414 \ifx
\p_distance
\v!grid
2415 \vskip
\strutdp
2416 \fi
2417
2418 \ifcase
\c_tabl_tabulate_repeathead
2419 \ifinsidesplitfloat
2420 \egroup
2421 \egroup
2422 \tabl_split_box
\b_tabl_tabulate
2423 \else
2424 \stopframedcontent
2425 \egroup
2426 \fi
2427 \else
2428 \egroup
2429 \egroup
2430 \tabl_split_box
\b_tabl_tabulate
2431 \fi
2432
2433 \ifinsidefloat
2434 \tabl_tabulate_inside_after
2435 \else
2436 \tabl_tabulate_outside_after
2437 \fi
2438 \egroup
}
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457\def
\tabl_split_box
#
1
2458 {
\ifinsidesplitfloat
2459 \tabl_split_box_indeed
#
1
2460 \else
\ifinsidefloat
2461 \unvbox
#
1
2462 \else
2463 \tabl_split_box_indeed
#
1
2464 \fi\fi
}
2465
2466\def
\tabl_split_box_indeed
#
1
2467 {
\resettsplit
2468 \def
\tsplitminimumfreelines
{
2
}
2469 \def
\tsplitminimumfreespace
{
0
pt
}
2470 \setbox
\tsplitcontent
\box
#
1
2471 \ifcase
\c_tabl_tabulate_repeathead
\or
2472 \setbox
\tsplithead
\vsplit
\tsplitcontent
to
\lineheight
2473 \setbox
\tsplithead
\vbox
{
\unvbox
\tsplithead
}
2474 \or
2475 \setbox
\tsplithead
\vbox
{
\hbox
{
\strut
\tabulationparameter
\c!title
}}
2476 \fi
2477 \handletsplit
}
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502\def
\tabl_tabulate_TB
2503 {
\starttabulatenoalign
2504 \dosingleempty
\tabl_tabulate_TB_indeed
}
2505
2506\def
\tabl_tabulate_TB_indeed
[#
1
]
2507 {
\iffirstargument
2508 \blank
[#
1
]
2509 \else\ifx
\m_tabl_tabulate_blank_default
\empty
2510 \blank
2511 \else
2512 \blank
[
\m_tabl_tabulate_blank_default
]
2513 \fi\fi
2514 \stoptabulatenoalign
}
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530\appendtoks
2531 \let
\TB
\tabl_tabulate_TB
2532\to
\everytabulate
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643\definetabulate
2644 [
\v!legend
]
2645 [
emj
1
i
1
mR
]
2646
2647\setuptabulate
2648 [
\v!legend
]
2649 [
\c!unit
=
.
7
5
em
,
\c!inner
=
\setquicktabulate
\leg
,
EQ
=
{
=
}
]
2650
2651\definetabulate
2652 [
\v!legend
][
\v!two
]
2653 [
emj
1
emk
1
i
1
mR
]
2654
2655\definetabulate
2656 [
\v!fact
]
2657 [
R
ecmj
1
i
1
mR
]
2658
2659\setuptabulate
2660 [
\v!fact
]
2661 [
\c!unit
=
.
7
5
em
,
\c!inner
=
\setquicktabulate
\fact
,
EQ
=
{
=
}
]
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696\newconditional
\c_tabl_generic
2697
2698\unexpanded\setuvalue
{
starttabulate
}
2699 {
\bgroup
2700 \settrue
\c_tabl_generic
2701 \let
\currenttabulationparent
\empty
2702 \dodoubleempty
\tabl_start_regular
}
2703
2704\letvalue
{
stoptabulate
}
\relax
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719\def
\tabl_tabulate_compact_row
#
1
#
2
2720 {
\NC
\tabl_tabulate_compact_step
#
1
#
2
,
\end
,
}
2721
2722\def
\tabl_tabulate_compact_step
#
1
#
2
#
3
,
2723 {
\ifx
#
2
\end
2724 \NR
2725 \expandafter
\gobbleoneargument
2726 \else
2727 #
1
{
#
2
#
3
}
\NC
2728 \expandafter
\tabl_tabulate_compact_step
2729 \fi
#
1
}
2730
2731\unexpanded
\def
\tabulaterow
{
\tabl_tabulate_compact_row
\relax
}
2732\unexpanded
\def
\tabulaterowbold
{
\tabl_tabulate_compact_row
\bold
}
2733\unexpanded
\def
\tabulaterowtype
{
\tabl_tabulate_compact_row
\type
}
2734\unexpanded
\def
\tabulaterowtyp
{
\tabl_tabulate_compact_row
\typ
}
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814\let
\m_table_current_row_background
\empty
2815\let
\m_table_current_row_background_default
\empty
2816\let
\m_table_current_row_background_filler
\empty
2817\let
\m_table_current_row_background_defaultfiller
\empty
2818\let
\m_table_current_row_background_auto
\empty
2819
2820\unexpanded
\def
\tabl_register_row_background
#
1
2821 {
\xdef
\m_table_current_row_background
{
#
1
}}
2822
2823\unexpanded
\def
\tabl_register_row_background_filler
#
1
2824 {
\xdef
\m_table_current_row_background_filler
{
#
1
}}
2825
2826\unexpanded
\def
\tabl_synchronize_row_background
2827 {
\iftrialtypesetting
\else
2828 \ifx
\m_table_current_row_background_filler
\empty
2829 \ifx
\m_table_current_row_background
\empty
2830
2831 \tabl_synchronize_row_background_dummy
2832 \else
2833 \tabl_synchronize_row_background_indeed
\m_table_current_row_background
2834 \fi
2835 \else
2836 \tabl_synchronize_row_background_filler_indeed
\m_table_current_row_background_filler
2837 \fi
2838 \fi
}
2839
2840\unexpanded
\def
\tabl_synchronize_row_background_dummy
2841 {
\iftrialtypesetting
\else
2842 \begingroup
2843
2844 \clf_setbackgroundrowdata
\c_tabl_tabulate_nofrealrows
\zerocount\zeropoint
2845 \endgroup
2846 \fi
}
2847
2848\unexpanded
\def
\tabl_synchronize_row_background_indeed
#
1
2849 {
\iftrialtypesetting
\else
2850 \begingroup
2851 \clf_enablebackgroundalign
2852 \dousecolorparameter
{
#
1
}
2853 \setbox
\scratchbox
\hpack
{}
2854
2855 \clf_setbackgroundrowdata
\c_tabl_tabulate_nofrealrows
\scratchbox
\d_tabl_tabulate_indent
2856 \endgroup
2857 \fi
}
2858
2859\unexpanded
\def
\tabl_synchronize_row_background_filler_indeed
#
1
2860 {
\iftrialtypesetting
\else
2861 \begingroup
2862 \clf_enablebackgroundalign
2863 \node_linefiller_set
{
#
1
}
2864 \setbox
\scratchbox
\hpack
{}
2865
2866 \clf_setbackgroundrowdata
\c_tabl_tabulate_nofrealrows
\scratchbox
\d_tabl_tabulate_indent
2867 \endgroup
2868 \fi
}
2869
2870\appendtoks
2871 \glet
\m_table_current_row_background
\empty
2872 \glet
\m_table_current_row_background_filler
\empty
2873 \global
\c_tabl_tabulate_nofrealrows
\zerocount
2874 \global
\c_tabl_tabulate_autocolor
\zerocount
2875 \clf_resetbackgroundrowdata
2876\to
\t_tabl_tabulate_initializers_first
2877
2878\appendtoks
2879 \glet
\m_table_current_row_background
\empty
2880 \glet
\m_table_current_row_background_filler
\empty
2881 \global
\c_tabl_tabulate_nofrealrows
\zerocount
2882 \global
\c_tabl_tabulate_autocolor
\zerocount
2883 \clf_resetbackgroundrowdata
2884\to
\t_tabl_tabulate_initializers_second
2885
2886\appendtoks
2887 \tabl_synchronize_row_background
2888\to
\t_tabl_tabulate_every_real_row
2889
2890\appendtoks
2891 \glet
\m_table_current_row_background
\empty
2892 \glet
\m_table_current_row_background_filler
\empty
2893\to
\t_tabl_tabulate_every_after_row
2894
2895\unexpanded
\def
\tabl_tabulate_NL_first
[#
1
]
2896 {
\tabl_tabulate_column_normal
\zerocount\zerocount
\relax
2897 \ifcase
\c_tabl_tabulate_column
\or
2898 \tabl_register_row_background
{
#
1
}
2899 \fi
2900 \ignorespaces
}
2901
2902\unexpanded
\def
\tabl_tabulate_ND_first
2903 {
\tabl_tabulate_column_normal
\zerocount\zerocount
\relax
2904 \ifcase
\c_tabl_tabulate_column
\or
2905 \tabl_register_row_background
\m_table_current_row_background_default
2906 \fi
2907 \ignorespaces
}
2908
2909\unexpanded
\def
\tabl_tabulate_LB_first
[#
1
]
2910 {
\tabl_tabulate_column_normal
\plusone\zerocount
\relax
2911 \ifcase
\c_tabl_tabulate_column
\or
2912 \tabl_register_row_background
{
#
1
}
2913 \fi
2914 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2915 \ignorespaces
}
2916
2917\unexpanded
\def
\tabl_tabulate_DB_first
2918 {
\tabl_tabulate_column_normal
\plusone\zerocount
\relax
2919 \ifcase
\c_tabl_tabulate_column
\or
2920 \tabl_register_row_background
\m_table_current_row_background_default
2921 \fi
2922 \let
\fontstyle
\globalfontstyle
2923 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2924 \ignorespaces
}
2925
2926\unexpanded
\def
\tabl_tabulate_NF_first
[#
1
]
2927 {
\tabl_tabulate_column_normal
\zerocount\zerocount
\relax
2928 \ifcase
\c_tabl_tabulate_column
\or
2929 \tabl_register_row_background_filler
{
#
1
}
2930 \fi
2931 \ignorespaces
}
2932
2933\unexpanded
\def
\tabl_tabulate_NP_first
2934 {
\tabl_tabulate_column_normal
\zerocount\zerocount
\relax
2935 \ifcase
\c_tabl_tabulate_column
\or
2936 \tabl_register_row_background_filler
\m_table_current_row_background_default_filler
2937 \fi
2938 \ignorespaces
}
2939
2940\unexpanded
\def
\tabl_tabulate_FB_first
[#
1
]
2941 {
\tabl_tabulate_column_normal
\plusone\zerocount
\relax
2942 \ifcase
\c_tabl_tabulate_column
\or
2943 \tabl_register_row_background_filler
{
#
1
}
2944 \fi
2945 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2946 \ignorespaces
}
2947
2948\unexpanded
\def
\tabl_tabulate_PB_first
2949 {
\tabl_tabulate_column_normal
\plusone\zerocount
\relax
2950 \ifcase
\c_tabl_tabulate_column
\or
2951 \tabl_register_row_background_filler
\m_table_current_row_background_default_filler
2952 \fi
2953 \let
\fontstyle
\globalfontstyle
2954 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2955 \ignorespaces
}
2956
2957\unexpanded
\def
\tabl_tabulate_BC_first
2958 {
\tabl_tabulate_column_normal
\plusone\zerocount
2959 \let
\fontstyle
\globalfontstyle
2960 \ifx
\m_table_current_row_background
\empty
2961 \ifx
\m_table_current_row_background_filler
\empty
2962 \usetabulationstyleandcolor
\c!headstyle\c!headcolor
2963 \else
2964 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2965 \fi
2966 \else
2967 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2968 \fi
}
2969
2970\unexpanded
\def
\tabl_tabulate_A_first
2971 {
\global\advance
\c_tabl_tabulate_autocolor
\plusone
2972 \edef
\m_table_current_row_background_auto
{
\tabulateparameter
{
\c!backgroundcolor
:
\number
\c_tabl_tabulate_autocolor
}}
2973 \ifx
\m_table_current_row_background_auto
\empty
2974 \global
\c_tabl_tabulate_autocolor
\plusone
2975 \edef
\m_table_current_row_background_auto
{
\tabulateparameter
{
\c!backgroundcolor
:
\number
\c_tabl_tabulate_autocolor
}}
2976 \fi
2977 \ifx
\m_table_current_row_background_auto
\empty
2978 \let
\m_table_current_row_background_auto
\empty
2979 \fi
2980 \tabl_register_row_background
{
\m_table_current_row_background_auto
}}
2981
2982\unexpanded
\def
\tabl_tabulate_NA_first
2983 {
\tabl_tabulate_column_normal
\zerocount\zerocount
\relax
2984 \iftrialtypesetting
\else
2985 \ifcase
\c_tabl_tabulate_column
\or
2986 \tabl_tabulate_A_first
2987 \fi
2988 \fi
2989 \ignorespaces
}
2990
2991\unexpanded
\def
\tabl_tabulate_BA_first
2992 {
\tabl_tabulate_column_normal
\plusone\zerocount
\relax
2993 \iftrialtypesetting
\else
2994 \ifcase
\c_tabl_tabulate_column
\or
2995 \tabl_tabulate_A_first
2996 \fi
2997 \fi
2998 \usetabulationstyleandcolor
\c!foregroundstyle\c!foregroundcolor
2999 \ignorespaces
}
3000
3001\appendtoks
3002 \let
\NL
\tabl_tabulate_NL_first
3003 \let
\ND
\tabl_tabulate_ND_first
3004 \let
\LB
\tabl_tabulate_LB_first
3005 \let
\DB
\tabl_tabulate_DB_first
3006 \let
\NF
\tabl_tabulate_NF_first
3007 \let
\NP
\tabl_tabulate_NP_first
3008 \let
\FB
\tabl_tabulate_FB_first
3009 \let
\PB
\tabl_tabulate_PB_first
3010 \let
\NA
\tabl_tabulate_NA_first
3011 \let
\BA
\tabl_tabulate_BA_first
3012\to
\t_tabl_tabulate_initializers_first
3013
3014\appendtoks
3015 \edef
\m_table_current_row_background_default
{
\tabulateparameter
\c!backgroundcolor
}
3016 \edef
\m_table_current_row_background_default_filler
{
\tabulateparameter
\c!background
}
3017 \let
\m_table_current_row_background_auto
\empty
3018\to
\everytabulate
3019
3020\setuptabulate
3021 [
\c!headcolor
=
,
3022 \c!headstyle
=
\bf
,
3023 \c!backgroundcolor
=
\tabulationparameter
\c!rulecolor
,
3024 \c!foregroundcolor
=
,
3025 \c!foregroundstyle
=
\tabulationparameter
\c!headstyle
]
3026
3027\protect
\endinput
3028