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