1
2
3
4
5
6
7
8
9
10
11
12
13
14\writestatus{loading}{ConTeXt Page Macros Default Routine}
15
16
17
18
19
20
21\unprotect
22
23
24
25\newconstant \c_page_one_float_method
26
27\protected\def\page_one_command_next_page
28 {\page_otr_eject_page}
29
30\protected\def\page_one_command_next_page_and_inserts
31 {\page_otr_eject_page_and_flush_inserts}
32
33\protected\def\page_one_command_set_hsize
34 {\global\hsize\textwidth
35 \columnwidth\textwidth}
36
37\protected\def\page_one_command_set_float_hsize
38 {\global\hsize\textwidth}
39
40
41
42\newconditional\c_page_one_set_vsize_tmp
43
44\installtextracker{otr.insertheights}
45 {\c_page_one_set_vsize_tmp\conditionaltrue}
46 {\c_page_one_set_vsize_tmp\conditionalfalse}
47
48\def\page_one_command_set_vsize_tmp
49 {\settotalinsertionheight
50 \writestatus
51 {set vsize one}
52 {insert heights=\the\insertheights,
53 total insertion height=\the\totalinsertionheight,
54 delta=\todimension{\insertheights\totalinsertionheight}}
55 \page_one_command_set_vsize_new}
56
57\def\page_one_command_set_vsize_old
58 {\settotalinsertionheight
59 \pagegoal{\vsize\totalinsertionheight}}
60
61\def\page_one_command_set_vsize_new
62 {\pagegoal{
63 \vsize
64 \d_page_floats_inserted_top
65 \d_page_floats_inserted_bottom
66 \insertheights
67 }}
68
69\protected\def\page_one_command_set_vsize
70 {\ifgridsnapping
71 \ifcase\layoutlines
72 \getrawnoflines\textheight
73 \else
74 \noflines\layoutlines
75 \fi
76 \global\vsize\noflines\openlineheight
77 \else
78 \global\vsize\textheight
79 \fi
80
81 \ifzeropt\textadaptive\else
82 \global\d_page_adapts_delta\textadaptive
83 \global\pageextragoal\textadaptive
84 \fi
85
86 \global\advanceby\vsize\d_page_adapts_delta
87
88
89
90 \ifconditional\c_page_one_set_vsize_tmp
91 \page_one_command_set_vsize_tmp
92 \orelse\ifzeropt\insertheights
93 \page_one_command_set_vsize_old
94 \else
95 \page_one_command_set_vsize_new
96 \fi}
97
98
99
100
101
102\pushoverloadmode
103 \setnewconstant\kindofpagetextareas\plustwo
104 \overloaded\mutable\let\kindofpagetextareas\kindofpagetextareas
105\popoverloadmode
106
107\def\page_one_registered_text_area_a
108 {\ifconditional\c_page_areas_enabled
109 \expandafter\page_one_registered_text_area_a_indeed
110 \else
111 \expandafter\firstofoneargument
112 \fi}
113
114\def\page_one_registered_text_area_b
115 {\ifconditional\c_page_areas_enabled
116 \expandafter\page_one_registered_text_area_b_indeed
117 \else
118 \expandafter\firstofoneargument
119 \fi}
120
121\def\page_one_registered_text_area_a_indeed
122 {\ifcase\kindofpagetextareas
123 \expandafter\firstofoneargument
124 \or
125 \expandafter\page_areas_register_direct
126 \or
127 \expandafter\firstofoneargument
128 \else
129 \expandafter\firstofoneargument
130 \fi}
131
132\def\page_one_registered_text_area_b_indeed
133 {\ifcase\kindofpagetextareas
134
135 \or
136
137 \or
138 \expandafter\page_areas_register_boxed
139 \else
140
141 \fi}
142
143\newdimension\d_page_one_natural_depth
144\newbox \b_page_one_bottom_notes
145\newbox \b_page_one_contents
146
147\let\page_one_command_package_show_state\relax
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170\newinteger\c_page_one_stretch
171
172\def\page_one_check_stretch_contents
173 {\ifdim{\textheight\ht\b_page_one_contents}<\c_page_one_stretch\lineheight
174 \setbox\b_page_one_contents\vpack\bgroup
175
176 \scale[\c!height=\textheight,\c!width=\textwidth]{\box\b_page_one_contents}
177 \egroup
178 \fi}
179
180\def\page_one_check_stretch_lines
181 {\edef\m_lines{\markedpageparameter\v!stretch\v!lines}
182 \ifempty\m_lines\else\c_page_one_stretch\m_lines\fi}
183
184\let\page_one_hook_for_checks\gobbleoneargument
185
186\protected\def\page_one_command_package_contents#1#2
187 {\bgroup
188 \strc_notes_check_if_bottom_present
189 \d_page_one_natural_depth\dp#2\relax
190
191
192
193
194
195 \page_layouts_check_stretch#2
196
197
198
199
200 \setbox\b_page_one_contents\vbox \ifcase\c_page_one_stretch to \textheight\fi
201 {\page_otr_command_flush_top_insertions
202
203
204
205 \page_one_registered_text_area_a#1#2
206
207 \ifgridsnapping
208 \unskip
209 \vkern{\openstrutdepth\d_page_one_natural_depth}
210 \prevdepth\openstrutdepth
211 \page_otr_command_flush_bottom_insertions
212 \vfil
213 \orelse\ifcase\bottomraggednessmode
214
215 \unskip
216 \vkern{\openstrutdepth\d_page_one_natural_depth}
217 \prevdepth\openstrutdepth
218
219
220 \page_otr_command_flush_bottom_insertions
221 \vfil
222 \or
223
224 \page_otr_command_flush_bottom_insertions
225 \or
226
227 \unskip
228 \vkern{\maxdepth\d_page_one_natural_depth}
229
230 \page_otr_command_flush_bottom_insertions
231 \or
232
233 \vkern\d_page_one_natural_depth
234 \unskip
235 \page_otr_command_flush_bottom_insertions
236 \fi
237 \fakepagenotes}
238 \page_one_hook_for_checks\b_page_one_contents
239 \page_one_command_package_show_state
240 \ifconditional\c_notes_bottom_present
241 \ifgridsnapping
242 \ifcase\layoutlines
243 \getrawnoflines\textheight
244 \else
245 \noflines\layoutlines
246 \fi
247 \scratchoffset{\numexpr\noflines\plusone\relax\lineheight\topskip}
248 \else
249 \scratchoffset\ht\b_page_one_contents
250 \fi
251 \setbox\b_page_one_bottom_notes\hpack
252 {\lower\scratchoffset\vbox{\placebottomnotes\par\kern\zeropoint}}
253 \smashbox\b_page_one_bottom_notes
254 \ht\b_page_one_contents\zeropoint
255 \page_one_registered_text_area_b
256 {\vpack to \textheight
257 {\box\b_page_one_contents
258 \box\b_page_one_bottom_notes}}
259 \else
260 \ifcase\c_page_scale_lines
261
262 \orelse\ifdim\d_page_box_stretch_delta>\zeropoint
263 \page_scale_text_box_register_box\b_page_one_contents
264 \page_scale_text_box\b_page_one_contents
265 \else
266 \page_scale_text_box_register_page
267 \page_scale_text_box\b_page_one_contents
268 \fi
269
270
271
272 \ht\b_page_one_contents\textheight
273 \page_one_registered_text_area_b
274 {\box\b_page_one_contents}
275 \fi
276 \egroup}
277
278\protected\def\page_one_command_side_float_output
279 {\page_otr_construct_and_shipout\unvbox\normalpagebox\plusone}
280
281\protected\def\page_one_command_routine
282 {\page_sides_output_routine}
283
284
285
286\newconditional\c_page_one_top_of_insert
287\newconditional\c_page_one_correct_top_insert \c_page_one_correct_top_insert\conditionaltrue
288\newgluespec \s_page_one_between_top_insert
289
290\def\page_one_prepare_top_float
291 {\ifzeropt\d_page_floats_inserted_top
292 \c_page_one_top_of_insert\conditionaltrue
293 \else
294 \c_page_one_top_of_insert\conditionalfalse
295 \fi
296 \s_page_one_between_top_insert\ifdim\d_strc_floats_top>\d_strc_floats_bottom\d_strc_floats_top\else\d_strc_floats_bottom\fi\relax
297 \global\advanceby\d_page_floats_inserted_top{\ht\floatbox\dp\floatbox\s_page_one_between_top_insert}}
298
299\def\page_one_insert_top_float
300 {\floatingpenalty\zerocount
301 \insert\namedinsertionnumber\s!topfloat\bgroup
302 \forgetall
303 \ifconditional\c_page_one_top_of_insert
304 \ifconditional\c_page_one_correct_top_insert
305 \topskipcorrection
306 \kern\lineskip
307 \par
308 \prevdepth\maxdimen
309 \fi
310 \fi
311\page_inserts_detach\floatbox
312 \page_otr_command_flush_float_box
313\page_inserts_attach
314 \vskip\s_page_one_between_top_insert
315 \egroup}
316
317\mutable\let\totaltopinserted\!!zeropoint
318\mutable\let\totalbotinserted\!!zeropoint
319
320\protected\def\page_one_command_set_top_insertions
321 {\bgroup
322
323 \page_one_command_set_always_insertions_top
324 \page_one_command_set_always_insertions_bottom
325
326 \ifconditional\c_page_floats_some_waiting
327 \noffloatinserts\zerocount
328 \let\totaltopinserted\!!zeropoint
329 \page_one_command_set_top_insertions_indeed
330 \ifnum\rootfloatparameter\c!nbottom=\zerocount
331 \ifnum\rootfloatparameter\c!nlines>\zerocount
332 \ifdim\totaltopinserted>\zeropoint\relax
333 \ifdim{\lineheight*(\rootfloatparameter\c!nlines)\totaltopinserted}>\textheight
334 \showmessage\m!floatblocks8{\rootfloatparameter\c!nlines}
335 \page_otr_fill_and_eject_page
336 \fi
337 \fi
338 \fi
339 \fi
340 \fi
341 \egroup}
342
343\def\page_one_command_set_top_insertions_indeed
344 {\ifnum\noffloatinserts<\c_page_floats_n_of_top
345 \page_floats_get
346 \page_one_prepare_top_float
347 \ifdim\d_page_floats_inserted_top<\textheight\relax
348 \xdef\totaltopinserted{\the\d_page_floats_inserted_top}
349 \page_one_insert_top_float
350 \ifconditional\c_page_floats_some_waiting
351 \advanceby\noffloatinserts \plusone
352 \else
353 \noffloatinserts\c_page_floats_n_of_top\relax
354 \fi
355 \page_floats_report_flushed
356 \else
357 \page_floats_resave\s!text
358 \noffloatinserts\c_page_floats_n_of_top\relax
359 \fi
360 \else
361 \ifconditional\c_page_floats_some_waiting
362 \showmessage\m!floatblocks6{\the\c_page_floats_n_of_top}
363 \fi
364 \let\page_one_command_set_top_insertions_indeed\relax
365 \fi
366 \page_one_command_set_top_insertions_indeed}
367
368\protected\def\page_one_command_set_bottom_insertions
369 {\bgroup
370 \ifconditional\c_page_floats_some_waiting
371 \noffloatinserts\zerocount
372 \page_one_command_set_bottom_insertions_indeed
373 \fi
374 \egroup}
375
376\def\page_one_command_set_bottom_insertions_indeed
377 {\ifnum\noffloatinserts<\c_page_floats_n_of_bottom\relax
378 \page_floats_get
379 \global\advanceby\d_page_floats_inserted_bottom{\ht\floatbox\dp\floatbox\d_strc_floats_top}
380 \ifdim\d_page_floats_inserted_bottom<\pagegoal\relax
381 \floatingpenalty\zerocount
382 \insert\namedinsertionnumber\s!bottomfloat\bgroup
383 \forgetall
384 \blank[\rootfloatparameter\c!spacebefore]
385 \page_otr_command_flush_float_box
386 \egroup
387 \ifconditional\c_page_floats_some_waiting
388 \advanceby\noffloatinserts \plusone
389 \else
390 \noffloatinserts\c_page_floats_n_of_bottom
391 \fi
392 \page_floats_report_flushed
393 \else
394 \page_floats_resave\s!text
395 \noffloatinserts\c_page_floats_n_of_bottom\relax
396 \fi
397 \global\c_page_floats_not_permitted\conditionaltrue
398 \else
399 \ifconditional\c_page_floats_some_waiting
400 \showmessage\m!floatblocks7{\the\c_page_floats_n_of_bottom}
401 \fi
402 \let\page_one_command_set_bottom_insertions_indeed\relax
403 \fi
404 \page_one_command_set_bottom_insertions_indeed}
405
406
407
408
409
410
411
412\protected\def\page_one_command_flush_top_insertions
413 {\ifzeropt\insertheight\namedinsertionnumber\s!topfloat\else
414 \page_one_command_flush_top_insertions_indeed
415 \ifcase\bottomraggednessmode\or\else
416
417 \ifzerodim\d_page_box_stretch_delta
418 \vskip\zeropoint\s!plus\openstrutdepth\s!minus\openstrutdepth\relax
419 \fi
420 \fi
421 \fi
422 \global\d_page_floats_inserted_top\zeropoint}
423
424\def\page_one_command_flush_top_insertions_indeed
425 {\ifgridsnapping
426 \insertbox\namedinsertionnumber\s!topfloat
427 \vkern\topskip
428 \vkern\strutheight
429 \else
430 \ifcase\c_page_floats_insertions_topskip_mode
431
432 \or
433
434 \vskip\topskip
435 \vkern\strutheight
436 \fi
437 \insertunbox\namedinsertionnumber\s!topfloat
438 \fi}
439
440\protected\def\page_one_command_flush_bottom_insertions
441 {\ifzeropt\insertheight\namedinsertionnumber\s!bottomfloat\else
442 \page_one_command_flush_bottom_insertions_indeed
443 \fi
444 \global\d_page_floats_inserted_bottom\zeropoint
445 \global\c_page_floats_not_permitted\conditionalfalse}
446
447\def\page_one_command_flush_bottom_insertions_indeed
448 {\ifgridsnapping
449
450 \snaptogrid\hbox{\insertbox\namedinsertionnumber\s!bottomfloat}
451
452 \else
453 \rootfloatparameter\c!bottombefore
454 \insertunbox\namedinsertionnumber\s!bottomfloat
455 \rootfloatparameter\c!bottomafter
456 \fi}
457
458\protected\def\page_one_command_flush_floats
459 {\global\c_page_floats_flushing\conditionaltrue
460 \ifconditional\c_page_floats_some_waiting
461 \par
462
463
464 \page_one_command_flush_floats_indeed
465 \fi
466 \global\savednoffloats\zerocount
467 \global\c_page_floats_some_waiting\conditionalfalse
468 \global\c_page_floats_flushing\conditionalfalse}
469
470\protected\def\page_one_command_flush_float_box
471 {\ifconditional\c_page_floats_center_box \ifdim\wd\floatbox<\hsize
472 \global\setbox\floatbox\hpack to \hsize{\hss\box\floatbox\hss}
473 \fi \fi
474 \snaptogrid\hpack{\box\floatbox}}
475
476\def\page_one_command_floats_get_compressed
477 {\c_page_floats_center_box\conditionalfalse
478
479
480
481
482 \global\setbox\floatbox\hbox to \hsize
483 {\hfil
484 \dorecurse\nofcollectedfloats
485 {\ifcase\columndirection
486 \page_floats_flush\s!text\plusone
487 \else
488 \page_floats_flush\s!text{\tointeger{\nofcollectedfloats\recurselevel1}}
489 \fi
490 \hpack to \ifdim\naturalfloatwd>\makeupwidth\makeupwidth\else\naturalfloatwd\fi
491 {\hss\box\floatbox\hss}
492 \ifnum\recurselevel<\nofcollectedfloats
493 \hfil
494 \fi}
495 \hfil}}
496
497\def\page_one_command_flush_floats_indeed
498 {\ifconditional\c_page_floats_some_waiting
499 \ifconditional\c_page_floats_pack_flushed
500 \page_floats_collect\s!text\hsize\d_page_floats_compress_distance
501 \ifcase\nofcollectedfloats
502 \page_floats_get
503 \or
504 \page_floats_get
505 \else
506 \page_one_command_floats_get_compressed
507 \fi
508 \else
509 \page_floats_get
510 \fi
511
512
513
514 \doplacefloatbox
515 \expandafter\page_one_command_flush_floats_indeed
516 \fi}
517
518\protected\def\page_one_command_flush_margin_blocks
519 {\ifconditional\c_page_margin_blocks_present
520 \ifzeropt\pagetotal
521 \null
522 \fi
523 \page_otr_command_next_page
524 \ifvoid\b_page_margin_blocks
525 \global\c_page_margin_blocks_present\conditionalfalse
526 \else
527 \doubleexpandafter\page_one_command_flush_margin_blocks
528 \fi
529 \fi}
530
531\protected\def\page_one_command_check_if_float_fits
532 {\ifconditional\c_page_floats_not_permitted
533 \global\c_page_floats_room\conditionalfalse
534 \else
535
536 \begingroup
537 \scratchdimen{\pagetotal\lineheight}
538 \ifdim\scratchdimen>\pagegoal
539 \goodbreak
540 \fi
541
542 \endgroup
543 \scratchdimenone{
544 \pagetotal
545 \floatheight
546 \d_strc_floats_top
547 \d_strc_floats_overflow
548 \pageshrink
549 }
550 \scratchdimentwo\pagegoal
551 \relax
552 \ifcase\c_page_one_float_method
553
554 \or
555
556
557 \advanceby\scratchdimentwo \strutdp
558 \or
559
560 \advanceby\scratchdimenone \onepoint
561 \fi
562 \relax
563 \ifdim\scratchdimenone>\scratchdimentwo
564 \global\c_page_floats_room\conditionalfalse
565 \else
566 \global\c_page_floats_room\conditionaltrue
567 \fi
568 \fi}
569
570\protected\def\page_one_command_flush_saved_floats
571 {\global\d_page_floats_inserted_top\zeropoint
572 \global\d_page_floats_inserted_bottom\zeropoint
573 \ifconditional\c_page_floats_flushing \else
574 \page_one_command_set_top_insertions
575 \page_one_command_set_bottom_insertions
576 \ifconditional\c_page_floats_some_waiting
577 \ifcstok{\rootfloatparameter\c!cache}\v!no
578 \page_one_command_flush_floats
579 \fi
580 \orelse\ifconditional\c_page_margin_blocks_present
581 \page_one_command_flush_floats
582 \fi
583 \fi}
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608\def\page_one_place_float_here_indeed
609 {\ifgridsnapping
610
611 \else
612 \forcestrutdepth
613 \fi
614 \doplacefloatbox
615 \page_floats_report_total
616 \dohandlenextfloatindent}
617
618\def\page_one_place_float_force
619 {\showmessage\m!floatblocks9\empty
620 \page_one_place_float_here_indeed}
621
622\def\page_one_place_float_side_indeed#1
623 {\setbox\floatbox\vpack{\box\floatbox}
624 \wd\floatbox\floatwidth
625 #1{\box\floatbox}
626 \ifinset\v!tall\floatlocationmethod
627 \page_sides_flush_floats_after_par
628 \fi}
629
630\def\page_one_place_float_left
631 {\page_one_place_float_side_indeed
632 \page_sides_process_float_left
633 \presetindentation}
634
635\def\page_one_place_float_right
636 {\page_one_place_float_side_indeed
637 \page_sides_process_float_right}
638
639\def\page_one_place_float_margin
640 {\page_margin_blocks_process_float
641 \nonoindentation}
642
643\def\page_one_place_float_leftmargin
644 {\page_one_place_float_side_indeed
645 \page_sides_process_float_leftmargin
646 \nonoindentation}
647
648\def\page_one_place_float_rightmargin
649 {\page_one_place_float_side_indeed
650 \page_sides_process_float_rightmargin
651 \nonoindentation}
652
653\def\page_one_place_float_leftedge
654 {\page_one_place_float_side_indeed
655 \page_sides_process_float_leftedge}
656
657\def\page_one_place_float_rightedge
658 {\page_one_place_float_side_indeed
659 \page_sides_process_float_rightedge}
660
661\def\page_one_place_float_inmargin
662 {\page_one_place_float_side_indeed
663 \page_sides_process_float_cutspace}
664
665\def\page_one_place_float_backspace
666 {\page_one_place_float_side_indeed
667 \page_sides_process_float_backspace}
668
669\def\page_one_place_float_cutspace
670 {\page_one_place_float_side_indeed
671 \page_sides_process_float_cutspace}
672
673\def\page_one_place_float_page {\page_floats_save_page_float \s!page \floatlocationmethod}
674\def\page_one_place_float_leftpage {\page_floats_save_page_float \s!leftpage \floatlocationmethod}
675\def\page_one_place_float_rightpage {\page_floats_save_page_float \s!rightpage\floatlocationmethod}
676\def\page_one_place_float_somewhere {\page_floats_save_somewhere_float\s!somewhere\floatlocationmethod}
677
678\def\page_one_place_float_here
679 {\page_one_place_float_otherwise_here}
680
681\def\page_one_place_float_auto
682 {\page_one_place_float_otherwise
683 \nonoindentation}
684
685\def\page_one_place_float_top
686 {\page_one_place_float_otherwise
687 \nonoindentation}
688
689\def\page_one_place_float_bottom
690 {\page_one_place_float_otherwise
691 \nonoindentation}
692
693\def\page_one_place_float_otherwise
694 {\ifinset\v!here\floatlocationmethod
695 \page_one_place_float_otherwise_here
696 \else
697 \page_one_place_float_otherwise_else
698 \fi}
699
700\def\page_one_place_float_otherwise_here
701 {\ifinset\v!always\floatlocationmethod
702 \page[\v!preference]
703 \page_otr_command_check_if_float_fits
704 \ifconditional\c_page_floats_room
705 \page_one_place_float_here_indeed
706 \else
707 \showmessage\m!floatblocks9\empty
708 \page_floats_resave\s!text
709 \fi
710 \orelse\ifconditional\c_page_floats_some_waiting
711 \page_floats_save\s!text
712 \nonoindentation
713 \else
714 \page[\v!preference]
715 \page_otr_command_check_if_float_fits
716 \ifconditional\c_page_floats_room
717 \page_one_place_float_here_indeed
718 \else
719 \page_floats_save\s!text
720 \nonoindentation
721 \fi
722 \fi}
723
724
725
726
727
728
729
730\def\page_one_place_float_otherwise_else
731 {\ifinset\v!always\floatlocationmethod
732 \page_otr_command_check_if_float_fits
733 \ifconditional\c_page_floats_room
734 \page_one_place_float_auto_top_bottom
735 \else
736 \showmessage\m!floatblocks9\empty
737 \ifinset\v!top\floatlocationmethod
738 \page_floats_save\s!top
739 \orelse\ifinset\v!bottom\floatlocationmethod
740 \page_floats_save\s!bottom
741 \else
742 \page_floats_resave\s!text
743 \fi
744 \fi
745 \else
746 \page_otr_command_check_if_float_fits
747 \ifconditional\c_page_floats_room
748 \page_one_place_float_auto_top_bottom
749 \else
750 \page_floats_save\s!text
751 \nonoindentation
752 \fi
753 \fi}
754
755\protected\def\page_one_command_set_always_insertions_bottom_indeed
756 {\page_floats_flush\s!bottom\plusone
757 \floatingpenalty\zerocount
758 \insert\namedinsertionnumber\s!bottomfloat\bgroup
759 \forgetall
760 \blank[\rootfloatparameter\c!spacebefore]
761 \page_otr_command_flush_float_box
762 \egroup}
763
764\protected\def\page_one_command_set_always_insertions_bottom
765 {\ifzero\nofstackedfloatsincategory\s!bottom\else
766 \page_one_command_set_always_insertions_bottom_indeed
767 \expandafter\page_one_command_set_always_insertions_bottom
768 \fi}
769
770\protected\def\page_one_command_set_always_insertions_top_indeed
771 {\page_floats_flush\s!top\plusone
772 \floatingpenalty\zerocount
773 \insert\namedinsertionnumber\s!bottomfloat\bgroup
774 \forgetall
775 \blank[\rootfloatparameter\c!spacebefore]
776 \page_otr_command_flush_float_box
777 \egroup}
778
779\protected\def\page_one_command_set_always_insertions_top
780 {\ifzero\nofstackedfloatsincategory\s!top\else
781 \page_one_command_set_always_insertions_top_indeed
782 \expandafter\page_one_command_set_always_insertions_top
783 \fi}
784
785\mutable\def\floatautofactor{.5}
786
787\def\page_one_place_float_auto_top_bottom
788 {\ifx\floatmethod\v!auto
789 \ifdim\pagetotal<\floatautofactor\pagegoal
790 \page_one_place_float_top_indeed
791 \else
792 \page_one_place_float_bottom_indeed
793 \fi
794 \else
795 \ifx\floatmethod\v!top
796 \page_one_place_float_top_indeed
797 \orelse\ifx\floatmethod\v!bottom
798 \page_one_place_float_bottom_indeed
799 \else
800 \page_one_place_float_here_indeed
801 \fi
802 \fi}
803
804\def\page_one_place_float_top_indeed
805 {\page_one_prepare_top_float
806 \page_one_insert_top_float
807 \page_floats_report_total}
808
809\def\page_one_place_float_bottom_indeed
810 {\global\advanceby\d_page_floats_inserted_bottom{\ht\floatbox\dp\floatbox\d_strc_floats_top}
811 \floatingpenalty\zerocount
812 \insert\namedinsertionnumber\s!bottomfloat\bgroup
813 \forgetall
814 \blank[\rootfloatparameter\c!spacebefore]
815 \page_otr_command_flush_float_box
816 \egroup
817 \page_floats_report_total}
818
819\def\page_one_place_float_face
820 {
821 \startopposite
822 \page_otr_command_flush_float_box
823 \stopopposite
824 }
825
826\protected\def\page_one_command_flush_side_floats
827 {\page_sides_flush_floats}
828
829\protected\def\page_one_command_synchronize_side_floats
830 {\page_sides_synchronize_floats}
831
832\protected\def\page_one_command_test_page
833 {\testpage}
834
835\protected\def\page_one_command_flush_all_floats
836 {\ifconditional\c_page_floats_some_waiting
837 \begingroup
838 \c_page_floats_n_of_top\plusthousand
839 \c_page_floats_n_of_bottom\zerocount
840
841
842
843
844 \pagebaselinecorrection
845
846 \page_otr_command_flush_floats
847 \endgroup
848 \fi}
849
850\defineoutputroutine
851 [\s!singlecolumn]
852 [\s!page_otr_command_routine =\page_one_command_routine,
853 \s!page_otr_command_package_contents =\page_one_command_package_contents,
854 \s!page_otr_command_set_vsize =\page_one_command_set_vsize,
855 \s!page_otr_command_set_hsize =\page_one_command_set_hsize,
856
857 \s!page_otr_command_next_page =\page_one_command_next_page,
858 \s!page_otr_command_next_page_and_inserts =\page_one_command_next_page_and_inserts,
859 \s!page_otr_command_set_top_insertions =\page_one_command_set_top_insertions,
860 \s!page_otr_command_set_bottom_insertions =\page_one_command_set_bottom_insertions,
861 \s!page_otr_command_flush_top_insertions =\page_one_command_flush_top_insertions,
862 \s!page_otr_command_flush_bottom_insertions=\page_one_command_flush_bottom_insertions,
863 \s!page_otr_command_check_if_float_fits =\page_one_command_check_if_float_fits,
864
865 \s!page_otr_command_flush_float_box =\page_one_command_flush_float_box,
866 \s!page_otr_command_side_float_output =\page_one_command_side_float_output,
867 \s!page_otr_command_synchronize_side_floats=\page_one_command_synchronize_side_floats,
868 \s!page_otr_command_flush_floats =\page_one_command_flush_floats,
869 \s!page_otr_command_flush_side_floats =\page_one_command_flush_side_floats,
870 \s!page_otr_command_flush_saved_floats =\page_one_command_flush_saved_floats,
871 \s!page_otr_command_flush_all_floats =\page_one_command_flush_all_floats,
872 \s!page_otr_command_flush_margin_blocks =\page_one_command_flush_margin_blocks,
873 \s!page_otr_command_test_column =\page_one_command_test_page,
874]
875
876
877
878
879\protect \endinput
880 |