1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Support Macros Boxes}
15
16\unprotect
17
18\permanent\integerdef\negatelistsigncode\numexpr
19 \negatexlistsigncode
20 \negateylistsigncode
21\relax
22
23
24
25\newdimension\strutht
26\newdimension\strutdp
27\newdimension\struthtdp
28
29\newdimension\givenwidth
30\newdimension\givenheight
31\newdimension\givendepth
32
33\newdimension\lastnaturalboxwd
34\newdimension\lastnaturalboxht
35\newdimension\lastnaturalboxdp
36
37\pushoverloadmode
38 \newuserunit\strutht sh
39 \newuserunit\strutdp sd
40 \newuserunit\struthtdp st
41\popoverloadmode
42
43\registerctxluafile{suppbox}{autosuffix}
44
45
46
47
48
49
50
51
52
53
54
55
56
57\iffalse
58 \def\strutdp {\dp\strutbox}
59 \def\strutht {\ht\strutbox}
60 \def\struthtdp{\htdp\strutbox}
61\fi
62
63\permanent\protected\def\strutwd {\wd\strutbox}
64\permanent\protected\def\strutgap{\dimexpr\strutht\strutdp\relax}
65
66
67
68
69
70
71
72\ifdefined\voidbox \else \newbox\voidbox \fi
73\ifdefined\nextbox \else \newbox\nextbox \fi
74
75
76
77
78
79
80
81
82\newdimension\nextdepth
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\newinteger\c_boxes_register
117
118\permanent\protected\def\smashbox
119 {\afterassignment\syst_boxes_smash_boxes_register\c_boxes_register}
120
121\def\syst_boxes_smash_boxes_register
122 {\wd\c_boxes_register\zeropoint
123 \ht\c_boxes_register\zeropoint
124 \dp\c_boxes_register\zeropoint}
125
126\permanent\protected\def\hsmashbox
127 {\afterassignment\syst_boxes_hsmashed_boxes_register\c_boxes_register}
128
129\def\syst_boxes_hsmashed_boxes_register
130 {\wd\c_boxes_register\zeropoint}
131
132\permanent\protected\def\vsmashbox
133 {\afterassignment\syst_boxes_vsmashed_boxes_register\c_boxes_register}
134
135\def\syst_boxes_vsmashed_boxes_register
136 {\ht\c_boxes_register\zeropoint
137 \dp\c_boxes_register\zeropoint}
138
139\permanent\protected\def\smashedbox
140 {\afterassignment\syst_boxes_smashed_boxes_register\c_boxes_register}
141
142\protected\def\syst_boxes_smashed_boxes_register
143 {\wd\c_boxes_register\zeropoint
144 \ht\c_boxes_register\zeropoint
145 \dp\c_boxes_register\zeropoint
146 \box\c_boxes_register}
147
148\aliased\let\smashboxed\smashedbox
149
150
151
152
153
154
155
156
157
158\permanent\protected\def\hsmash {\bgroup\dowithnextboxcs\syst_boxes_hsmashed_nextbox\hbox}
159\permanent\protected\def\vsmash {\bgroup\dowithnextboxcs\syst_boxes_vsmashed_nextbox\vbox}
160\permanent\protected\def\hsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \hbox}
161\permanent\protected\def\vsmashed{\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox \vbox}
162
163\protected\def\syst_boxes_hsmashed_nextbox
164 {\wd\nextbox\zeropoint
165 \box\nextbox
166 \egroup}
167
168\protected\def\syst_boxes_vsmashed_nextbox
169 {\ht\nextbox\zeropoint
170 \dp\nextbox\zeropoint
171 \box\nextbox
172 \egroup}
173
174\protected\def\syst_boxes_smashed_nextbox
175 {\ht\nextbox\zeropoint
176 \dp\nextbox\zeropoint
177 \wd\nextbox\zeropoint
178 \box\nextbox
179 \egroup}
180
181
182
183
184
185
186
187
188
189
190
191\permanent\protected\def\smashedhbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\hbox}
192\permanent\protected\def\smashedvbox{\vpack\bgroup\dowithnextboxcs\syst_boxes_smashed_nextbox\vbox}
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211\protected\def\syst_boxes_math_set_nextbox#1
212 {\setbox\nextbox\hbox\expandafter\bgroup
213 \expandafter\normalstartimath\expandafter\givenmathstyle\the\mathstackstyle
214 \mathsurround\zeropoint{#1}
215 \normalstopimath
216 \egroup}
217
218
219
220
221
222
223
224
225\permanent\protected\def\smash
226 {\begingroup
227 \futureexpandis[\syst_boxes_smash_yes\syst_boxes_smash_nop}
228
229\def\syst_boxes_smash_nop
230 {\edef\m_boxes_smash_options{hd}
231 \futurelet\nexttoken\syst_boxes_smash_indeed}
232
233\def\syst_boxes_smash_yes[#1]
234 {\edef\m_boxes_smash_options{#1}
235 \futurelet\nexttoken\syst_boxes_smash_indeed}
236
237\def\syst_boxes_smash_indeed
238 {\ifmmode
239 \expandafter\syst_boxes_smash_math
240 \orelse\ifx\nexttoken\bgroup
241 \expandafter\syst_boxes_smash_hbox
242 \else
243 \expandafter\syst_boxes_smash_text
244 \fi}
245
246\def\syst_boxes_smash_math#1
247 {\syst_boxes_math_set_nextbox{#1}
248 \syst_boxes_smash_process}
249
250\def\syst_boxes_smash_hbox
251 {\dowithnextboxcs\syst_boxes_smash_process\hbox}
252
253\def\syst_boxes_smash_text#1
254 {\setbox\nextbox\hbox{#1}
255 \syst_boxes_smash_process}
256
257\def\syst_boxes_smash_process
258 {\expandafter\syst_boxes_smash_process_option\m_boxes_smash_options\relax
259 \box\nextbox
260 \endgroup}
261
262\installcorenamespace {smashoptions}
263
264\defcsname\??smashoptions w\endcsname{\wd\nextbox\zeropoint}
265\defcsname\??smashoptions h\endcsname{\ht\nextbox\zeropoint}
266\defcsname\??smashoptions d\endcsname{\dp\nextbox\zeropoint}
267\defcsname\??smashoptions t\endcsname{\ht\nextbox\zeropoint}
268\defcsname\??smashoptions b\endcsname{\dp\nextbox\zeropoint}
269\defcsname\??smashoptions hd\endcsname{\ht\nextbox\zeropoint\dp\nextbox\zeropoint}
270\defcsname\??smashoptions whd\endcsname{\wd\nextbox\zeropoint\ht\nextbox\zeropoint\dp\nextbox\zeropoint}
271
272\def\syst_boxes_smash_process_option#1
273 {\ifx#1\relax\else
274 \begincsname\??smashoptions#1\endcsname
275 \expandafter\syst_boxes_smash_process_option
276 \fi}
277
278\def\syst_boxes_lower_nextbox_dp
279 {\setbox\nextbox\hpack{\lower\dp\nextbox\box\nextbox}}
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299\permanent\protected\def\phantom {\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed }
300\permanent\protected\def\vphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_v}
301\permanent\protected\def\hphantom{\begingroup\futurelet\nexttoken\syst_boxes_phantom_indeed_h}
302
303\def\syst_boxes_phantom_math #1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make }
304\def\syst_boxes_phantom_math_v#1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make_v}
305\def\syst_boxes_phantom_math_h#1{\syst_boxes_math_set_nextbox{#1}\syst_boxes_phantom_make_h}
306
307\def\syst_boxes_phantom_hbox {\dowithnextboxcs\syst_boxes_phantom_make \hbox}
308\def\syst_boxes_phantom_hbox_v{\dowithnextboxcs\syst_boxes_phantom_make_v\hbox}
309\def\syst_boxes_phantom_hbox_h{\dowithnextboxcs\syst_boxes_phantom_make_h\hbox}
310
311\def\syst_boxes_phantom_text #1{\setbox\nextbox\hbox{#1}\syst_boxes_phantom_make }
312\def\syst_boxes_phantom_text_v#1{\setbox\nextbox\hbox{#1}\syst_boxes_phantom_make_v}
313\def\syst_boxes_phantom_text_h#1{\setbox\nextbox\hbox{#1}\syst_boxes_phantom_make_h}
314
315\def\syst_boxes_phantom_indeed
316 {\ifmmode
317 \expandafter\syst_boxes_phantom_math
318 \orelse\ifx\nexttoken\bgroup
319 \expandafter\syst_boxes_phantom_hbox
320 \else
321 \expandafter\syst_boxes_phantom_text
322 \fi}
323
324\def\syst_boxes_phantom_indeed_v
325 {\ifmmode
326 \expandafter\syst_boxes_phantom_math_v
327 \orelse\ifx\nexttoken\bgroup
328 \expandafter\syst_boxes_phantom_hbox_v
329 \else
330 \expandafter\syst_boxes_phantom_text_v
331 \fi}
332
333\def\syst_boxes_phantom_indeed_h
334 {\ifmmode
335 \expandafter\syst_boxes_phantom_math_h
336 \orelse\ifx\nexttoken\bgroup
337 \expandafter\syst_boxes_phantom_hbox_h
338 \else
339 \expandafter\syst_boxes_phantom_text_h
340 \fi}
341
342\def\syst_boxes_phantom_make
343 {\setbox\scratchbox\emptyhbox
344 \ht\scratchbox\ht\nextbox
345 \dp\scratchbox\dp\nextbox
346 \wd\scratchbox\wd\nextbox
347 \box\scratchbox
348 \endgroup}
349
350\def\syst_boxes_phantom_make_v
351 {\setbox\scratchbox\emptyhbox
352 \ht\scratchbox\ht\nextbox
353 \dp\scratchbox\dp\nextbox
354 \box\scratchbox
355 \endgroup}
356
357\def\syst_boxes_phantom_make_h
358 {\setbox\scratchbox\emptyhbox
359 \wd\scratchbox\wd\nextbox
360 \box\scratchbox
361 \endgroup}
362
363
364
365\permanent\protected\def\mathstrut{\mathstack{\vphantom(}}
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399\permanent\protected\def\getboxheight#1\of#2\box#3
400 {\def\next{#1\htdp\c_boxes_register}
401 \afterassignment\next\c_boxes_register=#3}
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420\ifdefined\roundingeps \else \newdimension\roundingeps \roundingeps=10sp \fi
421
422\newinteger \noflines
423\newdimension\noflinesheight
424
425\permanent\protected\def\getnoflines#1
426 {\noflinesheight#1\relax
427 \ifzeropt\noflinesheight
428 \noflines\zerocount
429 \orelse\ifdim\noflinesheight>\zeropoint
430 \advanceby\noflinesheight\roundingeps
431 \divideby\noflinesheight\openlineheight
432 \noflines\noflinesheight
433 \advanceby\noflines\plusone
434 \else
435 \advanceby\noflinesheight\roundingeps
436 \divideby\noflinesheight\openlineheight
437 \noflines\noflinesheight
438 \advanceby\noflines\minusone
439 \fi}
440
441\permanent\protected\def\getroundednoflines#1
442 {\noflinesheight#1\relax
443 \ifzeropt\noflinesheight
444 \noflines\zerocount
445 \orelse\ifdim\noflinesheight>\zeropoint
446 \advanceby\noflinesheight\roundingeps
447 \divideby\noflinesheight\openlineheight
448 \noflines\noflinesheight
449 \else
450 \advanceby\noflinesheight\roundingeps
451 \divideby\noflinesheight\openlineheight
452 \noflines\noflinesheight
453 \fi}
454
455\permanent\protected\def\getrawnoflines#1
456 {\noflinesheight#1\relax
457 \ifzeropt\noflinesheight
458 \noflines\zerocount
459 \orelse\ifdim\noflinesheight>\zeropoint
460 \advanceby\noflinesheight\roundingeps
461 \advanceby\noflinesheight.5\openlineheight
462 \divideby\noflinesheight\openlineheight
463 \noflines\noflinesheight
464 \else
465 \advanceby\noflinesheight\roundingeps
466 \advanceby\noflinesheight.5\openlineheight
467 \divideby\noflinesheight\openlineheight
468 \noflines\noflinesheight
469 \fi}
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516\def\syst_boxes_determine_noflines
517 {\expandafter\egroup\expandafter\noflines\noflinesinbox\nextbox\relax}
518
519\permanent\protected\def\determinenoflines
520 {\bgroup
521 \forgetall
522 \enforced\let\crlf\endgraf
523 \enforced\let\\\endgraf
524 \dowithnextboxcs\syst_boxes_determine_noflines\vbox}
525
526\def\determinednoflines#1
527 {\localcontrolled{\determinenoflines{#1}}\noflines}
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550\permanent\protected\def\doifelsetext#1
551 {\begingroup
552 \setbox\scratchbox\hbox
553 {\settrialtypesetting
554 \ignorespaces#1\removeunwantedspaces}
555 \ifzeropt\wd\scratchbox
556 \endgroup\expandafter\secondoftwoarguments
557 \else
558 \endgroup\expandafter\firstoftwoarguments
559 \fi}
560
561\permanent\protected\def\doiftext#1
562 {\begingroup
563 \setbox\scratchbox\hbox
564 {\settrialtypesetting
565 \ignorespaces#1\removeunwantedspaces}
566 \ifzeropt\wd\scratchbox
567 \endgroup\expandafter\gobbleoneargument
568 \else
569 \endgroup\expandafter\firstofoneargument
570 \fi}
571
572\permanent\protected\def\validtext#1
573 {\ifparameter#1\or
574 \begingroup
575 \setbox\scratchbox\hbox
576 {\settrialtypesetting
577 \ignorespaces#1\removeunwantedspaces}
578 \normalexpanded{\endgroup\noexpand\expandafter\ifzeropt\wd\scratchbox\if_false\else\if_true\fi}
579 \else
580 \expandafter\if_false
581 \fi}
582
583
584
585
586
587
588
589
590\aliased\let\doiftextelse\doifelsetext
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625\let\syst_boxes_with_next_box\relax
626
627\permanent\protected\def\dowithnextbox#1
628 {\def\syst_boxes_with_next_box{#1}
629 \afterassignment\syst_boxes_with_next_box_indeed
630 \setbox\nextbox}
631
632\def\syst_boxes_with_next_box_indeed
633 {\aftergroup\syst_boxes_with_next_box}
634
635\permanent\protected\def\dowithnextboxcs#1
636 {\let\syst_boxes_with_next_box#1
637 \afterassignment\syst_boxes_with_next_box_indeed
638 \setbox\nextbox}
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680\permanent\def\nextboxht {\ht\nextbox}
681\permanent\def\nextboxwd {\wd\nextbox}
682\permanent\def\nextboxdp {\dp\nextbox}
683\permanent\def\nextboxhtdp{\htdp\nextbox}
684
685\permanent\protected\def\flushnextbox{\box\nextbox}
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714\permanent\protected\def\dowithnextboxcontent#1#2
715 {\afterassigned{#1\aftergrouped{#2}}
716 \setbox\nextbox}
717
718\permanent\protected\def\dowithnextboxcontentcs#1#2
719 {\afterassigned{#1\aftergroup#2}
720 \setbox\nextbox}
721
722
723
724
725
726
727
728\def\syst_boxes_do_rlap{\hpack to \zeropoint{\box\nextbox\hss}\endgroup}
729\def\syst_boxes_do_llap{\hpack to \zeropoint{\hss\box\nextbox}\endgroup}
730\def\syst_boxes_do_clap{\hpack to \zeropoint{\hss\box\nextbox\hss}\endgroup}
731\def\syst_boxes_do_tlap{\vpack to \zeropoint{\vss\box\nextbox}\endgroup}
732\def\syst_boxes_do_blap{\vpack to \zeropoint{\box\nextbox\vss}\endgroup}
733
734\protected\def\syst_boxes_rlap{\begingroup\dowithnextboxcs\syst_boxes_do_rlap\hbox}
735\protected\def\syst_boxes_llap{\begingroup\dowithnextboxcs\syst_boxes_do_llap\hbox}
736\protected\def\syst_boxes_clap{\begingroup\dowithnextboxcs\syst_boxes_do_clap\hbox}
737
738
739
740
741
742
743
744
745
746\def\syst_boxes_math_xlap#1#2
747 {\normalexpanded{#1\bgroup\normalstartimath\givenmathstyle\the\mathstyle}
748
749 \mathsurround\zeropoint#2
750 \normalstopimath\egroup}
751
752\def\syst_boxes_math_clap{\syst_boxes_math_xlap\syst_boxes_clap}
753\def\syst_boxes_math_llap{\syst_boxes_math_xlap\syst_boxes_llap}
754\def\syst_boxes_math_rlap{\syst_boxes_math_xlap\syst_boxes_rlap}
755
756\permanent\protected\def\rlap{\mathortext\syst_boxes_math_rlap\syst_boxes_rlap}
757\permanent\protected\def\llap{\mathortext\syst_boxes_math_llap\syst_boxes_llap}
758\permanent\protected\def\clap{\mathortext\syst_boxes_math_clap\syst_boxes_clap}
759
760\permanent\protected\def\tlap{\begingroup\dowithnextboxcs\syst_boxes_do_tlap\vbox}
761\permanent\protected\def\blap{\begingroup\dowithnextboxcs\syst_boxes_do_blap\vbox}
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
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
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882\newif \ifsomeshapeleft
883\newif \ifreshapingbox
884\newif \ifreshapingfailed
885
886\newbox \shapebox
887\newinteger \shapepenalty
888\newdimension\shapekern
889\newgluespec \shapeskip
890\newbox \newshapebox
891\newbox \oldshapebox
892\newbox \tmpshapebox
893\newinteger \shapecounter
894\newevery \everyshapebox \relax
895
896\permanent\dimensiondef\shapesignal.12345678pt
897
898\permanent\protected\def\reshapebox#1
899 {\doreshapebox
900 {#1}
901 {\penalty\shapepenalty}
902 {\kern \shapekern }
903 {\vskip \shapeskip }}
904
905\permanent\protected\def\doreshapebox#1#2#3#4
906 {\global\reshapingfailedfalse
907 \ifzeropt\ht\oldshapebox
908 \setbox\newshapebox\emptyvbox
909 \else
910 \setbox\newshapebox\vbox
911 {\unvcopy\oldshapebox
912 \setbox\newshapebox\emptybox
913 \shapecounter\zerocount
914 \doloop{\dodoreshapebox{#1}{#2}{#3}{#4}}}
915 \setbox\newshapebox\box\tmpshapebox
916 \fi}
917
918
919
920\permanent\protected\def\insertshapesignal
921 {\hpack to \shapesignal{\strut\hss}
922 \prevdepth\strutdp}
923
924\permanent\protected\def\restoreshapebox
925 {\global\setbox\tmpshapebox\vbox{\vskip\lineheight\unvcopy\oldshapebox}}
926
927\permanent\def\dodoreshapebox#1#2#3#4
928 {\ifnum\lastnodetype=\gluenodecode
929 \shapeskip\lastskip
930 \global\setbox\tmpshapebox\vbox{#4\unvbox\tmpshapebox}
931 \unskip
932 \orelse\ifnum\lastnodetype=\kernnodecode
933 \shapekern\lastkern
934 \global\setbox\tmpshapebox\vbox{#3\unvbox\tmpshapebox}
935 \unkern
936 \orelse\ifnum\lastnodetype=\penaltynodecode
937 \shapepenalty\lastpenalty
938 \global\setbox\tmpshapebox\vbox{#2\unvbox\tmpshapebox}
939 \unpenalty
940 \orelse\ifnum\lastnodetype<\zeropoint
941 \exitloop
942 \else
943 \setbox\shapebox\lastbox
944 \ifvoid\shapebox
945 \orelse\ifdim\wd\shapebox=\shapesignal\relax
946 \exitloop
947 \else
948 \shapecounter\zerocount
949 \global\setbox\tmpshapebox\vbox{#1\unvbox\tmpshapebox}
950 \fi
951 \fi
952 \ifnum\shapecounter>100
953 \global\reshapingfailedtrue
954 \message{!!forced exit from shapebox \the\lastnodetype !!}
955 \restoreshapebox
956 \exitloop
957 \else
958 \advanceby\shapecounter \plusone
959 \fi}
960
961\permanent\protected\def\beginofshapebox
962 {\setbox\oldshapebox\vbox
963 \bgroup
964 \reshapingboxtrue
965 \expand\everyshapebox
966 \insertshapesignal}
967
968\permanent\protected\def\endofshapebox
969 {\endgraf
970 \egroup}
971
972\aliased\let\beginshapebox\beginofshapebox
973\aliased\let\endshapebox \endofshapebox
974
975\permanent\protected\def\flushshapebox
976 {\bgroup
977 \ifzeropt\ht\newshapebox
978 \else
979
980
981 \ifdim\parskip>\zeropoint\vskip\parskip\else\par\fi
982
983 \ifdim\prevdepth=\thousandpoint
984 \prevdepth\zeropoint
985 \fi
986 \ifdim\prevdepth<\zeropoint\relax
987
988 \donetrue
989 \orelse\ifinner
990
991 \donefalse
992 \orelse\ifdim\pagegoal=\maxdimen
993 \donetrue
994 \else
995
996 \donetrue
997 {\forgeteverypar\verticalstrut}\nobreak
998 \kern\struttotal
999 \kern\parskip
1000
1001 \fi
1002 \scratchdimen\dp\newshapebox
1003 \unvbox\newshapebox
1004
1005 \kern\scratchdimen
1006
1007 \ifdone
1008 \kern\strutdp
1009 \prevdepth\strutdp
1010 \fi
1011 \fi
1012 \egroup}
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026\permanent\protected\def\innerflushshapebox
1027 {\ifzeropt\ht\newshapebox \else
1028 \unvcopy\newshapebox\relax
1029
1030 \fi}
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049\permanent\protected\def\shapedhbox
1050 {\normalexpanded{\dowithnextbox
1051 {\ht\nextbox\the\ht\shapebox
1052 \dp\nextbox\the\dp\shapebox
1053 \box\nextbox}}
1054 \hbox}
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071\permanent\protected\def\doshowhyphenatednextbox
1072 {\clf_showhyphenatedinlist\nextbox}
1073
1074\permanent\protected\def\showhyphens
1075 {\dowithnextboxcs\doshowhyphenatednextbox\hpack}
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085\def\syst_boxes_hyphenatednextbox {\clf_hyphenatedlist\nextbox false\relax\unhbox\nextbox}
1086\def\syst_boxes_hyphenatednextboxcolor{\clf_hyphenatedlist\nextbox true \relax\unhbox\nextbox}
1087
1088\permanent\protected\def\hyphenatedword {\dowithnextboxcs\syst_boxes_hyphenatednextbox\hbox}
1089\permanent\protected\def\hyphenatedpar {\dowithnextboxcs\syst_boxes_hyphenatednextbox\hbox}
1090\permanent\protected\def\hyphenatedfile #1{\dowithnextboxcs\syst_boxes_hyphenatednextbox\hbox{\readfile{#1}\donothing\donothing}}
1091\permanent\protected\def\hyphenatedcoloredword{\dowithnextboxcs\syst_boxes_hyphenatednextboxcolor\hbox}
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122\mutable\lettonothing\nextprocessedtoken
1123
1124\mutable\let\before \relax
1125
1126\mutable\let\after \relax
1127\mutable\let\white \relax
1128
1129\permanent\protected\def\processtokens#1#2#3#4#5
1130 {\begingroup
1131 \enforced\permanent\def\space{ }
1132 \enforced\let\\\space
1133 \enforced\def\before {#1}
1134 \enforced\def\between{#2}
1135 \enforced\def\after {#3}
1136 \enforced\def\white {#4}
1137 \enforced\let\m_syst_boxes_before\before
1138 \syst_boxes_processtokens#5\s!e_o_t_token
1139 \endgroup}
1140
1141\def\syst_boxes_processtokens
1142 {\afterassignment\syst_boxes_do_processtokens\let\nextprocessedtoken= }
1143
1144\def\syst_boxes_redo_processedtoken
1145 {\dowithnextbox
1146 {\before{\copy\nextbox}
1147 \enforced\let\before\between
1148 \syst_boxes_processtokens}
1149 \hbox\bgroup}
1150
1151\def\syst_boxes_do_processtokens
1152 {\ifx\nextprocessedtoken\s!e_o_t_token
1153 \after
1154 \orelse\ifx\nextprocessedtoken\bgroup
1155 \expandafter\syst_boxes_redo_processedtoken
1156 \else
1157 \expandafter\if\space\nextprocessedtoken
1158 \after\white
1159 \enforced\let\before\m_syst_boxes_before
1160 \else
1161 \before\nextprocessedtoken
1162 \enforced\let\before\between
1163 \fi
1164 \expandafter\syst_boxes_processtokens
1165 \fi}
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185\def\syst_boxes_boundtext#1
1186 {\setbox\scratchboxone\hbox{#1}
1187 \advanceby\scratchdimen \wd\scratchboxone
1188 \ifdim\scratchdimen>\zeropoint\relax#1\fi}
1189
1190\permanent\protected\def\doboundtext#1#2#3
1191 {\hbox
1192 {\setbox\scratchbox\hbox{#1}
1193 \scratchdimen#2\relax
1194 \ifdim\wd\scratchbox>\scratchdimen
1195 \setbox\scratchbox\hbox{#3}
1196 \advanceby\scratchdimen \wd\scratchbox
1197 \handletokens#1\with\syst_boxes_boundtext
1198 \fi
1199 \box\scratchbox}}
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216\ifdefined\fakecompoundhyphen\else \let\fakecompoundhyphen\relax \fi
1217\ifdefined\veryraggedright \else \def\veryraggedright{\raggedright} \fi
1218
1219
1220
1221\lettonothing\m_syst_boxes_left
1222\lettonothing\m_syst_boxes_right
1223
1224\permanent\protected\def\limitatetext#1#2#3
1225 {
1226 \splitatcomma{#2}\m_syst_boxes_left\m_syst_boxes_right
1227 \limitated
1228 \ifempty\m_syst_boxes_left\else
1229 left \m_syst_boxes_left
1230 \fi
1231 \ifempty\m_syst_boxes_right\else
1232 right \m_syst_boxes_right
1233 \fi
1234 strip true
1235 sentinel {#3}
1236 text {#1}
1237 \relax}
1238
1239
1240
1241
1242
1243
1244
1245\permanent\protected\def\limitatefirstline#1#2#3
1246 {\hbox\bgroup\strut
1247 \setbox\scratchbox\hbox{\begstrut#1\endstrut}
1248 \ifdim\wd\scratchbox>#2\relax
1249 \setbox\scratchbox\hbox{#3}
1250 \hsize#2\relax
1251 \advanceby\hsize\wd\scratchbox
1252 \setbox\scratchbox\vbox{\forgetall\veryraggedright#1}
1253 \setbox\scratchbox\vsplit\scratchbox to \lineheight
1254 \vbox
1255 {\unvbox\scratchbox
1256 \global\setbox\plusone\lastbox
1257 \global\setbox\plusone\hbox{\strut\unhbox\plusone}
1258 \hbox
1259 {\unless\ifdefined\clip
1260 \box\plusone
1261 \orelse\ifdim\wd\plusone>\hsize
1262 \lower\strutdepth\hpack{\clip[\c!width=\hsize,\c!height=\lineheight]{\hpack{\raise\strutdepth\box\plusone}}}
1263 \else
1264 \box\plusone
1265 \fi
1266 \removeunwantedspaces#3}}
1267 \else
1268 #1
1269 \fi
1270 \egroup}
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288\permanent\protected\def\processisolatedchars#1#2
1289 {\dontleavehmode
1290 \begingroup
1291 \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}
1292 \setbox\scratchbox\hbox{\restorecurrentattributes{pic}#1}
1293 \clf_applytobox
1294 method {char}
1295 box \scratchbox
1296 command {\csstring#2}
1297 nested true
1298 \relax
1299 \endgroup}
1300
1301\permanent\protected\def\processisolatedwords#1#2
1302 {\dontleavehmode
1303 \begingroup
1304 \setbox\scratchbox\hbox{\settrialtypesetting#2{\savecurrentattributes{pic}}}
1305 \setbox\scratchbox\hbox{\restorecurrentattributes{pic}#1}
1306 \clf_applytobox
1307 method {word}
1308 box \scratchbox
1309 command {\csstring#2}
1310 nested true
1311 \relax
1312 \endgroup}
1313
1314
1315
1316\permanent\protected\def\applytocharacters#1
1317 {\dontleavehmode
1318 \dowithnextbox{\clf_applytobox
1319 method {char}
1320 box \nextbox
1321 command {\csstring#1}
1322 nested true
1323 \relax}
1324 \hbox}
1325
1326\permanent\protected\def\applytowords#1
1327 {\dontleavehmode
1328 \dowithnextbox{\clf_applytobox
1329 method {word}
1330 box \nextbox
1331 command {\csstring#1}
1332 nested true
1333 \relax}
1334 \hbox}
1335
1336
1337
1338\permanent\protected\def\processwords#1
1339 {\processisolatedwords{#1}\processword}
1340
1341\mutable\let\processword\relax
1342
1343\permanent\protected\def\applytosplitstringchar#1#2
1344 {\dontleavehmode\clf_processsplit
1345 data {#2}
1346 command {\csstring#1}
1347 method {char}
1348 \relax}
1349
1350\permanent\protected\def\applytosplitstringword#1#2
1351 {\dontleavehmode\clf_processsplit
1352 data {#2}
1353 command {\csstring#1}
1354 method {word}
1355 \relax}
1356
1357\permanent\protected\def\applytosplitstringline#1#2
1358 {\dontleavehmode\clf_processsplit
1359 data {#2}
1360 command {\csstring#1}
1361 method {line}
1362 \relax}
1363
1364\permanent\protected\def\applytosplitstringcharspaced#1#2
1365 {\dontleavehmode\clf_processsplit
1366 data {#2}
1367 command {\csstring#1}
1368 method {char}
1369 spaced true
1370 \relax}
1371
1372\permanent\protected\def\applytosplitstringwordspaced#1#2
1373 {\dontleavehmode\clf_processsplit
1374 data {#2}
1375 command {\csstring#1}
1376 method {word}
1377 spaced true
1378 \relax}
1379
1380\permanent\protected\def\applytosplitstringlinespaced#1#2
1381 {\dontleavehmode\clf_processsplit
1382 data {#2}
1383 command {\csstring#1}
1384 method {line}
1385 spaced true
1386 \relax}
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413\permanent\protected\def\sbox
1414 {\vpack\bgroup
1415 \dowithnextboxcs\syst_boxes_sbox_finish\vbox}
1416
1417\def\syst_boxes_sbox_finish
1418 {\boxyoffset\nextbox\strutdp
1419 \dp\nextbox\strutdp
1420 \ht\nextbox\strutht
1421 \box\nextbox
1422 \egroup}
1423
1424
1425
1426
1427
1428
1429
1430\permanent\protected\def\inlinedbox
1431 {\bgroup
1432 \dowithnextboxcs\syst_boxes_inlined_finish\hbox}
1433
1434\def\syst_boxes_inlined_finish
1435 {\boxyoffset\nextbox\dimexpr(\htdp\nextbox\lineheight)\plustwo\strutdp\relax
1436 \ht\nextbox\strutht
1437 \dp\nextbox\strutdp
1438 \box\nextbox
1439 \egroup}
1440
1441
1442
1443
1444
1445
1446\permanent\protected\def\struttedbox
1447 {\hpack\bgroup
1448 \dowithnextboxcs\syst_boxes_struttedbox_finish\hbox}
1449
1450\def\syst_boxes_struttedbox_finish
1451 {\dp\nextbox\strutdepth
1452 \ht\nextbox\strutheight
1453 \box\nextbox
1454 \egroup}
1455
1456
1457
1458
1459
1460
1461
1462\permanent\protected\def\topskippedbox
1463 {\hpack\bgroup\dowithnextboxcs\syst_boxes_topskippedbox_finish\hbox}
1464
1465\def\syst_boxes_topskippedbox_finish
1466 {\edef\m_boxes_tmp{\ifdim\strutdepth=\dp\nextbox\dp\nextbox\the\dp\nextbox\fi}
1467 \lower\topskip\hpack{\raise\strutheight\box\nextbox}
1468 \m_boxes_tmp
1469 \egroup}
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514\permanent\protected\def\centeredbox#1#
1515 {\bgroup
1516 \dontcomplain
1517 \forgetall
1518 \scangivendimensions#1\relax
1519 \advanceby\vsize\givenheight
1520 \advanceby\hsize\givenwidth
1521 \dowithnextboxcs\syst_boxes_centered_finish
1522 \hbox}
1523
1524\def\syst_boxes_centered_finish
1525 {\boxxoffset\nextbox.5\dimexpr
1526 \hsize
1527 \wd\nextbox
1528 \givenwidth
1529 \relax
1530 \boxyoffset\nextbox.5\dimexpr
1531 \vsize
1532 \ht\nextbox
1533 \dp\nextbox
1534 \givenheight
1535 \relax
1536 \wd\nextbox\dimexpr\hsize\givenwidth \relax
1537 \ht\nextbox\dimexpr\vsize\givenheight\relax
1538 \dp\nextbox\zeropoint
1539 \box\nextbox
1540 \egroup}
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551\permanent\protected\def\centerednextbox#1#
1552 {\bgroup
1553 \dowithnextbox
1554 {\hsize\wd\nextbox
1555 \vsize\ht\nextbox
1556 \centeredbox#1{\box\nextbox}
1557 \egroup}
1558 \hbox}
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572\permanent\protected\def\centerbox#1#
1573 {\bgroup
1574 \dowithnextbox
1575 {\setlocalhsize
1576 \setbox\scratchbox\hpack{\vrule\s!width \zeropoint#1}
1577 \ifzeropt\wd\scratchbox\else\hsize\wd\scratchbox\fi
1578 \setbox\scratchbox\vpack{\hrule\s!height\zeropoint#1}
1579 \ifzeropt\ht\scratchbox\else\vsize\ht\scratchbox\fi
1580 \vpack to \vsize{\vss\hpack to \hsize{\hss\box\nextbox\hss}\vss}
1581 \egroup}
1582 \hbox}
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598\newif\ifalignrigidcolumns
1599\newif\ifstretchrigidcolumns
1600\newif\iftightrigidcolumns
1601
1602\mutable\let\rigidcolumnlines\!!zerocount
1603
1604\newbox \rigidcolumnbox
1605\newdimension\rigidhsize
1606\newinteger \rigidcolumns
1607
1608\permanent\protected\def\setrigidcolumnhsize#1#2#3
1609 {\global\rigidhsize\hsize
1610 \global\rigidcolumns#3\relax
1611 \hsize#1\relax
1612 \scratchdimen #2\relax
1613 \multiplyby\scratchdimen #3\relax
1614 \advanceby\scratchdimen #2\relax
1615 \advanceby\hsize \scratchdimen
1616 \divideby\hsize #3\relax}
1617
1618
1619
1620
1621
1622
1623
1624
1625\permanent\protected\def\rigidcolumnbalance#1
1626 {\ifnum\rigidcolumns=1
1627 \ifinner\ifhmode\box\else\unvbox\fi\else\unvbox\fi#1\relax
1628 \else
1629 \vbox
1630 {\forgetall
1631 \nopenalties
1632 \dontcomplain
1633 \setbox\rigidcolumnbox\vbox
1634 {\line{}\goodbreak\unvbox#1\removebottomthings}
1635 \splittopskip\openstrutheight
1636 \setbox\scratchbox\vsplit\rigidcolumnbox to \zeropoint
1637 \ifcase\rigidcolumnlines\relax
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648 \scratchdimen\ht\rigidcolumnbox
1649 \divideby\scratchdimen \rigidcolumns
1650 \getnoflines\scratchdimen
1651
1652 \else
1653 \noflines\rigidcolumnlines
1654 \fi
1655 \scratchdimen\noflines\lineheight
1656
1657
1658
1659 \setbox0=\box\rigidcolumnbox
1660 \ifvoid0\else
1661 \doloop
1662 {\setbox\rigidcolumnbox=\copy0
1663 \setbox\scratchbox\hpack to \rigidhsize
1664 {\dorecurse\rigidcolumns
1665 {\setbox\scratchbox\vsplit\rigidcolumnbox to \scratchdimen
1666 \dp\scratchbox\openstrutdepth
1667 \setbox\scratchbox\vtop
1668 \ifalignrigidcolumns to
1669 \ifstretchrigidcolumns\vsize\else\scratchdimen\fi
1670 \fi
1671 {\unvbox\scratchbox}
1672 \wd\scratchbox\hsize
1673 \box\scratchbox
1674 \hfill}
1675 \hfillneg}
1676 \ifvoid\rigidcolumnbox\exitloop\else\advanceby\scratchdimen\lineheight\fi}
1677 \iftightrigidcolumns
1678 \setbox\scratchbox\hpack{\raise\dp\scratchbox\box\scratchbox}
1679 \else
1680 \advanceby\scratchdimen \openstrutdepth
1681 \setbox\scratchbox\hpack{\raise\scratchdimen\box\scratchbox}
1682 \dp\scratchbox\openstrutdepth
1683 \ht\scratchbox\scratchdimen
1684 \fi
1685 \box\scratchbox
1686 \fi}
1687 \fi}
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712\newdimension\vboxtohboxslack
1713\newdimension\hboxestohboxslack
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750\newbox\d_syst_boxes_separator
1751
1752\permanent\protected\def\startvboxtohboxseparator
1753 {\setbox\d_syst_boxes_separator\hbox attr \vboxtohboxseparatorattribute\plusone\bgroup}
1754
1755\permanent\protected\def\stopvboxtohboxseparator
1756 {\egroup}
1757
1758\permanent\protected\def\startvboxtohbox
1759 {\begingroup
1760 \setbox\scratchbox\hbox\bgroup}
1761
1762\permanent\protected\def\stopvboxtohbox
1763 {\ifvoid\d_syst_boxes_separator
1764 \hskip\zeropoint\ifcase\vboxtohboxslack\else\s!minus\vboxtohboxslack\fi
1765 \else
1766 \box\d_syst_boxes_separator
1767 \fi
1768 \egroup
1769 \clf_hboxtovbox\scratchbox
1770 \box\scratchbox
1771 \endgroup}
1772
1773
1774
1775\permanent\protected\def\convertvboxtohbox
1776 {\makehboxofhboxes
1777 \setbox\scratchboxone\hpack{\unhbox\scratchboxone\removehboxes}
1778 \noindent\unhbox\scratchboxone\par}
1779
1780\permanent\protected\def\makehboxofhboxes
1781 {\setbox\scratchboxone\emptyhbox
1782 \loop
1783 \setbox\scratchboxtwo\lastbox
1784 \ifhbox\scratchboxtwo
1785 \setbox\scratchboxone\hpack{\box\scratchboxtwo\unhbox\scratchboxone}
1786 \repeat}
1787
1788\permanent\protected\def\removehboxes
1789 {\setbox\scratchboxone\lastbox
1790 \ifhbox\scratchboxone
1791 {\removehboxes}\unhbox\scratchboxone
1792 \fi}
1793
1794
1795
1796\permanent\protected\def\starthboxestohbox
1797 {\bgroup
1798 \setbox\scratchbox\vbox\bgroup}
1799
1800\permanent\protected\def\stophboxestohbox
1801 {\egroup
1802 \clf_vboxlisttohbox\scratchbox\nextbox\dimexpr\hboxestohboxslack\relax
1803 \dontleavehmode
1804 \unhbox\nextbox
1805 \removeunwantedspaces
1806 \par
1807 \egroup}
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818\newbox \unhhedbox
1819\newbox \hhbox
1820\newdimension\lasthhboxwidth
1821\newgluespec \hhboxindent
1822
1823\permanent\protected\def\unhhbox#1\with#2
1824 {\bgroup
1825 \nopenalties
1826 \dontcomplain
1827 \forgetall
1828 \setbox\unhhedbox\vbox{\hskip\hhboxindent\strut\unhbox#1}
1829 \doloop
1830 {\setbox\hhbox\vsplit\unhhedbox to \lineheight
1831 \ifvoid\unhhedbox
1832 \setbox\hhbox\hbox{\strut\hboxofvbox\hhbox}
1833 \fi
1834 \ht\hhbox\strutht
1835 \dp\hhbox\strutdp
1836 \ifzeropt\hhboxindent\else
1837 \setbox\hhbox\hpack{\kern\hhboxindent\box\hhbox}
1838 \hhboxindent\zeropoint
1839 \fi
1840 \global\lasthhboxwidth\wd\hhbox
1841 #2\relax
1842 \ifvoid\unhhedbox
1843 \exitloop
1844 \else
1845 \hskip\zeropoint \s!plus \zeropoint
1846 \fi}
1847 \egroup}
1848
1849\def\syst_boxes_hboxofvbox
1850 {\setbox0\vpack{\unvbox\scratchcounter\global\setbox1\lastbox}
1851 \unhbox1
1852 \egroup}
1853
1854\permanent\protected\def\hboxofvbox
1855 {\bgroup
1856 \afterassignment\syst_boxes_hboxofvbox
1857 \scratchcounter=}
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897\permanent\protected\def\doifcontent#1#2#3
1898 {\dowithnextbox
1899 {\ifhbox\nextbox
1900 \ifdim\wd\nextbox>\zeropoint
1901 #1\unhbox\nextbox#2\relax
1902 \else
1903 #3\relax
1904 \fi
1905 \else
1906 \ifdim\ht\nextbox>\zeropoint
1907 #1\unvbox\nextbox#2\relax
1908 \else
1909 #3\relax
1910 \fi
1911 \fi}}
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938\newbox\processbox
1939
1940\let\syst_boxes_process_indeed\relax
1941
1942\permanent\protected\def\processboxes#1
1943 {\bgroup
1944 \def\syst_boxes_process_indeed{#1}
1945 \setbox\processbox\emptybox
1946 \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop}
1947
1948\def\syst_boxes_process_yes
1949 {\dowithnextboxcs\syst_boxes_process_content\hbox}
1950
1951\def\syst_boxes_process_content
1952 {\removeunwantedspaces
1953 \syst_boxes_process_indeed
1954 \doifelsenextbgroup\syst_boxes_process_yes\syst_boxes_process_nop}
1955
1956\protected\def\syst_boxes_process_nop
1957 {\removeunwantedspaces
1958 \box\processbox
1959 \egroup}
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980\permanent\def\boxisempty#1
1981 {\ifdim\wd#1=\zeropoint
1982 \ifdim\ht#1=\zeropoint
1983 \ifdim\dp#1=\zeropoint
1984 \zerocount
1985 \else
1986 \plusone
1987 \fi
1988 \else
1989 \plusone
1990 \fi
1991 \else
1992 \plusone
1993 \fi}
1994
1995\def\syst_boxes_overlay_process
1996 {\ifcase\boxisempty\nextbox\else
1997 \syst_boxes_overlay_process_indeed
1998 \fi}
1999
2000\def\syst_boxes_overlay_process_indeed
2001 {
2002 \scratchdepth\dp\ifdim\dp\nextbox>\dp\processbox\nextbox\else\processbox\fi
2003 \ifdim\ht\nextbox>\ht\processbox
2004 \setbox\processbox\vpack to \ht\nextbox {\dp\processbox\zeropoint\vss\box\processbox\vss}
2005 \else
2006 \setbox\nextbox \vpack to \ht\processbox{\dp\nextbox \zeropoint\vss\box\nextbox \vss}
2007 \fi
2008 \dp\nextbox \scratchdepth
2009 \dp\processbox\scratchdepth
2010 \scratchwidth\wd\ifdim\wd\nextbox>\wd\processbox\nextbox\else\processbox\fi
2011 \setbox\processbox\hpack to \scratchwidth
2012 {\hpack to \scratchwidth{\hss\box\processbox\hss}
2013 \kern\scratchwidth
2014 \hpack to \scratchwidth{\hss\box\nextbox \hss}}}
2015
2016\permanent\protected\def\startoverlay
2017 {\vbox\bgroup
2018 \enforced\aliased\let\stopoverlay\egroup
2019 \processboxes\syst_boxes_overlay_process}
2020
2021\permanent\protected\lettonothing\stopoverlay
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034\permanent\protected\def\fakebox
2035 {\bgroup
2036 \afterassignment\syst_boxes_fakebox_finish\scratchcounter}
2037
2038\def\syst_boxes_fakebox_finish
2039 {\setbox\scratchbox\ifhbox\scratchcounter\emptyhbox\else\emptyvbox\fi
2040 \wd\scratchbox\wd\scratchcounter
2041 \ht\scratchbox\ht\scratchcounter
2042 \dp\scratchbox\dp\scratchcounter
2043 \box\scratchbox
2044 \egroup}
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061\def\syst_boxes_lrc_process#1
2062 {\bgroup
2063 \forgetall
2064 \enforced\let\\\endgraf
2065 #1
2066 \let\nexttoken}
2067
2068\permanent\protected\def\lbox#1#{\vbox#1\syst_boxes_lrc_process\raggedleft }
2069\permanent\protected\def\cbox#1#{\vbox#1\syst_boxes_lrc_process\raggedcenter}
2070\permanent\protected\def\rbox#1#{\vbox#1\syst_boxes_lrc_process\raggedright }
2071
2072\permanent\protected\def\ltop#1#{\vtop#1\syst_boxes_lrc_process\raggedleft }
2073\permanent\protected\def\ctop#1#{\vtop#1\syst_boxes_lrc_process\raggedcenter}
2074\permanent\protected\def\rtop#1#{\vtop#1\syst_boxes_lrc_process\raggedright }
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096\permanent\protected\def\tbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_tbox_finish\hbox}
2097\permanent\protected\def\bbox{\hpack\bgroup\dowithnextboxcs\syst_boxes_bbox_finish\hbox}
2098
2099\def\syst_boxes_tbox_finish
2100 {\scratchheight\strutht
2101 \scratchdepth\dimexpr\htdp\nextbox\scratchheight\relax
2102 \ht\nextbox\scratchheight
2103 \dp\nextbox\scratchdepth
2104 \boxyoffset\nextbox\scratchdepth
2105 \box\nextbox
2106 \egroup}
2107
2108\def\syst_boxes_bbox_finish
2109 {\scratchdepth\strutdp
2110 \scratchheight\dimexpr\htdp\nextbox\scratchdepth\relax
2111 \dp\nextbox\scratchdepth
2112 \ht\nextbox\scratchheight
2113 \boxyoffset\nextbox\scratchdepth
2114 \box\nextbox
2115 \egroup}
2116
2117
2118
2119
2120
2121
2122\def\syst_boxes_lhbox{\hpack to \hsize{\box\nextbox\hss }}
2123\def\syst_boxes_mhbox{\hpack to \hsize{\hss\box\nextbox\hss}}
2124\def\syst_boxes_rhbox{\hpack to \hsize{\hss\box\nextbox }}
2125
2126\permanent\protected\def\lhbox{\dowithnextboxcs\syst_boxes_lhbox\hbox}
2127\permanent\protected\def\mhbox{\dowithnextboxcs\syst_boxes_mhbox\hbox}
2128\permanent\protected\def\rhbox{\dowithnextboxcs\syst_boxes_rhbox\hbox}
2129
2130\aliased\let\lefthbox \lhbox
2131\aliased\let\midhbox \mhbox
2132\aliased\let\righthbox\rhbox
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147\newdimension\sizeofbox
2148
2149\permanent\protected\def\boxofsize#1
2150 {\bgroup
2151 \sizeofbox\zeropoint
2152 \scratchdimen\zeropoint
2153 \def\docommand
2154 {\advanceby\sizeofbox\scratchdimen
2155 \futurelet\nexttoken\dodocommand}
2156 \def\dodocommand
2157 {\ifx\nexttoken\bgroup
2158 \normalexpanded{\egroup#1 to \the\sizeofbox}
2159 \else
2160 \expandafter\afterassignment\expandafter\docommand\expandafter\scratchdimen
2161 \fi}
2162 \docommand}
2163
2164
2165
2166
2167
2168
2169
2170
2171\permanent\protected\def\limitatelines#1#2
2172 {\dowithnextbox
2173 {\scratchdimen#1\hsize
2174 \ifdim\wd\nextbox>\scratchdimen
2175 \setbox\nextbox\hbox
2176 {\advanceby\scratchdimen .1\hsize
2177 \limitatetext{\unhbox\nextbox}{\scratchdimen}{\nobreak#2}}
2178 \fi
2179 \unhbox\nextbox}
2180 \hbox}
2181
2182\permanent\protected\def\fittoptobaselinegrid
2183 {\dowithnextbox
2184 {\bgroup
2185 \par
2186 \scratchdimen\ht\nextbox
2187 \ht\nextbox\strutht
2188 \dp\nextbox\strutdp
2189 \hpack{\box\nextbox}
2190 \prevdepth\strutdp
2191 \doloop
2192 {\advanceby\scratchdimen \lineheight
2193 \ifdim\scratchdimen<\zeropoint
2194 \exitloop
2195 \else
2196 \nobreak
2197 \hpack{\strut}
2198 \fi}
2199 \egroup}
2200 \vbox}
2201
2202
2203
2204\newif\iftraceboxplacement
2205
2206\newbox\fakedboxcursor
2207
2208\setbox\fakedboxcursor\hpack
2209 {\vrule\s!width\zeropoint\s!height\zeropoint\s!depth\zeropoint}
2210
2211\permanent\protected\def\boxcursor
2212 {\iftraceboxplacement
2213 \bgroup
2214 \scratchdimen2\onepoint
2215 \setbox\scratchbox\hpack to \zeropoint
2216 {\hss
2217 \vrule
2218 \s!width \scratchdimen
2219 \s!height\scratchdimen
2220 \s!depth \scratchdimen
2221 \hss}
2222 \smashedbox\scratchbox
2223 \egroup
2224 \else
2225 \copy\fakedboxcursor
2226 \fi}
2227
2228\permanent\protected\def\placedbox
2229 {\iftraceboxplacement\ruledhbox\else\hbox\fi}
2230
2231\newdimension\boxoffset
2232\newdimension\boxhdisplacement
2233\newdimension\boxvdisplacement
2234
2235\permanent\protected\def\rightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbox_finish \placedbox}
2236\permanent\protected\def\leftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbox_finish \placedbox}
2237\permanent\protected\def\topbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_topbox_finish \placedbox}
2238\permanent\protected\def\bottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_bottombox_finish \placedbox}
2239\permanent\protected\def\lefttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_lefttopbox_finish \placedbox}
2240\permanent\protected\def\righttopbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_righttopbox_finish \placedbox}
2241\permanent\protected\def\leftbottombox {\hpack\bgroup\dowithnextboxcs\syst_boxes_leftbottombox_finish \placedbox}
2242\permanent\protected\def\rightbottombox{\hpack\bgroup\dowithnextboxcs\syst_boxes_rightbottombox_finish\placedbox}
2243
2244\aliased\let\topleftbox \lefttopbox
2245\aliased\let\toprightbox \righttopbox
2246\aliased\let\bottomleftbox \leftbottombox
2247\aliased\let\bottomrightbox\rightbottombox
2248
2249\def\syst_boxes_rightbox_finish
2250 {\global\boxhdisplacement\boxoffset
2251 \global\boxvdisplacement.5\dimexpr\ht\nextbox\dp\nextbox\relax
2252 \boxcursor
2253 \boxxmove\nextbox \boxhdisplacement
2254 \boxymove\nextbox\boxvdisplacement
2255 \box\nextbox
2256 \egroup}
2257
2258\def\syst_boxes_leftbox_finish
2259 {\global\boxhdisplacement\dimexpr\wd\nextbox\boxoffset\relax
2260 \global\boxvdisplacement.5\dimexpr\ht\nextbox\dp\nextbox\relax
2261 \boxcursor
2262 \boxxmove\nextbox \boxhdisplacement
2263 \boxymove\nextbox\boxvdisplacement
2264 \box\nextbox
2265 \egroup}
2266
2267\def\syst_boxes_topbox_finish
2268 {\global\boxhdisplacement.5\wd\nextbox
2269 \global\boxvdisplacement\dimexpr\dp\nextbox\boxoffset\relax
2270 \boxcursor
2271 \boxxmove\nextbox \boxhdisplacement
2272 \boxymove\nextbox\boxvdisplacement
2273 \box\nextbox
2274 \egroup}
2275
2276\def\syst_boxes_bottombox_finish
2277 {\global\boxhdisplacement.5\wd\nextbox
2278 \global\boxvdisplacement\dimexpr\ht\nextbox\boxoffset\relax
2279 \boxcursor
2280 \boxxmove\nextbox \boxhdisplacement
2281 \boxymove\nextbox\boxvdisplacement
2282 \box\nextbox
2283 \egroup}
2284
2285\def\syst_boxes_lefttopbox_finish
2286 {\global\boxhdisplacement\dimexpr\wd\nextbox\boxoffset\relax
2287 \global\boxvdisplacement\dimexpr\dp\nextbox\boxoffset\relax
2288 \boxcursor
2289 \boxxmove\nextbox \boxhdisplacement
2290 \boxymove\nextbox\boxvdisplacement
2291 \box\nextbox
2292 \egroup}
2293
2294\def\syst_boxes_righttopbox_finish
2295 {\global\boxhdisplacement\boxoffset
2296 \global\boxvdisplacement\dimexpr\dp\nextbox\boxoffset\relax
2297 \boxcursor
2298 \boxxmove\nextbox \boxhdisplacement
2299 \boxymove\nextbox\boxvdisplacement
2300 \box\nextbox
2301 \egroup}
2302
2303\def\syst_boxes_leftbottombox_finish
2304 {\global\boxhdisplacement\dimexpr\wd\nextbox\boxoffset\relax
2305 \global\boxvdisplacement\dimexpr\ht\nextbox\boxoffset\relax
2306 \boxcursor
2307 \boxxmove\nextbox \boxhdisplacement
2308 \boxymove\nextbox\boxvdisplacement
2309 \box\nextbox
2310 \egroup}
2311
2312\def\syst_boxes_rightbottombox_finish
2313 {\global\boxhdisplacement\boxoffset
2314 \global\boxvdisplacement\dimexpr\ht\nextbox\boxoffset\relax
2315 \boxcursor
2316 \boxxmove\nextbox \boxhdisplacement
2317 \boxymove\nextbox\boxvdisplacement
2318 \box\nextbox
2319 \egroup}
2320
2321\permanent\protected\def\middlebox {\hpack\bgroup\dowithnextboxcs\syst_boxes_middlebox_finish \placedbox}
2322\permanent\protected\def\baselinemiddlebox{\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinemiddlebox_finish\placedbox}
2323\permanent\protected\def\baselineleftbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselineleftbox_finish \placedbox}
2324\permanent\protected\def\baselinerightbox {\hpack\bgroup\dowithnextboxcs\syst_boxes_baselinerightbox_finish \placedbox}
2325
2326\def\syst_boxes_middlebox_finish
2327 {\global\boxhdisplacement.5\wd\nextbox
2328 \global\boxvdisplacement.5\dimexpr\ht\nextbox\dp\nextbox\relax
2329 \boxcursor
2330 \boxxmove\nextbox \boxhdisplacement
2331 \boxymove\nextbox\boxvdisplacement
2332 \box\nextbox
2333 \egroup}
2334
2335\def\syst_boxes_baselinemiddlebox_finish
2336 {\global\boxhdisplacement\dimexpr.5\wd\nextbox\boxoffset\relax
2337 \global\boxvdisplacement\boxoffset
2338 \boxcursor
2339 \boxxmove\nextbox \boxhdisplacement
2340 \boxymove\nextbox\boxvdisplacement
2341 \box\nextbox
2342 \egroup}
2343
2344\def\syst_boxes_baselineleftbox_finish
2345 {\global\boxhdisplacement\dimexpr\wd\nextbox\boxoffset\relax
2346 \global\boxvdisplacement\boxoffset
2347 \boxcursor
2348 \boxxmove\nextbox \boxhdisplacement
2349 \boxymove\nextbox\boxvdisplacement
2350 \box\nextbox
2351 \egroup}
2352
2353\def\syst_boxes_baselinerightbox_finish
2354 {\global\boxhdisplacement\boxoffset
2355 \global\boxvdisplacement\boxoffset
2356 \boxcursor
2357 \boxxmove\nextbox \boxhdisplacement
2358 \boxymove\nextbox\boxvdisplacement
2359 \box\nextbox
2360 \egroup}
2361
2362
2363
2364
2365
2366
2367\permanent\protected\def\lrtbbox#1#2#3#4
2368 {\bgroup
2369 \dowithnextboxcontent
2370 {\advanceby\hsize#1\advanceby\hsize#2\relax
2371 \advanceby\vsize#3\advanceby\vsize#4\relax}
2372 {\forgetall\vpack to \vsize{\vskip#3\hpack to \hsize{\hskip#1\box\nextbox\hss}\vss}\egroup}
2373 \vbox}
2374
2375
2376
2377
2378
2379
2380\permanent\protected\def\toplinebox
2381 {\dowithnextboxcs\syst_boxes_toplinebox_finish\tbox}
2382
2383\def\syst_boxes_toplinebox_finish
2384 {\ifdim\dp\nextbox>\strutdepth
2385 \scratchdimen\dp\nextbox
2386 \advanceby\scratchdimen\strutdepth
2387 \getnoflines\scratchdimen
2388 \struttedbox{\box\nextbox}
2389 \dorecurse\noflines\verticalstrut
2390 \else
2391 \box\nextbox
2392 \fi}
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416\installcorenamespace {stackbox}
2417\installcorenamespace {stacklst}
2418
2419\permanent\protected\def\setstackbox#1#2
2420 {\ifcsname\??stackbox#1:#2\endcsname\else
2421 \expandafter\newbox\csname\??stackbox#1:#2\endcsname
2422 \fi
2423 \global\setbox\csname\??stackbox#1:#2\endcsname\vbox}
2424
2425\permanent\protected\def\initializeboxstack#1
2426 {\def\docommand##1{\setstackbox{#1}{##1}{}}
2427 \ifcsname\??stacklst#1\endcsname
2428 \expandafter\processcommacommand\expandafter[\lastnamedcs]\docommand
2429 \fi
2430 \gletcsname\??stacklst#1\endcsname\empty}
2431
2432\permanent\protected\def\savebox#1#2
2433 {
2434 \ifcsname\??stacklst#1\endcsname
2435 \xdefcsname\??stacklst#1\expandafter\endcsname\expandafter{\lastnamedcs,#2}
2436 \else
2437 \xdefcsname\??stacklst#1\endcsname{#2}
2438 \fi
2439 \setstackbox{#1}{#2}}
2440
2441\permanent\protected\def\flushbox#1#2
2442 {\ifcsname\??stackbox#1:#2\endcsname
2443 \box\lastnamedcs
2444 \else
2445 \emptybox
2446 \fi}
2447
2448\permanent\protected\def\restorebox#1#2
2449 {\ifcsname\??stackbox#1:#2\endcsname
2450 \copy\lastnamedcs
2451 \else
2452 \emptybox
2453 \fi}
2454
2455\permanent\protected\def\foundbox#1#2
2456 {\vpack
2457 {\ifcsname\??stackbox#1:#2\endcsname
2458 \copy\lastnamedcs
2459 \fi}}
2460
2461\permanent\protected\def\doifelsebox#1#2
2462 {\unless\ifcsname\??stackbox#1:#2\endcsname
2463 \expandafter\secondoftwoarguments
2464 \orelse\ifvoid\lastnamedcs
2465 \expandafter\secondoftwoarguments
2466 \else
2467 \expandafter\firstoftwoarguments
2468 \fi}
2469
2470\aliased\let\doifboxelse\doifelsebox
2471
2472
2473
2474\installcorenamespace {boxstack}
2475
2476\newinteger\c_syst_boxes_stack
2477
2478\mutable\let\b_syst_boxes_stack\relax
2479
2480\protected\def\syst_boxes_stack_allocate
2481 {\newbox\b_syst_boxes_stack
2482 \letcsname\??boxstack\the\c_syst_boxes_stack\endcsname\b_syst_boxes_stack}
2483
2484\protected\def\syst_boxes_push#1#2
2485 {\global\advanceby\c_syst_boxes_stack\plusone
2486 \expandafter\let\expandafter\b_syst_boxes_stack\csname\??boxstack\the\c_syst_boxes_stack\endcsname
2487 \ifrelax\b_syst_boxes_stack
2488 \syst_boxes_stack_allocate
2489 \fi
2490 #1\setbox\b_syst_boxes_stack\box#2\relax}
2491
2492\protected\def\syst_boxes_pop#1#2
2493 {#1\setbox#2\box\csname\??boxstack\the\c_syst_boxes_stack\endcsname
2494 \global\advanceby\c_syst_boxes_stack\minusone}
2495
2496\permanent\protected\def\localpushbox {\syst_boxes_push\relax}
2497\permanent\protected\def\localpopbox {\syst_boxes_pop \relax}
2498
2499\permanent\protected\def\globalpushbox{\syst_boxes_push\global}
2500\permanent\protected\def\globalpopbox {\syst_boxes_pop \global}
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538\permanent\protected\def\removedepth
2539 {\ifvmode
2540 \ifdim\prevdepth>\zeropoint
2541 \kern\prevdepth
2542 \fi
2543 \fi}
2544
2545\permanent\protected\def\obeydepth
2546 {\par
2547 \ifvmode\ifdim\prevdepth<\zeropoint\orelse\ifdim\prevdepth<\strutdp
2548 \kern\dimexpr\strutdp\prevdepth\relax
2549 \prevdepth\strutdp
2550 \fi\fi}
2551
2552\permanent\protected\def\undepthed
2553 {\dowithnextbox{\dp\nextbox\zeropoint\box\nextbox}\hbox}
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563\permanent\protected\def\removebottomthings
2564 {\localcontrolledloop\plusone\plusfive\plusone{\unskip\unkern\unpenalty}}
2565
2566\permanent\protected\def\removelastskip
2567 {\ifvmode\ifzeropt\lastskip\else\vskip\lastskip\fi\fi}
2568
2569
2570
2571
2572
2573
2574
2575\permanent\protected\def\makestrutofbox
2576 {\afterassignment\syst_boxes_makestrutofbox\c_boxes_register}
2577
2578\def\syst_boxes_makestrutofbox
2579 {\ht\c_boxes_register\strutht
2580 \dp\c_boxes_register\strutdp
2581 \wd\c_boxes_register\zeropoint}
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594\permanent\protected\def\raisebox#1{\bgroup\afterassignment\syst_boxes_raise_indeed\scratchdimen#1}
2595\permanent\protected\def\lowerbox#1{\bgroup\afterassignment\syst_boxes_lower_indeed\scratchdimen#1}
2596
2597\def\syst_boxes_raise_indeed{\dowithnextboxcs\syst_boxes_raise_finish}
2598\def\syst_boxes_lower_indeed{\dowithnextboxcs\syst_boxes_lower_finish}
2599
2600\def\syst_boxes_raise_finish
2601 {\boxyoffset\nextbox\scratchdimen
2602 \ht\nextbox\strutht
2603 \dp\nextbox\strutdp
2604 \box\nextbox
2605 \egroup}
2606
2607\def\syst_boxes_lower_finish
2608 {\boxyoffset\nextbox\scratchdimen
2609 \ht\nextbox\strutht
2610 \dp\nextbox\strutdp
2611 \box\nextbox
2612 \egroup}
2613
2614
2615
2616\permanent\protected\def\halfwaybox
2617 {\hpack\bgroup
2618 \dowithnextboxcs\syst_boxes_halfwaybox_finish\hbox}
2619
2620\def\syst_boxes_halfwaybox_finish
2621 {\dp\nextbox\zeropoint
2622 \lower.5\ht\nextbox\box\nextbox
2623 \egroup}
2624
2625\permanent\protected\def\depthonlybox
2626 {\tpack\bgroup
2627 \dowithnextboxcs\syst_boxes_depthonlybox_finish\vbox}
2628
2629\def\syst_boxes_depthonlybox_finish
2630 {\hsize\wd\nextbox
2631 \kern\zeropoint\box\nextbox
2632 \egroup}
2633
2634
2635
2636\permanent\def\setdimentoatleast#1#2{\ifdim#1>\zeropoint\else#1=#2\fi}
2637\permanent\def\setdimentoatmost #1#2{\ifdim#1>#2\relax \else#1=#2\fi}
2638
2639
2640
2641\aliased\let\naturalvcenter\normalvtop
2642
2643
2644
2645
2646
2647
2648
2649
2650\permanent\protected\def\frozenhbox
2651 {\hpack\bgroup
2652 \dowithnextboxcs\syst_boxes_frozenhbox_finish\hbox}
2653
2654\def\syst_boxes_frozenhbox_finish
2655 {\hpack{\hpack{\box\nextbox}}
2656 \egroup}
2657
2658
2659
2660
2661
2662
2663\installcorenamespace {boxx}
2664\installcorenamespace {boxy}
2665
2666\permanent\protected\def\setboxllx #1#2{\edefcsname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
2667\permanent\protected\def\setboxlly #1#2{\edefcsname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
2668
2669\permanent\protected\def\gsetboxllx#1#2{\xdefcsname\??box_x\number#1\endcsname{\the\dimexpr#2\relax}}
2670\permanent\protected\def\gsetboxlly#1#2{\xdefcsname\??box_y\number#1\endcsname{\the\dimexpr#2\relax}}
2671
2672\permanent\def\getboxllx#1{\ifcsname\??box_x\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
2673\permanent\def\getboxlly#1{\ifcsname\??box_y\number#1\endcsname\lastnamedcs\else\zeropoint\fi}
2674
2675\permanent\def\directgetboxllx#1{\csname\??box_x\number#1\endcsname}
2676\permanent\def\directgetboxlly#1{\csname\??box_y\number#1\endcsname}
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691\permanent\protected\def\shownextbox
2692 {\dowithnextbox
2693 {\bgroup
2694 \showboxbreadth\maxcount
2695 \showboxdepth \maxcount
2696 \scratchcounter\interactionmode
2697 \batchmode
2698 \showbox\nextbox
2699 \box\nextbox
2700 \interactionmode\scratchcounter
2701 \egroup}}
2702
2703\permanent\protected\def\spreadhbox#1
2704 {\bgroup
2705 \ifhbox#1\relax
2706 \setbox\scratchboxtwo\emptybox
2707 \unhbox#1
2708 \doloop
2709 {\unpenalty\unskip\unpenalty\unskip\unpenalty\unskip
2710 \setbox\scratchboxone\lastbox
2711 \ifvoid\scratchboxone
2712 \exitloop
2713 \else
2714 \setbox\scratchboxtwo\hbox
2715 {\ifhbox\scratchboxone \spreadhbox\scratchboxone\else\box\scratchboxone\fi
2716 \ifvoid\scratchboxtwo \else\hss\unhbox\scratchboxtwo\fi}
2717 \fi}
2718 \ifvoid\scratchboxtwo\else\unhbox\scratchboxtwo\fi
2719 \else
2720 \box#1
2721 \fi
2722 \egroup}
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733\permanent\protected\def\minimalhbox#1#
2734 {\dowithnextbox
2735 {\bgroup
2736 \setbox\scratchbox\hpack#1{\hss}
2737 \ifdim\wd\nextbox<\wd\scratchbox\wd\nextbox\wd\scratchbox\fi
2738 \box\nextbox
2739 \egroup}
2740 \hbox}
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757\def\syst_boxes_contenttostring
2758 {\normalexpanded{\endgroup\endlocalcontrol\boxtostring\nextbox}}
2759
2760\permanent\def\contenttostring
2761 {\beginlocalcontrol\begingroup
2762 \dowithnextboxcs\syst_boxes_contenttostring\hbox}
2763
2764\newtoks \everypreroll
2765\newif \ifprerolling
2766
2767\appendtoks
2768 \prerollingtrue
2769\to \everypreroll
2770
2771\let\prerolltostring\firstofoneargument
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784\newbox\b_syst_boxes
2785
2786\appendtoks
2787 \permanent\def\prerolltostring#1
2788 {\beginlocalcontrol
2789 \setbox\b_syst_boxes\hbox{\expand\everypreroll#1}
2790 \normalexpanded
2791 {\setbox\b_syst_boxes\emptybox
2792 \endlocalcontrol
2793 \boxtostring\b_syst_boxes}}
2794\to \everydump
2795
2796
2797
2798\permanent\protected\def\nodestostring#1#2
2799 {\edef#2{\contenttostring{#1}}}
2800
2801
2802
2803\aliased\let\hyphenatedhbox\hbox
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829\permanent\protected\def\doifelserighttoleftinbox{\clf_doifelserighttoleftinbox}
2830
2831\aliased\let\doifrighttoleftinboxelse\doifelserighttoleftinbox
2832
2833
2834
2835\definesystemattribute [runningtext] [public]
2836
2837\permanent\protected\def\runninghbox{\hbox attr \runningtextattribute \fontid\font}
2838
2839
2840
2841\permanent\protected\def\beginhbox{\hbox\bgroup} \aliased\let\endhbox\egroup
2842\permanent\protected\def\beginvbox{\vbox\bgroup} \aliased\let\endvbox\egroup
2843\permanent\protected\def\beginvtop{\vtop\bgroup} \aliased\let\endvtop\egroup
2844
2845\permanent\protected\def\sethboxregister#1{\setbox#1\hbox}
2846\permanent\protected\def\setvboxregister#1{\setbox#1\vbox}
2847\permanent\protected\def\setvtopregister#1{\setbox#1\vtop}
2848
2849\permanent\protected\def\flushboxregister#1{\box\numexpr#1\relax}
2850
2851\permanent\protected\def\starthboxregister#1{\setbox#1\hbox\bgroup} \aliased\let\stophboxregister\egroup
2852\permanent\protected\def\startvboxregister#1{\setbox#1\vbox\bgroup} \aliased\let\stopvboxregister\egroup
2853\permanent\protected\def\startvtopregister#1{\setbox#1\vtop\bgroup} \aliased\let\stopvtopregister\egroup
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881\permanent\protected\def\lastlinewidth{\dimexpr\clf_lastlinewidth\scaledpoint\relax}
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891\permanent\protected\def\shiftbox {\clf_shiftbox}
2892\permanent\protected\def\vpackbox {\clf_vpackbox}
2893\permanent\protected\def\hpackbox {\clf_hpackbox}
2894\permanent\protected\def\vpackedbox{\clf_vpackedbox}
2895\permanent\protected\def\hpackedbox{\clf_hpackedbox}
2896
2897
2898
2899
2900\permanent\protected\def\linebox
2901 {\hpack\bgroup\dowithnextbox
2902 {\scratchdimen\dimexpr\dimexpr\htdp\nextbox\lineheight\relax2\strutdp\relax
2903 \setbox\nextbox\hpack{\lower\scratchdimen\box\nextbox}
2904 \ht\nextbox\strutht
2905 \dp\nextbox\strutdp
2906 \box\nextbox
2907 \egroup}
2908 \hbox}
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986\untraced\permanent\protected\def\showboxhere{\showbox nolevels content online all }
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040\newconditional\boxstretchfixed
3041\newdimension \boxstretchdelta
3042
3043\permanent\protected\def\boxfixstretch
3044 {\begingroup
3045 \afterassignment\syst_boxes_fixstretch_a\scratchdimen}
3046
3047\permanent\protected\def\syst_boxes_fixstretch_a
3048 {\afterassignment\syst_boxes_fixstretch_b\scratchcounter}
3049
3050\permanent\protected\def\syst_boxes_fixstretch_b
3051 {\scratchdimenone \ifvbox\scratchcounter\ht\else\wd\fi\scratchcounter
3052 \scratchdimentwo \boxrepack\scratchcounter
3053 \scratchdimenthree\boxstretch\scratchcounter
3054 \scratchdistance \dimexpr\scratchdimenone\scratchdimentwo\relax
3055
3056 \unless\ifdim\scratchdistance>\scratchdimenthree
3057
3058 \global\boxstretchfixed\conditionalfalse
3059 \global\boxstretchdelta\zeropoint
3060 \orelse\ifdim\scratchdistance>\scratchdimen
3061
3062 \boxlimitate\scratchcounter\zerocount
3063 \global\boxstretchfixed\conditionaltrue
3064 \global\boxstretchdelta\dimexpr\ifvbox\scratchcounter\ht\else\wd\fi\scratchcounter\boxrepack\scratchcounter\relax
3065 \else
3066
3067 \global\boxstretchfixed\conditionalfalse
3068 \global\boxstretchdelta\zeropoint
3069 \fi
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086 \endgroup}
3087
3088\protect \endinput
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204 |