1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Page Columns}
15
16
17
18
19
20
21
22
23
24
25
26\unprotect
27
28\definemeasure[onecolumn] [\columnwidth]
29\definemeasure[twocolumns] [\dimexpr\plustwo \columnwidth \columndistance\relax]
30\definemeasure[threecolumns][\dimexpr\plusthree\columnwidth\plustwo \columndistance\relax]
31\definemeasure[fourcolumns] [\dimexpr\plusfour \columnwidth\plusthree\columndistance\relax]
32
33\newcount \c_page_col_n_of_columns \c_page_col_n_of_columns\plusone
34\newcount \c_page_col_current \c_page_col_current \plusone
35\newdimen \d_page_col_distance
36\newdimen \d_page_col_max_height
37\newdimen \d_page_col_max_width
38
39\newdimen \d_page_col_column_width
40\newdimen \d_page_col_top_height
41\newdimen \d_page_col_top_width
42\newdimen \d_page_col_available
43\newdimen \d_page_col_sofar
44\newconditional\c_page_col_page
45
46
47
48\unexpanded\def\page_col_command_next_page
49 {\page_col_eject_page}
50
51\unexpanded\def\page_col_column
52 {\page_otr_eject_page}
53
54\unexpanded\def\page_col_eject_page
55 {\begingroup
56 \scratchcountertwo \realpageno
57 \page_otr_eject_page
58 \scratchcounterone \c_page_col_current
59 \scratchcounterthree\zerocount
60 \doloop{
61 \ifnum\scratchcounterthree>\plushundred
62
63 \exitloop
64 \else\ifnum\realpageno>\scratchcountertwo
65
66 \exitloop
67 \else
68 \ifnum\scratchcounterone=\c_page_col_current
69 \dontleavehmode\null
70 \fi
71 \page_otr_eject_page
72 \scratchcounterone\c_page_col_current
73 \advance\scratchcounterthree\plusone
74 \fi\fi
75 }
76 \endgroup}
77
78
79
80\unexpanded\def\page_col_command_next_page_and_inserts
81 {\page_otr_eject_page_and_flush_inserts}
82
83
84
85\unexpanded\def\page_col_command_set_hsize
86 {\global\hsize\d_page_col_column_width\relax
87 \global\d_page_col_available\dimexpr
88 \numexpr\c_page_col_n_of_columns\c_page_col_current\plusone\relax\d_page_col_column_width
89 \numexpr\c_page_col_n_of_columns\c_page_col_current \relax\d_page_col_distance
90 \relax
91 \global\d_page_col_sofar
92 \ifnum\c_page_col_n_of_columns=\plusone
93 \zeropoint
94 \else
95 \numexpr\c_page_col_n_of_columns\plusone\relax
96 \dimexpr\d_page_col_column_width\d_page_col_distance\relax
97 \fi
98
99 \textwidth\d_page_col_column_width}
100
101
102
103\unexpanded\def\page_col_command_set_vsize
104 {\ifgridsnapping
105 \ifcase\layoutlines
106 \getrawnoflines\textheight
107 \else
108 \noflines\layoutlines
109 \fi
110 \global\vsize\noflines\openlineheight
111 \else
112 \global\vsize\textheight
113 \fi}
114
115
116
117\def\page_col_registered_text_area_b#1
118 {\begingroup
119 \makeupwidth\d_page_col_column_width
120 \page_one_registered_text_area_b{#1}
121 \endgroup}
122
123\unexpanded\def\page_col_command_package_contents#1#2
124 {\bgroup
125 \setbox\b_page_one_contents\vbox to \textheight
126 {\page_one_registered_text_area_a#1#2}
127 \page_one_command_package_show_state
128 \ht\b_page_one_contents\textheight
129 \page_col_registered_text_area_b
130 {\box\b_page_one_contents}
131 \egroup}
132
133\unexpanded\def\page_col_command_package_contents_one#1#2
134 {\bgroup
135 \forgetall
136
137 \strc_notes_check_if_bottom_present
138 \d_page_one_natural_depth\dp#2\relax
139 \setbox\b_page_one_contents\vbox to \textheight
140 {\page_col_command_flush_top_insertions
141 \page_one_registered_text_area_a#1#2
142 \hsize\d_page_col_column_width
143 \ifgridsnapping
144 \vskip\dimexpr\openstrutdepth\d_page_one_natural_depth\relax
145 \prevdepth\openstrutdepth
146 \page_col_command_flush_bottom_insertions
147 \vfil
148 \else\ifcase\bottomraggednessmode
149
150 \vskip\dimexpr\openstrutdepth\d_page_one_natural_depth\relax
151 \prevdepth\openstrutdepth
152 \page_col_command_flush_bottom_insertions
153 \vfil
154 \or
155
156 \page_col_command_flush_bottom_insertions
157 \or
158
159 \kern\dimexpr\maxdepth\d_page_one_natural_depth\relax
160 \page_col_command_flush_bottom_insertions
161 \fi\fi
162 \fakepagenotes}
163 \page_one_command_package_show_state
164 \ifconditional\c_notes_bottom_present
165 \ifgridsnapping
166 \ifcase\layoutlines
167 \getrawnoflines\textheight
168 \else
169 \noflines\layoutlines
170 \fi
171 \scratchoffset\dimexpr\numexpr\noflines\plusone\relax\lineheight\topskip\relax
172 \else
173 \scratchoffset\ht\b_page_one_contents
174 \fi
175 \setbox\b_page_one_bottom_notes\hpack
176 {\hsize\d_page_col_column_width
177 \setupnotes[\c!width=\textwidth]
178 \lower\scratchoffset\vbox{\placebottomnotes\par\kern\zeropoint}}
179 \ht\b_page_one_contents \zeropoint
180 \wd\b_page_one_contents \zeropoint
181 \ht\b_page_one_bottom_notes\zeropoint
182 \wd\b_page_one_bottom_notes\zeropoint
183 \wd\b_page_one_bottom_notes\d_page_col_column_width
184 \page_col_registered_text_area_b
185 {\vpack to \textheight
186 {\hpack{\box\b_page_one_contents\box\b_page_one_bottom_notes}}}
187 \else
188 \ht\b_page_one_contents\textheight
189 \wd\b_page_one_contents\d_page_col_column_width
190 \page_col_registered_text_area_b
191 {\box\b_page_one_contents}
192 \fi
193 \egroup}
194
195
196
197\unexpanded\def\page_col_command_side_float_output
198 {
199 \ifvoid\namedinsertionnumber\s!topfloat\else
200 \scratchwidth\wd\namedinsertionnumber\s!topfloat
201 \ifdim\scratchwidth>\d_page_col_top_width
202 \global\d_page_col_top_width \scratchwidth
203 \fi
204 \global\d_page_col_top_height\ht\namedinsertionnumber\s!topfloat
205 \fi
206
207 \setbox\scratchbox\vbox\bgroup
208 \page_col_command_package_contents_one\unvbox\normalpagebox
209 \egroup
210 \putboxincache\s!pagecolumn{\number\c_page_col_current}\scratchbox
211 \ifnum\c_page_col_current=\c_page_col_n_of_columns
212 \page_col_routine_package
213 \page_otr_construct_and_shipout\box\normalpagebox\plusone
214 \global\c_page_col_current\plusone
215 \global\d_page_col_top_height\zeropoint
216 \global\d_page_col_top_width\zeropoint
217
218
219 \else
220 \ifdim\d_page_col_top_width>\zeropoint
221 \ifdim\dimexpr\d_page_col_top_width>\d_page_col_sofar\relax
222 \begingroup
223 \floatingpenalty\zerocount
224 \insert\namedinsertionnumber\s!topfloat\bgroup
225 \vbox to \d_page_col_top_height{\vss}
226
227 \page_col_command_flush_top_insertions
228 \page_col_command_flush_floats
229
230 \egroup
231 \endgroup
232 \fi
233 \fi
234 \global\advance\c_page_col_current\plusone
235 \fi
236
237 \page_col_command_set_vsize
238 \page_col_command_set_hsize}
239
240
241
242\def\page_col_routine_package_step
243 {
244 \getboxfromcache{\s!pagecolumn}{\number\recurselevel}\scratchbox
245 \page_lines_add_numbers_to_box\scratchbox\recurselevel\c_page_col_n_of_columns\plusone
246 \page_marks_synchronize_column\plusone\c_page_col_n_of_columns\recurselevel\scratchbox
247
248 \anch_mark_column_box\scratchbox\recurselevel
249 \pagecolumnseparatorheight\ht\scratchbox
250 \pagecolumnseparatordepth \dp\scratchbox
251 \inheritedpagecolumnsframedbox\recurselevel\scratchbox}
252
253\def\page_col_routine_package
254 {\global\setbox\normalpagebox\hbox to \makeupwidth\bgroup
255 \edef\p_separator{\pagecolumnsparameter\c!separator}
256 \pagecolumnseparatorwidth\d_page_col_distance
257 \edef\p_direction{\pagecolumnsparameter\c!direction}
258 \ifx\p_direction\v!reverse
259 \dostepwiserecurse\c_page_col_n_of_columns\plusone\minusone
260 {\page_col_routine_package_step
261 \ifnum\recurselevel>\plusone
262 \page_col_routine_package_separate
263 \fi}
264 \else
265 \dorecurse\c_page_col_n_of_columns
266 {\page_col_routine_package_step
267 \ifnum\recurselevel<\c_page_col_n_of_columns
268 \page_col_routine_package_separate
269 \fi}
270 \fi
271 \egroup
272 \resetboxesincache{\s!pagecolumn}}
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322\unexpanded\def\page_col_command_check_if_float_fits
323 {\ifconditional\c_page_floats_not_permitted
324
325 \global\setfalse\c_page_floats_room
326 \else
327
328
329 \ifdim\dimexpr\hsize\naturalfloatwd\relax>\onepoint
330 \global\settrue\c_page_floats_room
331 \else
332 \global\setfalse\c_page_floats_room
333 \fi
334 \ifconditional\c_page_floats_room
335
336 \ifdim\dimexpr\pagetotal\lineheight\relax>\pagegoal
337
338 \goodbreak
339 \fi
340 \ifdim\pagetotal>\zeropoint
341 \scratchdimenone\dimexpr\pagetotal\floatheight\d_strc_floats_top\pageshrink\relax
342 \scratchdimentwo\pagegoal
343 \relax
344 \ifcase\c_page_one_float_method
345
346 \or
347
348 \advance\scratchdimentwo \strutdp
349 \or
350
351 \advance\scratchdimenone \onepoint
352 \fi
353 \relax
354 \ifdim\scratchdimenone>\scratchdimentwo
355
356 \global\setfalse\c_page_floats_room
357
358
359 \else
360
361
362
363 \fi
364 \fi
365 \fi
366 \fi}
367
368
369
370\def\page_col_set_float_pack_hsize
371 {\ifnum\c_page_col_current=\c_page_col_n_of_columns
372 \c_page_col_current\plusone
373 \else
374 \advance\c_page_col_current\plusone
375 \fi
376 \page_col_command_set_hsize
377 \hsize\d_page_col_available}
378
379\unexpanded\def\page_col_command_flush_floats
380 {\global\settrue\c_page_floats_flushing
381 \ifconditional\c_page_floats_some_waiting
382 \par
383 \page_col_set_float_pack_hsize
384 \page_col_command_flush_floats_indeed
385 \fi
386 \global\savednoffloats\zerocount
387 \global\setfalse\c_page_floats_some_waiting
388 \global\setfalse\c_page_floats_flushing}
389
390\def\page_floats_show_pack_state_indeed#1
391 {\llap{\smash{\backgroundline[black]{\strut\smallinfofont\white#1\space\the\nofcollectedfloats\space of\space\the\savednoffloats:\the\hsize}}\hskip.25\emwidth}}
392
393\installtextracker
394 {floats.collecting}
395 {\let\page_floats_show_pack_state\page_floats_show_pack_state_indeed}
396 {\let\page_floats_show_pack_state\gobbleoneargument}
397
398\let\page_floats_show_pack_state\gobbleoneargument
399
400\def\page_col_command_flush_floats_indeed
401 {\ifconditional\c_page_floats_some_waiting
402 \ifconditional\c_page_floats_compress_flushed
403 \setfalse\c_page_floats_center_box
404 \page_floats_collect\s!text\hsize\d_page_floats_compress_distance
405
406 \ifnum\nofcollectedfloats=\plusone
407 \ifdim\naturalfloatwd>\hsize
408 \nofcollectedfloats\zerocount
409 \fi
410 \fi
411 \ifnum\nofcollectedfloats>\zerocount
412 \global\setbox\floatbox\hpack to \hsize
413 {\page_floats_show_pack_state F
414 \hfil
415 \dorecurse\nofcollectedfloats
416 {\ifcase\columndirection
417 \page_floats_flush\s!text\plusone
418 \else
419 \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats\recurselevel1\relax}
420 \fi
421
422 \scratchdimen\dimexpr\wd\floatbox\naturalfloatwd\relax
423 \ifdim\scratchdimen<\zeropoint
424 \global\setbox\floatbox\hpack spread \scratchdimen{\hss\box\floatbox\hss}
425 \fi
426
427 \ifdim\wd\floatbox>\textwidth
428 \hpack to \textwidth{\hss\box\floatbox\hss}
429 \else
430 \box\floatbox
431 \fi
432 \ifnum\recurselevel<\nofcollectedfloats
433 \hfil
434 \fi}
435 \hfil}
436 \doplacefloatbox
437
438 \doubleexpandafter\page_col_command_flush_floats_indeed
439 \else
440
441 \fi
442 \else
443 \page_floats_get
444
445 \doplacefloatbox
446 \doubleexpandafter\page_col_command_flush_floats_indeed
447 \fi
448 \fi}
449
450\unexpanded\def\page_col_command_flush_saved_floats
451 {\global\d_page_floats_inserted_top\zeropoint
452 \global\d_page_floats_inserted_bottom\zeropoint
453 \ifconditional\c_page_floats_flushing \else
454 \page_col_command_set_top_insertions
455 \page_col_command_set_bottom_insertions
456 \ifconditional\c_page_floats_some_waiting
457 \doif{\rootfloatparameter\c!cache}\v!no\page_col_command_flush_floats
458 \else\ifconditional\c_page_margin_blocks_present
459 \page_col_command_flush_floats
460 \fi\fi
461 \fi}
462
463\unexpanded\def\page_col_command_set_top_insertions
464 {\bgroup
465 \ifconditional\c_page_floats_some_waiting
466 \noffloatinserts\zerocount
467 \let\totaltopinserted\!!zeropoint
468 \page_col_set_float_pack_hsize
469 \page_col_command_set_top_insertions_indeed
470 \ifnum\rootfloatparameter\c!nbottom=\zerocount
471 \ifnum\rootfloatparameter\c!nlines>\zerocount
472 \ifdim\totaltopinserted>\zeropoint\relax
473 \ifdim\dimexpr\rootfloatparameter\c!nlines\lineheight\totaltopinserted\relax>\textheight
474 \showmessage\m!floatblocks8{\rootfloatparameter\c!nlines}
475 \page_otr_fill_and_eject_page
476 \fi
477 \fi
478 \fi
479 \fi
480 \fi
481 \egroup}
482
483\def\d_page_col_collected_top_float_height
484 {\dimexpr
485 \d_page_floats_inserted_top
486 \maxcollectedfloatstotal
487 \ifdim\d_strc_floats_top>\d_strc_floats_bottom
488 \d_strc_floats_top
489 \else
490 \d_strc_floats_bottom
491 \fi
492 \relax}
493
494\def\page_col_command_set_top_insertions_indeed
495 {\ifnum\noffloatinserts<\c_page_floats_n_of_top
496 \ifcase\savednoffloats
497 \let\page_col_command_set_top_insertions_indeed\relax
498 \else
499 \page_floats_collect\s!text\hsize\emwidth
500 \ifdim\d_page_col_collected_top_float_height<\textheight
501 \global\setbox\floatbox\hpack to \hsize
502 {\page_floats_show_pack_state T
503 \hfil
504 \dorecurse\nofcollectedfloats
505 {\ifcase\columndirection
506 \page_floats_flush\s!text\plusone
507 \else
508 \page_floats_flush\s!text{\the\numexpr\nofcollectedfloats\recurselevel1\relax}
509 \fi
510
511 \scratchdimen\dimexpr\wd\floatbox\naturalfloatwd\relax
512 \ifdim\scratchdimen<\zeropoint
513 \global\setbox\floatbox\hpack spread \scratchdimen{\hss\box\floatbox\hss}
514 \fi
515
516 \ifdim\wd\floatbox>\makeupwidth
517 \hpack to \makeupwidth{\hss\box\floatbox\hss}
518 \else
519 \box\floatbox
520 \fi
521 \ifnum\recurselevel<\nofcollectedfloats
522 \hfil
523 \fi}
524 \hfil}
525 \page_one_prepare_top_float
526 \xdef\totaltopinserted{\the\d_page_floats_inserted_top}
527 \page_one_insert_top_float
528 \ifconditional\c_page_floats_some_waiting
529 \advance\noffloatinserts \plusone
530 \else
531 \noffloatinserts\c_page_floats_n_of_top\relax
532 \fi
533 \page_floats_report_flushed
534 \else
535 \let\page_col_command_set_top_insertions_indeed\relax
536 \fi
537 \fi
538 \else
539 \ifconditional\c_page_floats_some_waiting
540 \showmessage\m!floatblocks6{\the\c_page_floats_n_of_top}
541 \fi
542 \let\page_col_command_set_top_insertions_indeed\relax
543 \fi
544 \page_col_command_set_top_insertions_indeed}
545
546\let\page_col_command_flush_top_insertions \page_one_command_flush_top_insertions
547\let\page_col_command_flush_bottom_insertions\page_one_command_flush_bottom_insertions
548
549
550\let\page_col_command_set_bottom_insertions \page_one_command_set_bottom_insertions
551
552
553\let\page_col_command_set_bottom_insertions_indeed \page_one_command_set_botttom_insertions
554
555\let\page_col_command_flush_float_box \page_one_command_flush_float_box
556\let\page_col_command_synchronize_side_floats \page_one_command_synchronize_side_floats
557\let\page_col_command_flush_side_floats \page_one_command_flush_side_floats
558\let\page_col_command_flush_margin_blocks \page_one_command_flush_margin_blocks
559\let\page_col_command_test_page \page_one_command_test_page
560
561
562
563
564\newdimen\pagecolumnseparatorheight
565\newdimen\pagecolumnseparatordepth
566\newdimen\pagecolumnseparatorwidth
567
568
569
570
571
572
573
574
575
576
577
578
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\def\page_col_routine_package_separate
605 {\hss}
606
607
608
609\unexpanded\def\page_col_command_routine
610 {\page_sides_output_routine}
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630\let\page_col_command_flush_all_floats\relax
631
632
633
634\defineoutputroutine
635 [\s!pagecolumn]
636 [\s!page_otr_command_routine =\page_col_command_routine,
637 \s!page_otr_command_package_contents =\page_col_command_package_contents,
638 \s!page_otr_command_set_vsize =\page_col_command_set_vsize,
639 \s!page_otr_command_set_hsize =\page_col_command_set_hsize,
640
641 \s!page_otr_command_next_page =\page_col_command_next_page,
642 \s!page_otr_command_next_page_and_inserts =\page_col_command_next_page_and_inserts,
643 \s!page_otr_command_set_top_insertions =\page_col_command_set_top_insertions,
644 \s!page_otr_command_set_bottom_insertions =\page_col_command_set_bottom_insertions,
645 \s!page_otr_command_flush_top_insertions =\page_col_command_flush_top_insertions,
646 \s!page_otr_command_flush_bottom_insertions=\page_col_command_flush_bottom_insertions,
647 \s!page_otr_command_check_if_float_fits =\page_col_command_check_if_float_fits,
648
649 \s!page_otr_command_flush_float_box =\page_col_command_flush_float_box,
650 \s!page_otr_command_side_float_output =\page_col_command_side_float_output,
651 \s!page_otr_command_synchronize_side_floats=\page_col_command_synchronize_side_floats,
652 \s!page_otr_command_flush_floats =\page_col_command_flush_floats,
653 \s!page_otr_command_flush_side_floats =\page_col_command_flush_side_floats,
654 \s!page_otr_command_flush_saved_floats =\page_col_command_flush_saved_floats,
655 \s!page_otr_command_flush_all_floats =\page_col_command_flush_all_floats,
656 \s!page_otr_command_flush_margin_blocks =\page_col_command_flush_margin_blocks,
657 \s!page_otr_command_test_column =\page_col_command_test_page
658 ]
659
660
661
662\installfloatmethod \s!pagecolumn \v!here \page_one_place_float_here
663\installfloatmethod \s!pagecolumn \v!force \page_one_place_float_force
664\installfloatmethod \s!pagecolumn \v!left \page_one_place_float_left
665\installfloatmethod \s!pagecolumn \v!right \page_one_place_float_right
666\installfloatmethod \s!pagecolumn \v!text \page_one_place_float_text
667\installfloatmethod \s!pagecolumn \v!top \page_one_place_float_top
668\installfloatmethod \s!pagecolumn \v!bottom \page_one_place_float_bottom
669\installfloatmethod \s!pagecolumn \v!auto \page_one_place_float_auto
670\installfloatmethod \s!pagecolumn \v!margin \page_one_place_float_margin
671\installfloatmethod \s!pagecolumn \v!opposite \page_one_place_float_face
672\installfloatmethod \s!pagecolumn \v!page \page_one_place_float_page
673\installfloatmethod \s!pagecolumn \v!leftpage \page_one_place_float_leftpage
674\installfloatmethod \s!pagecolumn \v!rightpage \page_one_place_float_rightpage
675\installfloatmethod \s!pagecolumn \v!inmargin \page_one_place_float_inmargin
676\installfloatmethod \s!pagecolumn \v!inleft \page_one_place_float_leftmargin
677\installfloatmethod \s!pagecolumn \v!inright \page_one_place_float_rightmargin
678\installfloatmethod \s!pagecolumn \v!leftmargin \page_one_place_float_leftmargin
679\installfloatmethod \s!pagecolumn \v!rightmargin \page_one_place_float_rightmargin
680\installfloatmethod \s!pagecolumn \v!leftedge \page_one_place_float_leftedge
681\installfloatmethod \s!pagecolumn \v!rightedge \page_one_place_float_rightedge
682\installfloatmethod \s!pagecolumn \v!somewhere \page_one_place_float_somewhere
683\installfloatmethod \s!pagecolumn \v!backspace \page_one_place_float_backspace
684\installfloatmethod \s!pagecolumn \v!cutspace \page_one_place_float_cutspace
685
686
687
688
689
690
691
692
693
694
695
696
697\installfloatmethod \s!pagecolumn \v!local \somelocalfloat
698
699
700
701\installcorenamespace{pagecolumns}
702
703\installframedcommandhandler \??pagecolumns {pagecolumns} \??pagecolumns
704
705\setuppagecolumns
706 [\c!distance=1.5\bodyfontsize,
707 \c!n=\plustwo,
708 \c!page=\v!yes,
709
710
711
712
713
714
715
716 \c!frame=\v!off,
717 \c!strut=\v!no,
718 \c!offset=\v!overlay,
719
720 \c!maxwidth=\makeupwidth,
721
722
723 \c!direction=\v!normal]
724
725\let\startpagecolumns\relax
726\let\stoppagecolumns \relax
727
728\appendtoks
729 \setuevalue{\e!start\currentpagecolumns}{\startpagecolumns[\currentpagecolumns]}
730 \setuevalue{\e!stop \currentpagecolumns}{\stoppagecolumns}
731\to \everydefinepagecolumns
732
733\def\page_col_pickup_preceding
734 {\begingroup
735 \setupoutputroutine[\s!mixedcolumn]
736 \c_page_mix_routine\c_page_mix_routine_intercept
737 \page_otr_trigger_output_routine
738 \ifvoid\b_page_mix_preceding \else
739
740 \page_postprocessors_linenumbers_deepbox\b_page_mix_preceding
741
742 \global\setbox\b_page_mix_preceding\vbox\bgroup
743
744 \unvbox\b_page_mix_preceding
745 \forcestrutdepth
746 \egroup
747 \wd\b_page_mix_preceding\makeupwidth
748 \global\d_page_mix_preceding_height\ht\b_page_mix_preceding
749 \fi
750 \endgroup}
751
752\def\page_col_flush_preceding
753 {\ifvoid\b_page_mix_preceding \else
754
755 \begingroup
756
757 \setupfloat[\c!spacebefore=,\c!spaceafter=]
758 \startplacefigure[\c!location={\v!top,\v!none}]
759 \box\b_page_mix_preceding
760 \stopplacefigure
761 \endgroup
762 \fi}
763
764\unexpanded\def\startpagecolumns
765 {\begingroup
766 \begingroup
767 \dosingleempty\page_col_start}
768
769\unexpanded\def\page_col_start[#1]
770 {\doifelseassignment{#1}
771 {\let\currentpagecolumns\empty
772 \setuppagecolumns[#1]}
773 {\edef\currentpagecolumns{#1}}
774 \edef\p_page{\pagecolumnsparameter\c!page}
775 \ifx\p_page\empty
776 \setfalse\c_page_col_page
777 \else\ifx\p_page\v!no
778 \setfalse\c_page_col_page
779 \else
780 \settrue\c_page_col_page
781 \page[\p_page]
782 \fi\fi
783 \c_page_col_n_of_columns\pagecolumnsparameter\c!n\relax
784 \ifnum\c_page_col_n_of_columns>\plusone
785 \expandafter\page_col_start_yes
786 \else
787 \expandafter\page_col_start_nop
788 \fi}
789
790\unexpanded\def\page_col_start_yes
791 {\d_page_col_distance \pagecolumnsparameter\c!distance\relax
792
793 \d_page_col_max_width \pagecolumnsparameter\c!maxwidth
794
795 \c_page_col_current \plusone
796
797 \d_page_col_column_width\dimexpr(\d_page_col_max_width\d_page_col_distance*\numexpr(\c_page_col_n_of_columns\plusone)\relax)\c_page_col_n_of_columns\relax
798
799 \columnwidth \d_page_col_column_width
800 \columndistance \d_page_col_distance
801 \nofcolumns \c_page_col_n_of_columns
802 \textwidth \columnwidth
803
804 \nopenalties
805
806
807
808 \let\column\page_col_column
809
810 \def\page_floats_get_used_hsize{\makeupwidth}
811
812 \usealignparameter \pagecolumnsparameter
813 \useblankparameter \pagecolumnsparameter
814
815
816 \usepagecolumnscolorparameter\c!color
817
818 \setupnotes[\c!width=\textwidth]
819
820 \usesetupsparameter\pagecolumnsparameter
821
822
823
824 \ifconditional\c_page_col_page\else
825 \page_col_pickup_preceding
826 \fi
827 \setupoutputroutine[\s!pagecolumn]
828 \ifconditional\c_page_col_page\else
829 \page_col_flush_preceding
830 \fi
831
832 \setupfloats[\c!ntop=\plusthousand]
833
834
835 \page_col_command_set_vsize
836 \page_col_command_set_hsize
837
838 \unexpanded\def\page_col_start[##1]
839 {\page_col_start_nop}
840
841 \let\stoppagecolumns\page_col_stop_yes}
842
843\unexpanded\def\page_col_start_nop
844 {\nofcolumns\c_page_mix_n_of_columns
845 \let\stoppagecolumns\page_col_stop_nop}
846
847\unexpanded\def\page_col_stop_yes
848 {\column
849 \page
850 \endgroup
851
852 \page_otr_command_set_vsize
853 \page_otr_command_set_hsize
854 \page
855 \endgroup}
856
857\unexpanded\def\page_col_stop_nop
858 {\page
859 \endgroup
860 \endgroup}
861
862\protect \endinput
863 |