page-one.mkiv /size: 24 Kb    last modification: 2020-07-01 14:35
1
%D \module
2
%D [ file=page-one,
3
%D version=2000.10.20,
4
%D title=\CONTEXT\ Page Macros,
5
%D subtitle=Default Routine,
6
%D author=Hans Hagen,
7
%D date=\currentdate,
8
%D copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9
%C
10
%C This module is part of the \CONTEXT\ macro||package and is
11
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12
%C details.
13 14
\writestatus
{
loading
}{
ConTeXt
Page
Macros
/
Default
Routine
}
15 16
%D This is just the good old \CONTEXT\ output routine, which
17
%D has been there right from the start.
18 19
\unprotect
20 21
% OTRONE: basic single column
22 23
\newconstant
\c_page_one_float_method
24 25
\unexpanded
\def
\page_one_command_next_page
26
{
\page_otr_eject_page
}
27 28
\unexpanded
\def
\page_one_command_next_page_and_inserts
29
{
\page_otr_eject_page_and_flush_inserts
}
30 31
\unexpanded
\def
\page_one_command_set_hsize
32
{
\global\hsize
\textwidth
33
\columnwidth
\textwidth
}
% bonus so that it's not zero
34 35
\unexpanded
\def
\page_one_command_set_float_hsize
36
{
\global\hsize
\textwidth
}
37 38
% \newdimen\d_page_one_saved_vsize
39
%
40
% \unexpanded\def\page_one_command_set_vsize
41
% {\ifgridsnapping
42
% \ifcase\layoutlines
43
% \getrawnoflines\textheight
44
% \else
45
% \noflines\layoutlines
46
% \fi
47
% \global\vsize\noflines\openlineheight
48
% \else
49
% \global\vsize\textheight
50
% \fi
51
% \ifdim\pagegoal<\maxdimen
52
% \ifdim\d_page_one_saved_vsize=\vsize
53
% % let's assume that the layout didn't change
54
% \else
55
% \global\d_page_one_saved_vsize\vsize
56
% \pagegoal\dimexpr\vsize-\d_page_floats_inserted_top-\d_page_floats_inserted_bottom\relax
57
% % \bgroup
58
% % \global\d_page_one_saved_vsize\vsize
59
% % \advance\vsize-\d_page_floats_inserted_top
60
% % \advance\vsize-\d_page_floats_inserted_bottom
61
% % \pagegoal\vsize
62
% % \egroup
63
% \fi
64
% \fi}
65 66
\unexpanded
\def
\page_one_command_set_vsize
67
{
\ifgridsnapping
68
\ifcase
\layoutlines
69
\getrawnoflines
\textheight
70
\else
71
\noflines
\layoutlines
72
\fi
73
\global\vsize
\noflines
\openlineheight
74
\else
75
\global\vsize
\textheight
76
\fi
77
\global\advance\vsize
\d_page_adapts_delta
78
% alternatively we could set it in builders.buildpage_filter
79
% \ifdim\pagegoal<\maxdimen .. \fi
80
\pagegoal\dimexpr\vsize
-
\d_page_floats_inserted_top
-
\d_page_floats_inserted_bottom
\relax
}
81 82 83
% 1 = partial page, 2 = whole page, 3 = partial page
84 85
\setnewconstant
\kindofpagetextareas
\plustwo
% \plusone can become default some day
86 87
\def
\page_one_registered_text_area_a
% two arguments: (un)vbox n
88
{
\ifconditional
\c_page_areas_enabled
89
\expandafter
\page_one_registered_text_area_a_indeed
90
\else
91
\expandafter
\firstofoneargument
92
\fi
}
93 94
\def
\page_one_registered_text_area_b
% one arguments: content
95
{
\ifconditional
\c_page_areas_enabled
96
\expandafter
\page_one_registered_text_area_b_indeed
97
\else
98
\expandafter
\firstofoneargument
99
\fi
}
100 101
\def
\page_one_registered_text_area_a_indeed
% two arguments: (un)vbox n
102
{
\ifcase
\kindofpagetextareas
103
\expandafter
\firstofoneargument
104
\or
% partial page (experimental)
105
\expandafter
\page_areas_register_direct
106
\or
% whole page (default)
107
\expandafter
\firstofoneargument
108
\else
109
\expandafter
\firstofoneargument
110
\fi
}
111 112
\def
\page_one_registered_text_area_b_indeed
% one arguments: content
113
{
\ifcase
\kindofpagetextareas
114
% \expandafter\firstofoneargument
115
\or
% partial page (experimental)
116
% \expandafter\firstofoneargument
117
\or
% whole page (default)
118
\expandafter
\page_areas_register_boxed
119
\else
120
% \expandafter\firstofoneargument
121
\fi
}
122 123
\newdimen
\d_page_one_natural_depth
124
\newbox
\b_page_one_bottom_notes
125
\newbox
\b_page_one_contents
126 127
\let
\page_one_command_package_show_state
\relax
128 129
% \fakepagenotes ... needs checking
130
%
131
% we can also have bottom notes on top of bottom insertions
132 133
\unexpanded
\def
\page_one_command_package_contents
#
1
#
2
% \box<n> \unvbox<n> % this one will be redone (checked)
134
{
\bgroup
135
\strc_notes_check_if_bottom_present
136
\d_page_one_natural_depth
\dp
#
2
\relax
137
% we need to set the height as otherwise the shrink will not kick in so the following
138
% no longer applies:
139
%
140
% \setbox\b_page_one_contents\vbox \ifconditional\c_notes_bottom_present to \textheight \fi
141
%
142
\setbox
\b_page_one_contents
\vbox
to
\textheight
% probably no pack
143
{
\page_otr_command_flush_top_insertions
144
% this is messy ... we will provide a more tight area (no big deal as we can
145
% do that at the lua end)
146
% \parfillskip\zeropoint
147
\page_one_registered_text_area_a
#
1
#
2
% \unvbox <box>
148
%
149
\ifgridsnapping
150
\unskip
% new per 2019-06-18, otherwise weird bottom floats
151
\vkern
\dimexpr
\openstrutdepth
-
\d_page_one_natural_depth
\relax
152
\prevdepth
\openstrutdepth
153
\page_otr_command_flush_bottom_insertions
154
\vfil
155
\else\ifcase
\bottomraggednessmode
156
% ragged (default)
157
\unskip
% new per 2019-06-18, otherwise weird bottom floats
158
\vkern
\dimexpr
\openstrutdepth
-
\d_page_one_natural_depth
\relax
159
\prevdepth
\openstrutdepth
160
% these have whitespace before but we can have some more options
161
% like a \vfill or so
162
\page_otr_command_flush_bottom_insertions
163
\vfil
164
\or
165
% align (normal)
166
\page_otr_command_flush_bottom_insertions
167
\or
168
% baseline
169
\unskip
% new per 2019-06-18, otherwise weird bottom floats
170
\vkern
\dimexpr\maxdepth
-
\d_page_one_natural_depth
\relax
171
\page_otr_command_flush_bottom_insertions
172
\fi\fi
173
\fakepagenotes
}
%
174
\page_one_command_package_show_state
175
\ifconditional
\c_notes_bottom_present
176
\ifgridsnapping
177
\ifcase
\layoutlines
178
\getrawnoflines
\textheight
179
\else
180
\noflines
\layoutlines
181
\fi
182
\scratchoffset
\dimexpr\numexpr
\noflines
-
\plusone
\relax
\lineheight
+
\topskip\relax
183
\else
184
\scratchoffset
\ht
\b_page_one_contents
185
\fi
186
\setbox
\b_page_one_bottom_notes
\hpack
187
{
\checksinglecolumnfootnotes
% why this check? ***
188
\lower
\scratchoffset
\vbox
{
\placebottomnotes
\par\kern
\zeropoint
}}
% kerns makes notes sit on bottom % pack ?
189
\smashbox
\b_page_one_bottom_notes
190
\ht
\b_page_one_contents
\zeropoint
191
\page_one_registered_text_area_b
192
{
\vpack
to
\textheight
193
{
\box
\b_page_one_contents
194
\box
\b_page_one_bottom_notes
}}
%
195
\else
196
\ht
\b_page_one_contents
\textheight
197
\page_one_registered_text_area_b
198
{
\box
\b_page_one_contents
}
%
199
\fi
200
\egroup
}
201 202
\unexpanded
\def
\page_one_command_side_float_output
203
{
\page_otr_construct_and_shipout
\unvbox
\normalpagebox\plusone
}
% three arguments, we need to be in the output group
204 205
\unexpanded
\def
\page_one_command_routine
206
{
\page_sides_output_routine
}
207 208
%D Insertions
209 210
\newconditional
\c_page_one_top_of_insert
211
\newconditional
\c_page_one_correct_top_insert
\settrue
\c_page_one_correct_top_insert
% false moves up (tight)
212
\newskip
\s_page_one_between_top_insert
213 214
\def
\page_one_prepare_top_float
215
{
\ifdim
\d_page_floats_inserted_top
=
\zeropoint
216
\settrue
\c_page_one_top_of_insert
217
\else
218
\setfalse
\c_page_one_top_of_insert
219
\fi
220
\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
221
\global\advance
\d_page_floats_inserted_top
\dimexpr\ht
\floatbox
+
\dp
\floatbox
+
\s_page_one_between_top_insert
\relax
}
222 223
\def
\page_one_insert_top_float
% maybe remember last beforeskip
224
{
\floatingpenalty
\zerocount
225
\insert
\namedinsertionnumber
\s!topfloat
\bgroup
226
\forgetall
227
\ifconditional
\c_page_one_top_of_insert
228
\ifconditional
\c_page_one_correct_top_insert
229
\topskipcorrection
% [xx] new: see icare topbleed
230
\kern
-
\lineskip
231
\par
232
\prevdepth
\maxdimen
233
\fi
234
\fi
235
\page_otr_command_flush_float_box
236
\vskip
\s_page_one_between_top_insert
237
\egroup
}
238 239
\let
\totaltopinserted
\!!zeropoint
240
\let
\totalbotinserted
\!!zeropoint
241 242
\unexpanded
\def
\page_one_command_set_top_insertions
243
{
\bgroup
244
\ifconditional
\c_page_floats_some_waiting
245
\noffloatinserts
\zerocount
246
\let
\totaltopinserted
\!!zeropoint
247
\page_one_command_set_top_insertions_indeed
248
\ifnum
\rootfloatparameter
\c!nbottom
=
\zerocount
249
\ifnum
\rootfloatparameter
\c!nlines
>
\zerocount
250
\ifdim
\totaltopinserted
>
\zeropoint
\relax
251
\ifdim
\dimexpr
\rootfloatparameter
\c!nlines
\lineheight
+
\totaltopinserted
\relax
>
\textheight
252
\showmessage
\m!floatblocks
8
{
\rootfloatparameter
\c!nlines
}
%
253
\page_otr_fill_and_eject_page
% was tripple: vfilll
254
\fi
255
\fi
256
\fi
257
\fi
258
\fi
259
\egroup
}
260 261
\def
\page_one_command_set_top_insertions_indeed
262
{
\ifnum
\noffloatinserts
<
\c_page_floats_n_of_top
263
\page_floats_get
264
\page_one_prepare_top_float
265
\ifdim
\d_page_floats_inserted_top
<
\textheight
\relax
266
\xdef
\totaltopinserted
{
\the
\d_page_floats_inserted_top
}
%
267
\page_one_insert_top_float
268
\ifconditional
\c_page_floats_some_waiting
269
\advance
\noffloatinserts
\plusone
270
\else
271
\noffloatinserts
\c_page_floats_n_of_top
\relax
272
\fi
273
\page_floats_report_flushed
274
\else
275
\page_floats_resave
\s!text
276
\noffloatinserts
\c_page_floats_n_of_top
\relax
277
\fi
278
\else
279
\ifconditional
\c_page_floats_some_waiting
280
\showmessage
\m!floatblocks
6
{
\the
\c_page_floats_n_of_top
}
%
281
\fi
282
\let
\page_one_command_set_top_insertions_indeed
\relax
283
\fi
284
\page_one_command_set_top_insertions_indeed
}
285 286
\unexpanded
\def
\page_one_command_set_bottom_insertions
287
{
\bgroup
288
\ifconditional
\c_page_floats_some_waiting
289
\noffloatinserts
\zerocount
290
\page_one_command_set_bottom_insertions_indeed
291
\fi
292
\egroup
}
293 294
\def
\page_one_command_set_bottom_insertions_indeed
295
{
\ifnum
\noffloatinserts
<
\c_page_floats_n_of_bottom
\relax
296
\page_floats_get
297
\global\advance
\d_page_floats_inserted_bottom
\dimexpr\ht
\floatbox
+
\dp
\floatbox
+
\d_strc_floats_top
\relax
298
\ifdim
\d_page_floats_inserted_bottom
<
\pagegoal\relax
299
\floatingpenalty
\zerocount
300
\insert
\namedinsertionnumber
\s!bottomfloat
\bgroup
301
\forgetall
302
\blank
[
\rootfloatparameter
\c!spacebefore
]
%
303
\page_otr_command_flush_float_box
304
\egroup
305
\ifconditional
\c_page_floats_some_waiting
306
\advance
\noffloatinserts
\plusone
307
\else
308
\noffloatinserts
\c_page_floats_n_of_bottom
309
\fi
310
\page_floats_report_flushed
311
\else
312
\page_floats_resave
\s!text
313
\noffloatinserts
\c_page_floats_n_of_bottom
\relax
314
\fi
315
\global
\settrue
\c_page_floats_not_permitted
% vgl topfloats s!
316
\else
317
\ifconditional
\c_page_floats_some_waiting
318
\showmessage
\m!floatblocks
7
{
\the
\c_page_floats_n_of_bottom
}
%
319
\fi
320
\let
\page_one_command_set_bottom_insertions_indeed
\relax
321
\fi
322
\page_one_command_set_bottom_insertions_indeed
}
323 324
\unexpanded
\def
\page_one_command_flush_top_insertions
325
{
\ifvoid
\namedinsertionnumber
\s!topfloat
\else
326
\page_one_command_flush_top_insertions_indeed
% less tracing
327
\fi
328
\global
\d_page_floats_inserted_top
\zeropoint
}
329 330
\def
\page_one_command_flush_top_insertions_indeed
331
{
\ifgridsnapping
332
\box
\namedinsertionnumber
\s!topfloat
333
\vkern
-
\topskip
334
\vkern
\strutheight
% [xx] new: see icare topbleed
335
\else
336
\ifcase
\c_page_floats_insertions_topskip_mode
337
% 0: default, do nothing
338
\or
339
% 1: no topskip (crossed fingers)
340
\vskip
-
\topskip
% skip !
341
\vkern
\strutheight
342
\fi
343
\unvbox
\namedinsertionnumber
\s!topfloat
344
\fi
}
345 346
\unexpanded
\def
\page_one_command_flush_bottom_insertions
347
{
\ifvoid
\namedinsertionnumber
\s!bottomfloat
\else
348
\page_one_command_flush_bottom_insertions_indeed
349
\fi
350
\global
\d_page_floats_inserted_bottom
\zeropoint
351
\global
\setfalse
\c_page_floats_not_permitted
}
352 353
\def
\page_one_command_flush_bottom_insertions_indeed
354
{
\ifgridsnapping
355
% \floatparameter\c!bottombefore
356
\snaptogrid
\hbox
{
\box
\namedinsertionnumber
\s!bottomfloat
}
%
357
% \floatparameter\c!bottomafter
358
\else
359
\floatparameter
\c!bottombefore
360
\unvbox
\namedinsertionnumber
\s!bottomfloat
361
\floatparameter
\c!bottomafter
362
\fi
}
363 364
\unexpanded
\def
\page_one_command_flush_floats
365
{
\global
\settrue
\c_page_floats_flushing
366
\ifconditional
\c_page_floats_some_waiting
367
\par
368
% if kept, then option and definitely off in gridmode ! ! ! !
369
% \ifvmode \prevdepth\maxdimen \fi % prevents whitespace; problematic in icare tests
370
\page_one_command_flush_floats_indeed
371
\fi
372
\global
\savednoffloats
\zerocount
373
\global
\setfalse
\c_page_floats_some_waiting
374
\global
\setfalse
\c_page_floats_flushing
}
375 376
\unexpanded
\def
\page_one_command_flush_float_box
377
{
\ifconditional
\c_page_floats_center_box
\ifdim
\wd
\floatbox
<
\hsize
378
\global\setbox
\floatbox
\hpack
to
\hsize
{
\hss\box
\floatbox
\hss
}
%
379
\fi
\fi
380
\snaptogrid
\hpack
{
\box
\floatbox
}}
% was copy
381 382
\def
\page_one_command_floats_get_compressed
383
{
\setfalse
\c_page_floats_center_box
% not needed as we do call directly
384
%% no longer (interferes with footnotes):
385
%%
386
%% \page_one_command_set_vsize % test 2011.06.24.001
387
%%
388
\global\setbox
\floatbox
\hbox
to
\hsize
389
{
\hfil
390
\dorecurse
\nofcollectedfloats
391
{
\ifcase
\columndirection
% nog document wide
392
\page_floats_flush
\s!text
\plusone
393
\else
394
\page_floats_flush
\s!text
{
\the\numexpr
\nofcollectedfloats
-
\recurselevel
+
1
\relax
}
%
395
\fi
396
\hpack
to
\ifdim
\naturalfloatwd
>
\makeupwidth
\makeupwidth
\else
\naturalfloatwd
\fi
397
{
\hss\box
\floatbox
\hss
}
%
398
\ifnum
\recurselevel
<
\nofcollectedfloats
399
\hfil
400
\fi
}
%
401
\hfil
}}
402 403
\def
\page_one_command_flush_floats_indeed
404
{
\ifconditional
\c_page_floats_some_waiting
405
\ifconditional
\c_page_floats_pack_flushed
406
\page_floats_collect
\s!text
\hsize
\d_page_floats_compress_distance
407
\ifcase
\nofcollectedfloats
408
\page_floats_get
409
\or
410
\page_floats_get
411
\else
412
\page_one_command_floats_get_compressed
413
\fi
414
\else
415
\page_floats_get
416
\fi
417
% there is a chance that due to rounding errors, the float
418
% fits on a page where it was first rejected, in which case
419
% the prevdepth is -maxdimen and we cannot obey the grid
420
\doplacefloatbox
421
\expandafter
\page_one_command_flush_floats_indeed
422
\fi
}
423 424
\unexpanded
\def
\page_one_command_flush_margin_blocks
425
{
\ifconditional
\c_page_margin_blocks_present
% \ifvoid\b_page_margin_blocks \else
426
\ifdim
\pagetotal
=
\zeropoint
427
\null
% \fixedspace
428
\fi
429
\page_otr_command_next_page
% \page
430
\ifvoid
\b_page_margin_blocks
431
\global
\setfalse
\c_page_margin_blocks_present
432
\else
433
\doubleexpandafter
\page_one_command_flush_margin_blocks
434
\fi
435
\fi
}
436 437
\unexpanded
\def
\page_one_command_check_if_float_fits
438
{
\ifconditional
\c_page_floats_not_permitted
439
\global
\setfalse
\c_page_floats_room
440
\else
441
% new per 31/5/2004, should be an option, only one column mode
442
\begingroup
443
\scratchdimen
\dimexpr\pagetotal
+
\lineheight
\relax
444
\ifdim
\scratchdimen
>
\pagegoal
445
\goodbreak
% hack ?
446
\fi
447
% should be an option
448
\endgroup
449
\scratchdimenone
\dimexpr
450
\pagetotal
451
+
\floatheight
452
+
\d_strc_floats_top
453
+
\d_strc_floats_overflow
454
-
\pageshrink
455
\relax
456
\scratchdimentwo
\pagegoal
457
\relax
% needed
458
\ifcase
\c_page_one_float_method
459
% method 0 : raw
460
\or
461
% method 1 : safe
462
% too fuzzy as it can change and for a high page it's a lot : \scratchdimentwo .99\pagegoal
463
\advance
\scratchdimentwo
-
\strutdp
464
\or
465
% method 2 : tight
466
\advance
\scratchdimenone
-
\onepoint
467
\fi
468
\relax
% really needed ! ! ! !
469
\ifdim
\scratchdimenone
>
\scratchdimentwo
470
\global
\setfalse
\c_page_floats_room
471
\else
472
\global
\settrue
\c_page_floats_room
473
\fi
474
\fi
}
475 476
\unexpanded
\def
\page_one_command_flush_saved_floats
477
{
\global
\d_page_floats_inserted_top
\zeropoint
478
\global
\d_page_floats_inserted_bottom
\zeropoint
479
\ifconditional
\c_page_floats_flushing
\else
480
\page_one_command_set_top_insertions
481
\page_one_command_set_bottom_insertions
482
\ifconditional
\c_page_floats_some_waiting
483
\doif
{
\rootfloatparameter
\c!cache
}
\v!no
\page_one_command_flush_floats
% could be _otr_
484
\else
\ifconditional
\c_page_margin_blocks_present
485
\page_one_command_flush_floats
486
\fi\fi
487
\fi
}
488 489
\def
\page_one_place_float_here_indeed
490
{
\ifgridsnapping
491
% otherwise real bad outcome
492
\else
493
\baselinecorrection
% this has to be done better (and definitely not in column mode)
494
\fi
495
\doplacefloatbox
496
\page_floats_report_total
497
\dohandlenextfloatindent
}
498 499
\def
\page_one_place_float_force
500
{
\showmessage
\m!floatblocks
9
\empty
501
\page_one_place_float_here_indeed
}
502 503
\def
\page_one_place_float_side_indeed
#
1
%
504
{
\setbox
\floatbox
\vpack
{
\box
\floatbox
}
% ? can go
505
\wd
\floatbox
\floatwidth
506
#
1
{
\box
\floatbox
}
%
507
\doifinset
\v!tall
\floatlocationmethod
\page_sides_flush_floats_after_par
}
508 509
\def
\page_one_place_float_left
510
{
\page_one_place_float_side_indeed
511
\page_sides_process_float_left
512
\presetindentation
}
513 514
\def
\page_one_place_float_right
515
{
\page_one_place_float_side_indeed
516
\page_sides_process_float_right
}
517 518
\def
\page_one_place_float_margin
519
{
\page_margin_blocks_process_float
520
\nonoindentation
}
% new, due to popular request
521 522
\def
\page_one_place_float_leftmargin
523
{
\page_one_place_float_side_indeed
524
\page_sides_process_float_leftmargin
525
\nonoindentation
}
% new, due to popular request
526 527
\def
\page_one_place_float_rightmargin
528
{
\page_one_place_float_side_indeed
529
\page_sides_process_float_rightmargin
530
\nonoindentation
}
% new, due to popular request
531 532
\def
\page_one_place_float_leftedge
533
{
\page_one_place_float_side_indeed
534
\page_sides_process_float_leftedge
}
535 536
\def
\page_one_place_float_rightedge
537
{
\page_one_place_float_side_indeed
538
\page_sides_process_float_rightedge
}
539 540
\def
\page_one_place_float_inmargin
541
{
\page_one_place_float_side_indeed
542
\page_sides_process_float_cutspace
}
543 544
\def
\page_one_place_float_backspace
545
{
\page_one_place_float_side_indeed
546
\page_sides_process_float_backspace
}
547 548
\def
\page_one_place_float_cutspace
549
{
\page_one_place_float_side_indeed
550
\page_sides_process_float_cutspace
}
551 552
\def
\page_one_place_float_page
{
\page_floats_save_page_float
\s!page
\floatlocationmethod
}
553
\def
\page_one_place_float_leftpage
{
\page_floats_save_page_float
\s!leftpage
\floatlocationmethod
}
554
\def
\page_one_place_float_rightpage
{
\page_floats_save_page_float
\s!rightpage
\floatlocationmethod
}
555
\def
\page_one_place_float_somewhere
{
\page_floats_save_somewhere_float
\s!somewhere
\floatlocationmethod
}
556 557
\def
\page_one_place_float_here
558
{
\page_one_place_float_otherwise_here
}
559 560
\def
\page_one_place_float_auto
561
{
\page_one_place_float_otherwise
562
\nonoindentation
}
% new, due to popular request
563 564
\def
\page_one_place_float_top
565
{
\page_one_place_float_otherwise
566
\nonoindentation
}
567 568
\def
\page_one_place_float_bottom
569
{
\page_one_place_float_otherwise
570
\nonoindentation
}
% new, due to popular request
571 572
\def
\page_one_place_float_otherwise
573
{
\doifelseinset
\v!here
\floatlocationmethod
574
\page_one_place_float_otherwise_here
575
\page_one_place_float_otherwise_else
}
576 577
\def
\page_one_place_float_otherwise_here
578
{
\doifelseinset
\v!always
\floatlocationmethod
579
{
\page
[
\v!preference
]
%
580
\page_otr_command_check_if_float_fits
581
\ifconditional
\c_page_floats_room
582
\page_one_place_float_here_indeed
583
\else
584
\showmessage
\m!floatblocks
9
\empty
585
\page_floats_resave
\s!text
586
\fi
}
587
{
\ifconditional
\c_page_floats_some_waiting
588
\page_floats_save
\s!text
589
\nonoindentation
590
\else
591
\page
[
\v!preference
]
%
592
\page_otr_command_check_if_float_fits
593
\ifconditional
\c_page_floats_room
594
\page_one_place_float_here_indeed
595
\else
596
\page_floats_save
\s!text
597
\nonoindentation
598
\fi
599
\fi
}}
600 601
\def
\page_one_place_float_otherwise_else
602
{
\doifelseinset
\v!always
\floatlocationmethod
603
{
\page_otr_command_check_if_float_fits
604
\ifconditional
\c_page_floats_room
605
\page_one_place_float_auto_top_bottom
606
\else
607
\showmessage
\m!floatblocks
9
\empty
608
\page_floats_resave
\s!text
609
\fi
}
610
{
\page_otr_command_check_if_float_fits
611
\ifconditional
\c_page_floats_room
612
\page_one_place_float_auto_top_bottom
613
\else
614
\page_floats_save
\s!text
615
\nonoindentation
616
\fi
}}
617 618
\def
\floatautofactor
{
.
5
}
619 620
\def
\page_one_place_float_auto_top_bottom
621
{
\ifx
\floatmethod
\v!auto
622
\ifdim
\pagetotal
<
\floatautofactor
\pagegoal
% when empty page, maxdimen
623
\page_one_place_float_top_indeed
624
\else
625
\page_one_place_float_bottom_indeed
626
\fi
627
\else
628
\ifx
\floatmethod
\v!top
629
\page_one_place_float_top_indeed
630
\else\ifx
\floatmethod
\v!bottom
631
\page_one_place_float_bottom_indeed
632
\else
633
\page_one_place_float_here_indeed
634
\fi\fi
635
\fi
}
636 637
\def
\page_one_place_float_top_indeed
% maybe remember last beforeskip
638
{
\page_one_prepare_top_float
639
\page_one_insert_top_float
640
\page_floats_report_total
}
641 642
\def
\page_one_place_float_bottom_indeed
643
{
\global\advance
\d_page_floats_inserted_bottom
\dimexpr\ht
\floatbox
+
\dp
\floatbox
+
\d_strc_floats_top
\relax
644
\floatingpenalty
\zerocount
645
\insert
\namedinsertionnumber
\s!bottomfloat
\bgroup
646
\forgetall
647
\blank
[
\rootfloatparameter
\c!spacebefore
]
%
648
\page_otr_command_flush_float_box
649
\egroup
650
\page_floats_report_total
}
651 652
\def
\page_one_place_float_face
% links, rechts, midden, hoog, midden, laag
653
{
%\checkwaitingfloats{#1}%
654
\startopposite
655
\page_otr_command_flush_float_box
656
\stopopposite
657
}
%\page_floats_report_total}
658 659
\unexpanded
\def
\page_one_command_flush_side_floats
660
{
\page_sides_flush_floats
}
661 662
\unexpanded
\def
\page_one_command_synchronize_side_floats
663
{
\page_sides_synchronize_floats
}
664 665
\unexpanded
\def
\page_one_command_test_page
666
{
\testpage
}
667 668
\unexpanded
\def
\page_one_command_flush_all_floats
669
{
\ifconditional
\c_page_floats_some_waiting
670
\begingroup
671
\c_page_floats_n_of_top
\plusthousand
672
\c_page_floats_n_of_bottom
\zerocount
673
% this is needed in case a float that has been stored
674
% ends up at the current page; this border case occurs when
675
% the calculated room is 'eps' smaller that the room available
676
% when just flushing; so now we have (maybe optional):
677
\pagebaselinecorrection
% hm, needs checking, not needed when no floats
678
% alas, this is tricky but needed (first surfaced in prikkels)
679
\page_otr_command_flush_floats
680
\endgroup
681
\fi
}
682 683
\unexpanded
\def
\page_one_command_flush_facing_floats
684
{
\strc_floats_facing_flush
}
685 686
\defineoutputroutine
687
[
\s!singlecolumn
]
688
[
\s!page_otr_command_routine
=
\page_one_command_routine
,
689
\s!page_otr_command_package_contents
=
\page_one_command_package_contents
,
690
\s!page_otr_command_set_vsize
=
\page_one_command_set_vsize
,
691
\s!page_otr_command_set_hsize
=
\page_one_command_set_hsize
,
692
% \s!page_otr_command_synchronize_hsize =\page_one_command_synchronize_hsize,
693
\s!page_otr_command_next_page
=
\page_one_command_next_page
,
694
\s!page_otr_command_next_page_and_inserts
=
\page_one_command_next_page_and_inserts
,
695
\s!page_otr_command_set_top_insertions
=
\page_one_command_set_top_insertions
,
696
\s!page_otr_command_set_bottom_insertions
=
\page_one_command_set_bottom_insertions
,
697
\s!page_otr_command_flush_top_insertions
=
\page_one_command_flush_top_insertions
,
698
\s!page_otr_command_flush_bottom_insertions
=
\page_one_command_flush_bottom_insertions
,
699
\s!page_otr_command_check_if_float_fits
=
\page_one_command_check_if_float_fits
,
700
% \s!page_otr_command_set_float_hsize =\page_one_command_set_float_hsize,
701
\s!page_otr_command_flush_float_box
=
\page_one_command_flush_float_box
,
702
\s!page_otr_command_side_float_output
=
\page_one_command_side_float_output
,
703
\s!page_otr_command_synchronize_side_floats
=
\page_one_command_synchronize_side_floats
,
704
\s!page_otr_command_flush_floats
=
\page_one_command_flush_floats
,
705
\s!page_otr_command_flush_side_floats
=
\page_one_command_flush_side_floats
,
706
\s!page_otr_command_flush_saved_floats
=
\page_one_command_flush_saved_floats
,
707
\s!page_otr_command_flush_all_floats
=
\page_one_command_flush_all_floats
,
708
\s!page_otr_command_flush_margin_blocks
=
\page_one_command_flush_margin_blocks
,
709
\s!page_otr_command_test_column
=
\page_one_command_test_page
,
710
\s!page_otr_command_flush_facing_floats
=
\page_one_command_flush_facing_floats
711
]
712 713
% \setupoutputroutine
714
% [\s!singlecolumn]
715 716
\protect
\endinput
717