1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16\writestatus{loading}{ConTeXt Structure Macros Float Numbering}
17
18\registerctxluafile{strcflt}{}
19
20\unprotect
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61\installcorenamespace{float}
62\installcorenamespace{floatbuilder}
63\installcorenamespace{floatcaption}
64\installcorenamespace{floatframed}
65
66\installframedcommandhandler \??float {float} \??float
67\installframedcommandhandler \??floatcaption {floatcaption} \??floatcaption
68\installframedcommandhandler \??floatframed {floatframed} \??floatframed
69
70\let\setupfloats \setupfloat
71\let\setupcaption \setupfloatcaption
72\let\setupcaptions\setupfloatcaption
73
74\unexpanded\def\dohandlenextfloatindent
75 {\useindentnextparameter\floatparameter
76 \dorechecknextindentation}
77
78\setupcaptions
79 [\c!location=\v!bottom,
80 \c!grid=,
81 \c!before=,
82 \c!inbetween={\blank[\v!medium]},
83 \c!after=,
84 \c!spacebefore=,
85 \c!spaceinbetween=,
86 \c!spaceafter=,
87 \c!width=\v!fit,
88 \c!minwidth=\v!fit,
89 \c!headstyle=\v!bold,
90 \c!headcolor=,
91 \c!leftmargin=\zeropoint,
92 \c!rightmargin=\zeropoint,
93 \c!outermargin=\zeropoint,
94 \c!innermargin=\zeropoint,
95 \c!setups=,
96 \c!style=\v!normal,
97 \c!color=,
98 \c!textstyle=,
99 \c!textcolor=,
100 \c!align=,
101 \c!number=\v!yes,
102 \c!offset=\v!overlay,
103 \c!frame=\v!off,
104
105
106
107
108
109
110
111
112
113
114
115 \c!suffixseparator=,
116 \c!suffix=\floatcaptionsuffix,
117 \c!distance=\emwidth,
118 \c!conversion=\v!numbers,
119 \c!maxwidth=\hsize,
120 \c!command=]
121
122
123
124\setupfloats
125 [\c!location=\v!middle,
126 \c!width=8\lineheight,
127 \c!height=6\lineheight,
128 \c!offset=\v!overlay,
129 \c!frame=\v!off,
130 \c!strut=\v!no,
131 \c!radius=.5\bodyfontsize,
132 \c!corner=\v!rectangular,
133 \c!grid=,
134
135
136 \c!backgroundoffset=\!!zeropoint,
137
138
139
140
141 \c!frameoffset=\!!zeropoint,
142
143
144 \c!spacebefore=\v!big,
145 \c!spaceafter=\v!big,
146 \c!sidespacebefore=\rootfloatparameter\c!spacebefore,
147 \c!sidespaceafter=\rootfloatparameter\c!spaceafter,
148 \c!sidespaceinbetween=\rootfloatparameter\c!spacebefore,
149 \c!spacebeforeside=,
150 \c!spaceafterside=,
151 \c!sidealign=\v!normal,
152 \c!textmethod=\ifgridsnapping2\else0\fi,
153 \c!sidemethod=\ifgridsnapping2\else1\fi,
154 \c!indentnext=\v!no,
155 \c!margin=\emwidth,
156 \c!method=1,
157 \c!cache=\v!yes,
158 \c!leftmargin=\zeropoint,
159 \c!rightmargin=\zeropoint,
160 \c!innermargin=\zeropoint,
161 \c!outermargin=\zeropoint,
162 \c!leftmargindistance=\zeropoint,
163 \c!rightmargindistance=\floatparameter\c!leftmargindistance,
164 \c!step=\v!small,
165 \c!ntop=2,
166 \c!nbottom=0,
167 \c!nlines=4,
168 \c!topoffset=\zeropoint,
169 \c!bottomoffset=\zeropoint,
170 \c!freeregion=\v!yes,
171
172
173
174
175 \c!sidethreshold=.5\strutdp,
176 \c!numbering=\v!yes,
177 \c!compress=\v!yes,
178 \c!compressdistance=\emwidth]
179
180\setupfloatframed
181 [\c!frame=\v!off,
182 \c!offset=\v!overlay,
183 \c!strut=\v!no]
184
185\appendtoks
186 \doifelse{\floatparameter\c!compress}\v!yes\settrue\setfalse\c_page_floats_pack_flushed
187 \d_page_floats_compress_distance\floatparameter\c!compressdistance\relax
188\to \everysetupfloat
189
190
191
192\setupfloat
193 [\c!compress=\v!yes,
194 \c!compressdistance=\emwidth]
195
196
197
198\installcounterassociation{floatcaption}
199
200\appendtoks
201 \let\currentfloat\currentfloatcaption
202 \synchronizefloatcaptioncounters
203\to \everysetupfloatcaption
204
205\appendtoks
206 \let\currentfloat\currentfloatcaption
207 \synchronizefloatcaptioncounters
208\to \everydefinefloatcaption
209
210
211
212\let\strc_floats_define_saved\definefloat
213
214\unexpanded\overloaded\def\definefloat
215 {\dotripleempty\strc_floats_define}
216
217\def\strc_floats_define[#1][#2][#3]
218 {\ifthirdargument
219 \doifassignmentelse{#3}
220 {\strc_floats_define_b[#1][#2][#3]}
221 {\strc_floats_define_a[#1][#2][#3]}
222 \else\ifsecondargument
223 \doifelsecommandhandler\??float{#2}
224 {\strc_floats_define_a[#1][#1][#2]}
225 {\strc_floats_define_c[#1][#2]}
226 \else
227 \strc_floats_define_c[#1][#1]
228 \fi\fi}
229
230\def\strc_floats_define_a[#1][#2][#3]
231 {\definefloatcaption[#1][#3]
232 \definefloatframed[#1][#3]
233 \definecounter[#1][#3]
234 \definelist[#1][#3]
235 \copylabeltext[#1=#3]
236 \strc_floats_define_saved[#1][#3]
237 \strc_floats_define_commands{#1}{#2}}
238
239\def\strc_floats_define_b[#1][#2][#3]
240 {\definefloatcaption[#1][#2]
241 \definefloatframed[#1][#2]
242 \definecounter[#1][#2]
243 \definelist[#1][#2]
244 \copylabeltext[#1=#2]
245 \strc_floats_define_saved[#1][#2][#3]
246 \strc_floats_define_commands{#1}{#1}}
247
248\def\strc_floats_define_c[#1][#2]
249 {\registerfloatcaptioncounter{#1}
250 \definefloatcaption[#1]
251 \definefloatframed[#1]
252 \definecounter[#1]
253 \definelist[#1]
254 \presetlabeltext[#1=\Word{#1}]
255 \presetheadtext[#2=\Word{#2}]
256 \strc_floats_define_saved[#1]
257 \strc_floats_define_commands{#1}{#2}}
258
259\def\strc_floats_define_commands#1#2
260 {\setuvalue {\e!place\e!listof#2}{\dodoubleempty\strc_lists_place[#1]}
261 \setuvalue {\e!complete\e!listof#2}{\dotripleempty\strc_lists_complete_indeed[#1][#2]}
262 \setuevalue {\e!place#1}{\strc_floats_place{#1}}
263 \setuevalue {\e!start\e!place#1}{\strc_floats_start_place{#1}}
264 \setuevalue {\e!stop\e!place#1}{\strc_floats_stop_place}
265 \setuevalue {\e!start#1\e!text}{\strc_floats_start_text{#1}}
266 \setuevalue {\e!stop#1\e!text}{\strc_floats_stop_text}
267
268 \setuevalue {\e!reserve#1}{\strc_floats_reserve{#1}}
269 \setuevalue{\e!start\e!reserve#1\e!text}{\strc_floats_start_reserve_text{#1}}
270 \setuevalue {\e!stop\e!reserve#1\e!text}{\strc_floats_stop_reserve_text}}
271
272
273
274\unexpanded\def\strc_floats_place_empty_box
275 {\framed
276 [\c!frame=\v!on,
277 \c!width=\rootfloatparameter\c!width,
278 \c!height=\rootfloatparameter\c!height,
279 \c!location=\v!normal,
280 \c!offset=\rootfloatparameter\c!offset]
281 {\getmessage\m!floatblocks{12}\empty}}
282
283
284
285\newif\ifnofloatcaption
286\newif\ifnofloatnumber
287\newif\ifemptyfloatcaption
288
289\installstructurelistprocessor\s!float{\usestructurelistprocessor{numbertitle}}
290
291\unexpanded\def\thecurrentfloatnumbersuffix
292 {\doifsomething{\floatcaptionparameter\c!suffix}
293 {\floatcaptionparameter\c!suffixseparator
294 \floatcaptionparameter\c!suffix
295 \floatcaptionparameter\c!suffixstopper}}
296
297\unexpanded\def\thecurrentfloatnumber
298 {\ifnofloatcaption \else \ifnofloatnumber \else
299 \ifx\currentfloatnumber\relax\else
300 \namedtaggedlabeltexts
301 \t!floatlabel \currentfloat
302 \t!floatnumber\currentfloat
303 {\begstrut
304 \floatcaptionparameter\c!numbercommand
305 {\clf_savedlistprefixednumber{\currentfloat}\currentfloatnumber\relax
306 \thecurrentfloatnumbersuffix}
307 \endstrut}
308 \fi
309 \fi \fi}
310
311\unexpanded\def\thecurrentfloatcaption
312 {\ifnofloatcaption \else \ifemptyfloatcaption \else
313 \ifx\currentfloatnumber\relax\else
314 \dostarttagged\t!floattext\empty
315 \begstrut
316 \floatcaptionparameter\c!textcommand
317 {\clf_savedlisttitle{\currentfloat}\numexpr\currentfloatnumber\relax}
318 \endstrut
319 \dostoptagged
320 \fi
321 \fi \fi}
322
323
324
325\let\floatcaptionsuffix\empty
326\let\floatcaptionnumber\empty
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361\unexpanded\def\placefloatcaption
362 {\dotripleempty\strc_floats_place_caption}
363
364\def\strc_floats_place_caption[#category][#settings][#userdata]
365 {\ifsecondargument
366
367 \dontleavehmode
368 \bgroup
369 \edef\currentfloat{#category}
370 \let\currentfloatcaption\currentfloat
371 \resetfloatcaptionparameter\c!reference
372 \resetfloatcaptionparameter\c!title
373 \resetfloatcaptionparameter\c!marking
374 \resetfloatcaptionparameter\c!list
375 \resetfloatcaptionparameter\c!bookmark
376 \setupcurrentfloatcaption[#settings]
377 \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}
378 \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
379 \strc_counters_increment\currentfloatcounter
380 \strc_counters_register_component
381 \s!float
382 \setupcurrentfloatcaption
383 \floatcaptionparameter
384 \detokenizedfloatcaptionparameter
385 \relax
386 \relax
387 \relax
388 [\s!name=\currentfloat,
389 \s!counter=\currentfloatcounter,
390 \s!hascaption=\v!yes,
391 \s!hasnumber=\v!yes,
392 \s!hastitle=\v!yes]
393 [#userdata]
394 \glet\previousfloatnumber \m_strc_counters_last_registered_index
395 \glet\currentfloatnumber \m_strc_counters_last_registered_index
396 \glet\currentfloatattribute \m_strc_counters_last_registered_attribute
397 \glet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize
398
399
400
401
402 \currentfloatsynchronize
403 \strc_floats_make_complete_caption
404
405 \iftrialtypesetting\strc_counters_restore\currentfloatcounter\fi
406 \egroup
407 \fi}
408
409\newbox \b_strc_floats_caption
410\newbox \b_strc_floats_content
411\newdimen\d_strc_floats_caption_height
412\newdimen\d_strc_floats_caption_depth
413
414\def\strc_floats_make_complete_caption
415 {\doifsomething{\floatcaptionparameter\c!spacebefore}{\blank[\floatcaptionparameter\c!spacebefore]}
416 \strc_floats_make_complete_caption_before
417 \synchronizedisplaydirection
418 \noindent
419 \gdef\lastcaptiontag{\strut\thecurrentfloatnumber}
420 \begingroup
421 \ifnofloatcaption
422 \global\d_strc_floats_caption_height\zeropoint
423 \global\d_strc_floats_caption_depth \zeropoint
424 \else
425 \usefloatcaptionstyleandcolor\c!style\c!color
426 \clf_doifelselisthastitle{\currentfloat}\numexpr\currentfloatnumber\relax
427 \donothing
428 \emptyfloatcaptiontrue
429 \ifnofloatnumber \else \ifnofloatcaption \else
430 \ifemptyfloatcaption
431 \hbox{\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor\thecurrentfloatnumber}
432 \else
433 \doifelsenothing{\floatcaptionparameter\c!spaceinbetween}
434 {\scratchskip\floatcaptionparameter\c!distance\relax
435 \setbox\scratchbox\hbox
436 {\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor
437 \thecurrentfloatnumber
438 \floatcaptionparameter\c!headseparator
439 \dotfskip\scratchskip}
440 \doifelse{\floatcaptionparameter\c!hang}\v!yes
441 {\leftskip\wd\scratchbox
442 \llap{\box\scratchbox}}
443 {\unhbox\scratchbox}
444 \emergencystretch.5\scratchskip}
445 {\hbox{\usefloatcaptionstyleandcolor\c!headstyle\c!headcolor\thecurrentfloatnumber}
446 \blank[\floatcaptionparameter\c!spaceinbetween]}
447 \fi
448 \fi \fi
449 \usefloatcaptionstyleandcolor\c!textstyle\c!textcolor
450 \global\d_strc_floats_caption_height\strutheight
451 \global\d_strc_floats_caption_depth \strutdepth
452 \thecurrentfloatcaption\endgraf
453 \fi
454 \endgroup
455 \strc_floats_make_complete_caption_after
456 \doifsomething{\floatcaptionparameter\c!spaceafter}{\blank[\floatcaptionparameter\c!spaceafter]}}
457
458
459\let\strc_floats_make_complete_caption_after \relax
460
461\def\strc_floats_make_complete_caption_before
462 {\doifelseframed\floatcaptionparameter\strc_floats_make_complete_caption_before_indeed\relax}
463
464\def\strc_floats_make_complete_caption_before_indeed
465 {\edef\m_strc_align{\floatcaptionparameter\c!align}
466 \edef\m_strc_strut{\floatcaptionparameter\c!strut}
467 \letfloatcaptionparameter\c!align\v!normal
468 \letfloatcaptionparameter\c!strut\v!no
469 \inheritedfloatcaptionframed
470 \bgroup
471 \letfloatcaptionparameter\c!align\m_strc_align
472 \letfloatcaptionparameter\c!strut\m_strc_strut
473 \let\strc_floats_make_complete_caption_after\egroup}
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500\def\strc_floats_check_caption_content
501 {\ifnofloatcaption
502 \else
503 \setbox\b_strc_floats_caption\hbox
504 {\settrialtypesetting
505 \notesenabledfalse
506 \strc_floats_make_complete_caption}
507
508
509
510 \ifzeropt\wd\b_strc_floats_caption
511 \global\emptyfloatcaptiontrue
512 \ifnofloatnumber
513 \global\nofloatcaptiontrue
514 \fi
515 \else
516 \global\emptyfloatcaptionfalse
517 \setbox\b_strc_floats_caption\hpack{\hskip\leftskip\box\b_strc_floats_caption}
518 \fi
519 \fi}
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543\definepagestate[\s!float][\c!delay=\v!yes]
544
545\newcount\c_strc_floats_n
546
547\let\strc_float_realpage\realpageno
548
549\def\strc_float_save_data
550 {\setpagestate[\s!float][\number\c_strc_floats_n]}
551
552\def\strc_float_load_data
553 {\global\advance\c_strc_floats_n\plusone
554 \xdef\strc_float_realpage{\pagestaterealpage\s!float{\number\c_strc_floats_n}}
555 \ifx\strc_float_realpage\empty
556 \glet\strc_float_realpage\realpageno
557 \fi}
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583\let\lastplacedfloat\empty
584
585\def\strc_floats_set_current_tag#tag
586 {\edef\currentfloat{#tag}
587 \ifx\currentfloat\empty
588 \let\currentfloat\v!figure
589 \fi
590 \doifelsecommandhandler\??float\currentfloat
591 \donothing
592 {\writestatus\m!floatblocks{unknown float type \currentfloat}
593 \let\currentfloat\v!figure}
594 \glet\lastplacedfloat\currentfloat
595 \let\m_strc_floats_saved_userdata\empty
596 \let\currentfloatcaption\currentfloat}
597
598\let\askedfloatmethod \empty
599\let\askedfloatoptions\empty
600
601\def\strc_floats_reset_variables
602 {\global\emptyfloatcaptionfalse
603 \global\nofloatcaptionfalse
604 \global\nofloatnumberfalse
605 \glet\askedfloatmethod \empty
606 \glet\askedfloatoptions\empty}
607
608
609
610\let\floatlabel \empty
611\let\floatcolumn \empty
612\let\floatrow \empty
613\let\floatlocation \empty
614\let\floatlocationmethod\empty
615
616\def\strc_floats_analyze_location
617 {
618 \let\floatlabel \empty
619 \let\floatcolumn\empty
620 \let\floatrow \empty
621
622 \edef\floatcaptionlocation{\floatcaptionparameter\c!location}
623
624 \setfloatmethodvariables\floatlocation}
625
626\unexpanded\def\strc_floats_place#tag
627 {\flushnotes
628 \page_otr_command_flush_side_floats
629 \strc_floats_begin_group
630 \strc_floats_set_current_tag{#tag}
631 \dodoubleempty\strc_floats_place_indeed}
632
633\newtoks\c_floats_every_table_float
634
635\appendtoks
636 \edef\floatlocation{\v!force,\v!always,\floatlocation}
637 \setupfloat[\c!spacebefore=\v!none,\c!spaceafter=\v!none]
638\to \c_floats_every_table_float
639
640\ifdefined\dotagregisterfloat \else \let\dotagregisterfloat\gobbletwoarguments \fi
641
642\def\strc_floats_place_indeed[#location][#reference]#caption
643 {\strc_floats_reset_variables
644 \xdef\askedfloatoptions{#location}
645 \edef\floatlocation{#location}
646 \ifx\floatlocation\empty
647 \edef\floatlocation{\floatparameter\c!default}
648 \fi
649 \ifintable
650 \the\c_floats_every_table_float
651 \fi
652 \strc_floats_analyze_location
653
654 \setupcurrentfloatcaption[\c!reference={#reference},\c!title={#caption},\c!marking=,\c!list=,\c!bookmark=]
655 \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal}
656
657\unexpanded\def\placefloat
658 {\flushnotes
659 \page_otr_command_flush_side_floats
660 \strc_floats_begin_group
661 \dotripleempty\strc_floats_place_float}
662
663\def\strc_floats_place_float[#tag]
664 {\strc_floats_set_current_tag{#tag}
665 \strc_floats_place_indeed}
666
667
668
669
670
671
672
673\installcorenamespace{floatuserdata}
674
675\installsetuponlycommandhandler \??floatuserdata {floatuserdata}
676
677\let\m_strc_floats_saved_userdata\empty
678
679\unexpanded\def\strc_floats_start_place#tag
680 {\flushnotes
681 \page_otr_command_flush_side_floats
682 \strc_floats_begin_group
683 \strc_floats_set_current_tag{#tag}
684 \dodoubleempty\strc_floats_start_place_indeed}
685
686
687
688
689\def\strc_floats_start_place_indeed[#settings][#userdata]
690 {\strc_floats_reset_variables
691
692 \edef\m_location {\floatcaptionparameter\c!location}
693 \edef\m_topoffset {\floatcaptionparameter\c!topoffset}
694 \edef\m_bottomoffset{\floatcaptionparameter\c!bottomoffset}
695 \edef\m_freeregion {\floatcaptionparameter\c!freeregion}
696
697 \letfloatcaptionparameter \c!location \empty
698 \setexpandedfloatcaptionparameter\c!topoffset {\floatparameter\c!topoffset}
699 \setexpandedfloatcaptionparameter\c!bottomoffset{\floatparameter\c!bottomoffset}
700 \setexpandedfloatcaptionparameter\c!freeregion {\floatparameter\c!freeregion}
701 \letfloatcaptionparameter \c!reference \empty
702 \letfloatcaptionparameter \c!title \empty
703 \letfloatcaptionparameter \c!marking \empty
704 \letfloatcaptionparameter \c!list \empty
705 \letfloatcaptionparameter \c!bookmark \empty
706
707 \setupcurrentfloatcaption[#settings]
708 \ifsecondargument
709 \setupcurrentfloatuserdata[#userdata]
710 \def\m_strc_floats_saved_userdata{#userdata}
711 \else
712 \let\m_strc_floats_saved_userdata\empty
713 \fi
714
715 \edef\floatlocation{\floatcaptionparameter\c!location}
716 \ifx\floatlocation\empty
717 \edef\floatlocation{\floatparameter\c!default}
718 \fi
719
720 \setexpandedfloatparameter\c!topoffset {\floatcaptionparameter\c!topoffset}
721 \setexpandedfloatparameter\c!bottomoffset{\floatcaptionparameter\c!bottomoffset}
722 \setexpandedfloatparameter\c!freeregion {\floatcaptionparameter\c!freeregion}
723
724 \letfloatcaptionparameter\c!location \m_location
725 \letfloatcaptionparameter\c!topoffset \m_topoffset
726 \letfloatcaptionparameter\c!bottomoffset\m_bottomoffset
727 \letfloatcaptionparameter\c!freeregion \m_freeregion
728
729 \strc_floats_analyze_location
730 \doifelseinset\v!split\floatlocation\strc_floats_place_next_box_split\strc_floats_place_next_box_normal
731 \bgroup
732 \ignorespaces}
733
734\unexpanded\def\strc_floats_stop_place
735 {\removeunwantedspaces
736 \egroup}
737
738\unexpanded\def\startplacefloat
739 {\flushnotes
740 \page_otr_command_flush_side_floats
741 \strc_floats_begin_group
742 \dotripleempty\strc_floats_start_place_float}
743
744\def\strc_floats_start_place_float[#tag]
745 {\strc_floats_set_current_tag{#tag}
746 \strc_floats_start_place_indeed}
747
748\let\stopplacefloat\strc_floats_stop_place
749
750
751
752\unexpanded\def\strc_floats_reserve#tag
753 {\flushnotes
754 \page_otr_command_flush_side_floats
755 \strc_floats_begin_group
756 \strc_floats_set_current_tag{#tag}
757 \dotripleempty\strc_floats_reserve_indeed}
758
759\def\strc_floats_reserve_indeed[#settings][#location][#reference]#caption
760 {\strc_floats_place_indeed[#location][#reference]{#caption}{\strc_floats_reserve_box{#settings}}}
761
762\def\strc_floats_reserve_box#settings
763 {\begingroup
764 \setupcurrentfloat[\c!frame=\v!on,#settings]
765 \inheritedfloatframed{}
766 \endgroup}
767
768
769
770\unexpanded\def\strc_floats_start_text#tag
771 {\flushnotes
772 \page_otr_command_flush_side_floats
773 \strc_floats_begin_text_group
774 \strc_floats_set_current_tag{#tag}
775 \dodoubleempty\strc_floats_start_text_indeed}
776
777\def\strc_floats_start_text_indeed[#location][#reference]
778 {\strc_floats_place_indeed[\v!text,#location,\v!left][#reference]}
779
780\unexpanded\def\strc_floats_stop_text
781 {\strc_floats_stop_text_indeed}
782
783
784
785\unexpanded\def\strc_floats_start_reserve_text#tag
786 {\flushnotes
787 \page_otr_command_flush_side_floats
788 \strc_floats_begin_text_group
789 \strc_floats_set_current_tag{#tag}
790 \dotripleempty\strc_floats_start_reserve_text_indeed}
791
792\def\strc_floats_start_reserve_text_indeed[#settings][#location][#reference]#caption
793 {\strc_floats_place_indeed[\v!text,#location,\v!left][#reference]{#caption}{\strc_floats_reserve_box{#settings}}}
794
795\unexpanded\def\strc_floats_stop_reserve_text
796 {\strc_floats_stop_text_indeed}
797
798
799
800\def\strc_floats_begin_group {\begingroup}
801\def\strc_floats_end_group {\carryoverpar\endgroup}
802\def\strc_floats_end_split_group {\endgroup}
803\def\strc_floats_begin_text_group{\begingroup\let\strc_floats_end_group\relax}
804\def\strc_floats_end_text_group {\endgroup}
805
806
807
808
809\setnewconstant\c_strc_floats_rotation \zerocount
810\newconditional\c_strc_floats_par_float
811
812\ifdefined\page_margin_strc_floats_before \else \let\page_margin_strc_floats_before \relax \fi
813\ifdefined\page_margin_strc_floats_set_hsize \else \let\page_margin_strc_floats_set_hsize\relax \fi
814
815\def\flushfloatslist
816 {\v!left,\v!right,\v!inner,\v!outer,
817 \v!backspace,\v!cutspace,
818 \v!inleft,\v!inright,\v!inmargin,
819 \v!leftmargin,\v!rightmargin,\v!leftedge,\v!rightedge,
820 \v!innermargin,\v!outermargin,\v!inneredge,\v!outeredge,
821 \v!text,\v!opposite}
822
823\unexpanded\def\strc_floats_place_next_box_split
824 {\let\splitfloatfinalizer\strc_floats_end_split_group
825 \let\strc_floats_end_group\relax
826 \splitfloat{\strc_floats_place_next_box_normal}}
827
828\unexpanded\def\strc_floats_place_next_box_normal
829 {\ifconditional\c_page_floats_some_waiting
830
831 \doifelseinset\v!always\floatlocation
832 {\showmessage\m!floatblocks5\empty}
833 {\doifelsecommon\floatlocation\flushfloatslist\page_otr_command_flush_floats\donothing}
834
835 \fi
836 \page_margin_strc_floats_before
837 \global\insidefloattrue
838 \dostarttaggedchained\t!float\currentfloat\??float
839 \page_margin_strc_floats_set_hsize
840 \the\everyinsidefloat
841 \strc_floats_analyze_variables_one
842 \dostarttagged\t!floatcontent\empty
843 \dowithnextboxcontent
844 {\strc_floats_set_local_hsize
845 \floatparameter\c!inner
846 \postponenotes}
847 {\page_postprocessors_linenumbers_box\nextbox
848 \dostoptagged
849 \strc_floats_finish_placement}
850 \vbox}
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879\def\strc_floats_finish_placement
880 {\doifsomething{\floatparameter\c!criterium}
881 {\ifdim\wd\nextbox>\floatparameter\c!criterium\relax
882 \edef\forcedfloatmethod{\floatparameter\c!fallback}
883 \ifx\forcedfloatmethod\empty \else
884 \doifelsecommandhandler\??float\forcedfloatmethod
885 {\let\currentfloat\forcedfloatmethod
886 \edef\floatlocation{\floatparameter\c!default}
887 \let\forcedfloatmethod\floatlocation}
888 \donothing
889 \fi
890 \ifx\forcedfloatmethod\empty
891 \let\forcedfloatmethod\v!here
892 \fi
893 \fi}
894 \strc_floats_check_extra_actions
895 \strc_floats_analyze_variables_two
896 \strc_floats_place_packaged_boxes
897 \dotagregisterfloat\askedfloatoptions\askedfloatmethod
898 \dostoptagged
899
900 \global\d_page_sides_downshift \zeropoint
901 \global\d_page_sides_extrashift\zeropoint
902 \ifconditional\c_strc_floats_par_float
903 \doifinset\v!reset\floatlocation\page_sides_forget_floats
904 \doinhibitblank
905 \fi
906 \strc_floats_end_group}
907
908
909
910\newdimen\d_strc_floats_top
911\newdimen\d_strc_floats_bottom
912\newdimen\d_strc_floats_overflow
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927\def\strc_floats_calculate_skip#target#skip
928 {\begingroup
929 \edef\p_blank{\rootfloatparameter#skip}
930 \ifx\p_blank\v!nowhite
931 \edef\p_blank{\v!white}
932 \fi
933 \prerollblank[\p_blank]
934 \global#target\prerolledblank
935 \endgroup}
936
937\def\strc_floats_analyze_variables_two
938 {\ifinsidecolumns
939 \global\setfalse\c_strc_floats_par_float
940 \else
941 \doifelsecommon\floatlocation\flushfloatslist
942 {\global\settrue \c_strc_floats_par_float}
943 {\global\setfalse\c_strc_floats_par_float}
944 \fi
945
946 \global\d_page_sides_shift \zeropoint
947 \global\d_page_sides_maximum \zeropoint
948 \global\c_page_sides_align \zerocount
949 \global\c_page_sides_tolerance \zerocount
950 \global\c_page_sides_skipmode \zerocount
951 \global\c_strc_floats_rotation \zerocount
952 \global\d_page_sides_margin \floatparameter\c!margin
953 \global\d_page_sides_leftshift \floatparameter\c!leftmargindistance
954 \global\d_page_sides_rightshift \floatparameter\c!rightmargindistance
955 \global\d_page_sides_topoffset \floatparameter\c!topoffset
956 \global\d_page_sides_bottomoffset\floatparameter\c!bottomoffset
957 \global\c_page_sides_method \floatparameter\c!sidemethod
958 \global\c_page_one_float_method \floatparameter\c!textmethod
959 \global\c_page_floats_n_of_top \rootfloatparameter\c!ntop
960 \global\c_page_floats_n_of_bottom\rootfloatparameter\c!nbottom
961 \global\d_strc_floats_overflow \zeropoint
962 \ifconditional\c_strc_floats_par_float
963 \global\d_strc_floats_top \zeropoint
964 \global\d_strc_floats_bottom \zeropoint
965 \strc_floats_calculate_skip\d_page_sides_topskip \c!sidespacebefore
966 \strc_floats_calculate_skip\d_page_sides_bottomskip\c!sidespaceafter
967 \strc_floats_calculate_skip\d_page_sides_midskip \c!sidespaceinbetween
968 \strc_floats_calculate_skip\d_strc_floats_top \c!spacebeforeside
969 \strc_floats_calculate_skip\d_strc_floats_bottom \c!spaceafterside
970 \else
971 \global\d_page_sides_topskip \zeropoint
972 \global\d_page_sides_bottomskip \zeropoint
973 \strc_floats_calculate_skip\d_strc_floats_top \c!spacebefore
974 \strc_floats_calculate_skip\d_strc_floats_bottom\c!spaceafter
975 \fi
976
977 \ifconditional\c_strc_floats_par_float
978 \processaction
979 [\floatparameter\c!sidealign]
980 [\v!height=>\global\c_page_sides_align\plusone ,
981 \v!line=>\global\c_page_sides_align\plustwo ,
982 \v!depth=>\global\c_page_sides_align\plusthree,
983 \v!grid=>\global\c_page_sides_align\plusfour ,
984 \v!halfline=>\global\c_page_sides_align\plusfive ]
985 \ifcase\c_page_sides_align\relax
986 \doifinset\v!height \floatlocation{\global\c_page_sides_align\plusone }
987 \doifinset\v!line \floatlocation{\global\c_page_sides_align\plustwo }
988 \doifinset\v!depth \floatlocation{\global\c_page_sides_align\plusthree}
989 \doifinset\v!grid \floatlocation{\global\c_page_sides_align\plusfour }
990 \doifinset\v!halfline\floatlocation{\global\c_page_sides_align\plusfive }
991 \fi
992 \doifinset\v!high \floatlocation{\global\c_page_sides_skipmode \plusone }
993 \doifinset\v!low \floatlocation{\global\c_page_sides_skipmode \plustwo }
994 \doifinset\v!fit \floatlocation{\global\c_page_sides_skipmode \plusthree}
995 \doifinset\v!tolerant \floatlocation{\global\c_page_sides_tolerance\plusone }
996 \doifinset\v!verytolerant\floatlocation{\global\c_page_sides_tolerance\plustwo }
997 \else
998 \processallactionsinset
999 [\floatlocation]
1000 [ 90=>\global\c_strc_floats_rotation\commalistelement\relax,
1001 180=>\global\c_strc_floats_rotation\commalistelement\relax,
1002 270=>\global\c_strc_floats_rotation\commalistelement\relax]
1003 \fi
1004 \doifelseinset\v!nonumber\floatlocation
1005 {\global\nofloatnumbertrue}
1006 {\doifelse{\floatcaptionparameter\c!number}\v!yes
1007 {\global\nofloatnumberfalse}
1008 {\global\nofloatnumbertrue}}
1009 \doifelseinset\v!none\floatlocation
1010 {\global\nofloatcaptiontrue}
1011 {\global\nofloatcaptionfalse}
1012 \doif{\floatcaptionparameter\c!number}\v!none
1013 {\global\nofloatcaptiontrue}
1014 \doifinset\v!effective\floatlocation
1015 {\letfloatparameter \c!leftmargin \effectiveleftskip
1016 \letfloatparameter \c!rightmargin\effectiverightskip
1017 \letfloatcaptionparameter\c!leftmargin \effectiveleftskip
1018 \letfloatcaptionparameter\c!rightmargin\effectiverightskip}
1019 \ifemptyfloatcaption \ifnofloatnumber
1020 \global\nofloatcaptiontrue
1021 \fi \fi}
1022
1023
1024
1025\def\strc_floats_analyze_variables_one
1026 {\doifelse{\floatparameter\c!local}\v!yes\settrue\setfalse\c_page_floats_center_box_global
1027 \ifconditional\c_page_floats_center_box_global
1028 \settrue\c_page_floats_center_box_local
1029 \else
1030 \doifelseinset\v!local\floatlocation\settrue\setfalse\c_page_floats_center_box_local
1031 \fi
1032 \doifelse{\floatparameter\c!freeregion}\v!yes
1033 \settrue\setfalse\c_strc_floats_mark_as_free
1034 \doifnotcommon{\v!always,\v!here,\v!force}\floatlocation
1035 {\setfalse\c_page_floats_center_box_global
1036 \setfalse\c_page_floats_center_box_local}}
1037
1038\def\naturalfloatheight{\the\naturalfloatwd}
1039\def\naturalfloatwidth {\the\naturalfloatht}
1040\def\naturalfloatdepth {\the\naturalfloatdp}
1041
1042\def\floatcaptionheight{\the\floatcaptionwd}
1043\def\floatcaptionwidth {\the\floatcaptionht}
1044\def\floatcaptiondepth {\the\floatcaptiondp}
1045
1046\newdimen\naturalfloatwd
1047\newdimen\naturalfloatht
1048\newdimen\naturalfloatdp
1049
1050\newdimen\floatcaptionwd
1051\newdimen\floatcaptionht
1052\newdimen\floatcaptiondp
1053
1054\def\strc_floats_set_natural_dimensions#box
1055 {\global\naturalfloatwd\wd#box\relax
1056 \global\naturalfloatht\ht#box\relax
1057 \global\naturalfloatdp\dp#box\relax}
1058
1059\def\strc_floats_set_caption_dimensions#box
1060 {\global\floatcaptionwd\wd#box\relax
1061 \global\floatcaptionht\ht#box\relax
1062 \global\floatcaptiondp\dp#box\relax}
1063
1064\def\doifelsemainfloatbody
1065 {\ifinsidesplitfloat
1066 \ifconditional\splitfloatfirstdone
1067 \doubleexpandafter\secondoftwoarguments
1068 \else
1069 \doubleexpandafter\firstoftwoarguments
1070 \fi
1071 \else
1072 \expandafter\firstoftwoarguments
1073 \fi}
1074
1075\let\doifmainfloatbodyelse\doifelsemainfloatbody
1076
1077
1078
1079\let\currentfloatattribute\empty
1080
1081\def\floatcaptionattribute
1082 {\iflocation
1083 \ifx\currentfloatattribute\empty
1084
1085 \else
1086 \ifnofloatcaption
1087 \else
1088 \ifinsidesplitfloat
1089 \ifconditional\splitfloatfirstdone
1090 \else
1091 attr \destinationattribute \currentfloatattribute
1092 \fi
1093 \else
1094 attr \destinationattribute \currentfloatattribute
1095 \fi
1096 \fi
1097 \fi
1098 \fi}
1099
1100\newconditional\usesamefloatnumber
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111\def\strc_floats_group_index
1112 {\numexpr\clf_listgroupindex{\currentfloat}{\currentfloatgroup}\relax}
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128\glet\currentsubfloatcounter\empty
1129
1130\unexpanded\def\startsubfloatnumbering
1131 {\glet\currentsubfloatcounter\s!unknown}
1132
1133\unexpanded\def\stopsubfloatnumbering
1134 {\strc_counters_reset_sub\currentsubfloatcounter\plustwo
1135 \glet\currentsubfloatcounter\empty}
1136
1137\defineconversionset[subfloats][number,characters]
1138
1139\setupcaptions
1140
1141 [\c!numberconversionset=subfloats]
1142
1143\def\strc_floats_place_packaged_boxes
1144 {\expandafter\strc_floats_place_packaged_boxes_indeed\expandafter{\m_strc_floats_saved_userdata}}
1145
1146\def\strc_floats_place_packaged_boxes_indeed#userdata
1147 {\bgroup
1148 \ifconditional\usesamefloatnumber
1149 \glet\currentfloatnumber \previousfloatnumber
1150 \glet\currentfloatattribute \empty
1151 \glet\currentfloatsynchronize\relax
1152 \else
1153 \edef\currentfloatcounter{\namedcounterparameter\currentfloat\s!name}
1154 \edef\currentfloatgroup {\floatcaptionparameter\c!group}
1155 \ifnofloatnumber \else \ifnofloatcaption \else
1156 \ifx\currentfloatgroup\empty
1157
1158 \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
1159 \ifx\empty\currentsubfloatcounter
1160 \strc_counters_increment\currentfloatcounter
1161 \strc_counters_reset_sub\currentfloatcounter\plustwo
1162 \else
1163 \ifcase\strc_counters_raw_sub\currentfloatcounter\plustwo\relax
1164 \strc_counters_increment\currentfloatcounter
1165 \strc_counters_reset_sub\currentfloatcounter\plustwo
1166 \fi
1167 \strc_counters_increment_sub\currentfloatcounter\plustwo
1168 \glet\currentsubfloatcounter\currentfloatcounter
1169 \fi
1170 \else\ifcase\strc_floats_group_index
1171
1172 \iftrialtypesetting\strc_counters_save\currentfloatcounter\fi
1173 \strc_counters_increment\currentfloatcounter
1174 \else
1175
1176 \fi \fi
1177 \fi \fi
1178
1179 \strc_counters_register_component
1180 \s!float
1181 \setupcurrentfloatcaption
1182 \floatcaptionparameter
1183 \detokenizedfloatcaptionparameter
1184 \relax
1185 \relax
1186 \relax
1187 [\s!name=\currentfloat,
1188 \s!counter=\currentfloatcounter,
1189 \s!hascaption=\ifnofloatcaption \v!no\else\v!yes\fi,
1190 \s!hasnumber=\ifnofloatnumber \v!no\else\v!yes\fi,
1191 \s!hastitle=\ifemptyfloatcaption\v!no\else\v!yes\fi]
1192 [#userdata]
1193 \glet\previousfloatnumber \m_strc_counters_last_registered_index
1194 \glet\currentfloatnumber \m_strc_counters_last_registered_index
1195 \glet\currentfloatattribute \m_strc_counters_last_registered_attribute
1196 \glet\currentfloatsynchronize\m_strc_counters_last_registered_synchronize
1197 \fi
1198
1199 \iftrialtypesetting\else\global\setfalse\usesamefloatnumber\fi
1200
1201 \strc_floats_set_natural_dimensions\nextbox
1202 \global\setbox\floatbox\vbox{\floatparameter\c!command{\box\nextbox}}
1203 \strc_floats_set_natural_dimensions\floatbox
1204 \ifzeropt\htdp\floatbox
1205 \showmessage\m!floatblocks{11}\empty
1206 \global\setbox\floatbox\vpack
1207 {\dostarttagged\t!floatcontent\empty
1208 \strc_floats_place_empty_box
1209 \dostoptagged}
1210 \fi
1211
1212 \global\setbox\floatbox\vpack \floatcaptionattribute
1213 {\doifelsemainfloatbody\currentfloatsynchronize\donothing
1214 \unvbox\floatbox
1215 \ifnofloatcaption
1216 \vss
1217 \fi}
1218 \iftrialtypesetting\strc_counters_restore\currentfloatcounter\fi
1219 \egroup
1220
1221 \strc_floats_set_box
1222 \strc_floats_get_box
1223 \global\insidefloatfalse}
1224
1225
1226\newdimen\availablefloatwidth
1227\newdimen\availablefloatheight
1228
1229\def\strc_floats_set_local_hsize
1230 {\ifconditional\c_page_floats_center_box_local
1231
1232 \seteffectivehsize
1233 \hsize\localhsize
1234 \else
1235 \doifinset\v!margin\floatlocation
1236 {\hsize\namedmarginblockparameter\empty\c!width}
1237 \fi
1238 \edef\p_availablewidth {\floatparameter\c!availablewidth }
1239 \edef\p_availableheight{\floatparameter\c!availableheight}
1240 \availablefloatwidth \ifx\p_availablewidth \empty\hsize\else\p_availablewidth \relax\fi
1241 \availablefloatheight\ifx\p_availableheight\empty\vsize\else\p_availableheight\relax\fi}
1242
1243\ifdefined\everyinsidefloat \else \newevery \everyinsidefloat \relax \fi
1244
1245\appendtoks
1246 \everyinsidefloat\emptytoks
1247 \strc_float_load_data
1248\to \everyinsidefloat
1249
1250\def\doifelserightpagefloat
1251 {\ifdoublesided
1252 \ifsinglesided
1253 \doubleexpandafter\firstoftwoarguments
1254 \else
1255 \doubleexpandafter\doifelseoddpagefloat
1256 \fi
1257 \else
1258 \expandafter\firstoftwoarguments
1259 \fi}
1260
1261\def\doifelseoddpagefloat
1262 {\ifodd\purenumber\strc_float_realpage\space
1263 \expandafter\firstoftwoarguments
1264 \else
1265 \expandafter\secondoftwoarguments
1266 \fi}
1267
1268\let\doifrightpagefloatelse\doifelserightpagefloat
1269\let\doifoddpagefloatelse \doifelseoddpagefloat
1270
1271\appendtoks
1272 \overloaded\frozen\let\rightorleftpageaction\doifelserightpagefloat
1273\to \everyinsidefloat
1274
1275
1276
1277
1278
1279
1280\unexpanded\def\movesidefloat[#settings]
1281 {\global\d_page_sides_downshift \zeropoint
1282 \global\d_page_sides_extrashift\zeropoint
1283 \doifelseassignment{#settings}
1284 {\begingroup
1285 \setupcurrentfloat[\c!x=\zeropoint,\c!y=\zeropoint,#settings]
1286 \ifgridsnapping
1287 \getnoflines{\floatparameter\c!y}
1288 \global\d_page_sides_downshift\noflines\lineheight
1289 \else
1290 \global\d_page_sides_downshift\floatparameter\c!y
1291 \fi
1292 \global\d_page_sides_extrashift\floatparameter\c!x
1293 \endgroup}
1294 {\movedownsidefloat[#settings]}}
1295
1296\installcorenamespace{floatmovement}
1297
1298\setvalue{\??floatmovement \v!line}{\strc_floats_move_down_line}
1299\setvalue{\??floatmovement\v!line}{\strc_floats_move_down_line}
1300\setvalue{\??floatmovement\v!line}{\strc_floats_move_down_line}
1301\setvalue{\??floatmovement \v!hang}{\strc_floats_move_down_hang\plusone}
1302\setvalue{\??floatmovement\v!hang}{\strc_floats_move_down_hang\plusone}
1303\setvalue{\??floatmovement\v!hang}{\strc_floats_move_down_hang\minusone}
1304
1305\setvalue{\??floatmovement2*\v!line}{\strc_floats_move_down_line{2}}
1306\setvalue{\??floatmovement2*\v!line}{\strc_floats_move_down_line{2}}
1307\setvalue{\??floatmovement 2*\v!line}{\strc_floats_move_down_line{2}}
1308
1309\unexpanded\def\installfloatmovement#1#2{\setvalue{\??floatmovement#1}{#2}}
1310
1311\def\strc_floats_move_down#setting
1312 {\begincsname\??floatmovement#setting\endcsname}
1313
1314\def\strc_floats_move_down_line#sign
1315 {\if!!donea \else
1316 \global\d_page_sides_downshift\zeropoint
1317 \!!doneatrue
1318 \fi
1319 \global\advance\d_page_sides_downshift#sign\lineheight}
1320
1321\def\strc_floats_move_down_hang#lines
1322 {\if!!doneb \else
1323 \global\c_page_sides_n_of_lines\zerocount
1324 \!!donebtrue
1325 \fi
1326 \global\advance\c_page_sides_n_of_lines#lines\relax}
1327
1328\unexpanded\def\movedownsidefloat[#settings]
1329 {\doifnotinstring{:}{#settings}
1330 {\begingroup
1331 \!!doneafalse
1332 \!!donebfalse
1333 \normalexpanded{\dorepeatwithcommand[#settings]}\strc_floats_move_down
1334 \endgroup}}
1335
1336\unexpanded\def\hangsidefloat[#number]
1337 {\global\c_page_sides_n_of_lines#number\relax}
1338
1339\def\strc_floats_set_extra_action#rightpagelocation#leftpagelocation
1340 {\rightorleftpageaction
1341 {\let\extrafloatlocation#rightpagelocation}
1342 {\let\extrafloatlocation#leftpagelocation}}
1343
1344\let\extrafloatlocation\empty
1345
1346\installcorenamespace{extrafloataction}
1347
1348\setvalue{\??extrafloataction \v!inner}#1{\strc_floats_set_extra_action\v!left \v!right}
1349\setvalue{\??extrafloataction \v!outer}#1{\strc_floats_set_extra_action\v!right \v!left}
1350\setvalue{\??extrafloataction\v!innermargin}#1{\strc_floats_set_extra_action\v!leftmargin \v!rightmargin}
1351\setvalue{\??extrafloataction\v!outermargin}#1{\strc_floats_set_extra_action\v!rightmargin\v!leftmargin}
1352\setvalue{\??extrafloataction \v!inneredge}#1{\strc_floats_set_extra_action\v!leftedge \v!rightedge}
1353\setvalue{\??extrafloataction \v!outeredge}#1{\strc_floats_set_extra_action\v!rightedge \v!leftedge}
1354\setvalue{\??extrafloataction \v!backspace}#1{\strc_floats_set_extra_action\v!backspace \v!cutspace}
1355\setvalue{\??extrafloataction \v!cutspace}#1{\strc_floats_set_extra_action\v!cutspace \v!backspace}
1356
1357\setvalue{\??extrafloataction \v!left}#1{\strc_floats_set_extra_action\v!left \v!left}
1358\setvalue{\??extrafloataction \v!right}#1{\strc_floats_set_extra_action\v!right \v!right}
1359\setvalue{\??extrafloataction \v!line}#1{}
1360\setvalue{\??extrafloataction \s!unknown}#1{\movedownsidefloat[#1]}
1361
1362\def\strc_floats_check_extra_actions
1363 {\doifnotinset\v!text\floatlocation
1364 {\let\extrafloatlocation\empty
1365
1366
1367 \processcommacommand[\floatlocation]\strc_floats_check_extra_actions_step
1368 \ifx\extrafloatlocation\empty \else
1369 \edef\floatlocation{\extrafloatlocation,\floatlocation}
1370 \setfloatmethodvariables\floatlocation
1371 \fi}}
1372
1373\def\strc_floats_check_extra_actions_step#step
1374 {\csname\??extrafloataction
1375 \ifcsname\??extrafloataction#step\endcsname#step\else\s!unknown\fi
1376 \endcsname{#step}}
1377
1378
1379
1380\def\strc_floats_set_local_dimensions
1381 {\global\d_page_sides_shift \zeropoint
1382 \global\d_page_sides_maximum\zeropoint\relax
1383 \ifzeropt\d_page_sides_downshift\else
1384 \global\setbox\floatbox\vpack
1385 {\vskip\d_page_sides_downshift
1386 \nointerlineskip
1387 \box\floatbox}
1388 \fi
1389 \edef\p_minwidth{\floatparameter\c!minwidth}
1390 \ifx\p_minwidth\empty
1391
1392 \else
1393 \scratchwidth\p_minwidth\relax
1394 \ifdim\wd\floatbox<\scratchwidth
1395 \strc_floats_realign_floatbox_horizontal_two
1396 \fi
1397 \fi
1398
1399 \doifelseinset\v!hanging\floatlocation
1400 {\doifelsecommon{\v!inleft,\v!leftmargin}\floatlocation
1401 {\let\p_maxwidth\leftmarginwidth}
1402 {\doifelsecommon{\v!inright,\v!rightmargin}\floatlocation
1403 {\let\p_maxwidth\rightmarginwidth}
1404 {\edef\p_maxwidth{\floatparameter\c!maxwidth}}}}
1405 {\edef\p_maxwidth{\floatparameter\c!maxwidth}}
1406 \ifx\p_maxwidth\empty
1407
1408 \else
1409 \scratchwidth\p_maxwidth\relax
1410 \ifdim\wd\floatbox>\scratchwidth
1411 \doifelsecommon{\v!inright,\v!rightmargin,\v!rightedge,\v!inleft,\v!leftmargin,\v!leftedge}\floatlocation
1412 {\global\d_page_sides_maximum\scratchwidth}
1413 {\doifelsecommon{\v!right,\v!left}\floatlocation
1414 \strc_floats_realign_floatbox_horizontal_one
1415 \strc_floats_realign_floatbox_horizontal_two}
1416 \fi
1417 \fi}
1418
1419\def\strc_floats_realign_floatbox_horizontal_one
1420 {\global\setbox\floatbox\hpack to \scratchwidth
1421 {\doifnotinset\v!right\floatlocation\hss
1422 \box\floatbox
1423 \doifnotinset\v!left\floatlocation\hss}}
1424
1425\def\strc_floats_realign_floatbox_horizontal_two
1426 {\global\setbox\floatbox\hpack to \scratchwidth
1427 {\doifnot{\floatparameter\c!location}\v!left\hss
1428 \box\floatbox
1429 \doifnot{\floatparameter\c!location}\v!right\hss}}
1430
1431\unexpanded\def\placefloats
1432 {\page_otr_command_flush_floats}
1433
1434\unexpanded\def\betweenfloatblanko
1435 {\blank[\rootfloatparameter\c!spacebefore]}
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459\def\strc_floats_apply_skip#1
1460 {\edef\m_space{\rootfloatparameter#1}
1461 \ifx\m_space\empty \else\ifx\m_space\v!none \else
1462 \directvspacing\m_space
1463 \fi\fi}
1464
1465\unexpanded\def\doplacefloatbox
1466 {
1467 \whitespace
1468 \strc_floats_apply_skip\c!spacebefore
1469 \nointerlineskip
1470 \flushnotes
1471 \nointerlineskip
1472 \page_otr_command_flush_float_box
1473
1474 \strc_floats_apply_skip\c!spaceafter}
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484\def\page_one_place_float_text
1485 {
1486
1487 \global\floatwidth \wd\floatbox
1488 \global\floatheight \ht\floatbox
1489 \global\floattextwidth\dimexpr\hsize\floatwidth\rootfloatparameter\c!margin\relax
1490 \edef\floatlocation{\floatlocationmethod}
1491 \doifelseinset\v!tall\floatlocationmethod
1492 {\floattextheight\dimexpr\pagegoal\pagetotal\bigskipamount\relax
1493 \ifdim\floattextheight>\textheight
1494 \floattextheight\textheight
1495 \fi
1496 \boxmaxdepth\zeropoint\relax
1497 \ifdim\floattextheight<\floatheight
1498 \floattextheight\floatheight
1499 \fi
1500 \setbox\floattext\vbox to \floattextheight}
1501 {\setbox\floattext\vbox}
1502 \bgroup
1503 \forgetall
1504 \setupblank
1505 \setupwhitespace
1506 \blank[\v!disable]
1507 \hsize\floattextwidth
1508 \ignorespaces}
1509
1510\def\strc_floats_stop_text_indeed
1511 {\egroup
1512 \doifnotinset\v!tall\floatlocation
1513 {\floattextheight\ifdim\ht\floattext<\floatheight\floatheight\else\ht\floattext\fi}
1514 \setbox\floatbox\vpack to \floattextheight
1515 {\hsize\floatwidth
1516 \doifelseinset\v!both\floatlocation
1517 {\doifelseinset\v!low\floatlocation
1518 {\vfill\box\floatbox}
1519 {\doifelseinset\v!middle\floatlocation
1520 {\vfill\box\floatbox\vfill}
1521 {\box\floatbox\vfill}}}
1522 {\box\floatbox\vfill}}
1523 \setbox\floattext\vpack to \floattextheight
1524 {\hsize\floattextwidth
1525 \doifelseinset\v!low\floatlocation
1526 {\vfill
1527 \box\floattext
1528 \doifinset\c!offset\floatlocation{\whitespace\blank}}
1529 {\doifelseinset\v!middle\floatlocation
1530 {\vfill
1531 \box\floattext
1532 \vfill}
1533 {\doifinset\v!offset\floatlocation{\whitespace\blank}
1534 \box\floattext
1535 \vfill}}}
1536 \doifelseinset\v!right\floatlocation
1537 {\setbox\floatbox\hpack to \hsize
1538 {\box\floattext
1539 \hfill
1540 \box\floatbox}}
1541 {\setbox\floatbox\hpack to \hsize
1542 {\box\floatbox
1543 \hfill
1544 \box\floattext}}
1545 \baselinecorrection
1546 \whitespace
1547 \blank[\rootfloatparameter\c!spacebefore]
1548 \doifnotinset\v!tall\floatlocation
1549 {\dp\floatbox\openstrutdepth}
1550 \box\floatbox
1551 \dostoptagged
1552 \blank[\rootfloatparameter\c!spaceafter]
1553 \strc_floats_end_text_group
1554 \page_floats_report_total}
1555
1556\def\borderedfloatbox
1557 {\begingroup
1558 \setupcurrentfloat[\c!location=\v!normal,\c!width=\v!fit,\c!height=\v!fit]
1559 \inheritedfloatframed{\box\floatbox}
1560 \endgroup}
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594\def\strc_floats_align_indeed
1595 {\alignedline{\floatparameter\c!location}\v!middle}
1596
1597\def\strc_floats_shift_indeed#1
1598 {\shiftalignedline{#1\c!leftmargin}{#1\c!rightmargin}{#1\c!innermargin}{#1\c!outermargin}}
1599
1600\def\strc_floats_align_content_indeed
1601 {\alignstrutmode\zerocount
1602 \ifx\forcedfloatmethod\v!local \else
1603 \doifnotcommon\floatcaptionlocation{\v!outermargin,\v!innermargin,\v!leftmargin,\v!rightmargin}
1604 {\strc_floats_shift_indeed\floatparameter}
1605 \expandafter\strc_floats_align_indeed
1606 \fi}
1607
1608\def\strc_floats_align_caption_indeed
1609 {\alignstrutmode\zerocount
1610 \ifx\forcedfloatmethod\v!local
1611 \expandafter\strc_floats_align_indeed_local
1612 \else
1613 \strc_floats_shift_indeed\floatcaptionparameter
1614 \expandafter\strc_floats_align_indeed
1615 \fi}
1616
1617
1618
1619
1620
1621
1622
1623\let\strc_floats_align_indeed_local\firstofoneargument
1624
1625\newdimen\d_strc_floats_content
1626\newdimen\d_strc_float_temp_height
1627\newdimen\d_strc_float_temp_width
1628
1629\newconditional\c_floats_adapt_to_caption_width
1630\newconditional\c_floats_store_minimal_package
1631
1632\def\captionminwidth {15\bodyfontsize}
1633\def\captionovershoot{2\emwidth}
1634
1635\let\strc_floats_mark_pag_as_free\relax
1636
1637\def\strc_floats_set_page_variant
1638 {\bgroup
1639 \strc_floats_set_local_hsize
1640 \ifcase\c_strc_floats_rotation\else
1641 \swapdimens\hsize\vsize
1642 \fi
1643 \forgetall
1644 \postponenotes
1645 \dontcomplain
1646 \setbox\b_strc_floats_content\vpack{\borderedfloatbox}
1647 \let\strc_floats_align_content\strc_floats_align_content_indeed
1648 \let\strc_floats_align_caption\strc_floats_align_caption_indeed
1649 \strc_floats_check_caption_content
1650 \d_strc_floats_content\wd\b_strc_floats_content
1651 \ifcase\floatparameter\c!method
1652
1653 \or
1654
1655 \ifnofloatcaption
1656 \strc_floats_prepare_no_caption
1657 \strc_floats_set_caption_dimensions\voidbox
1658
1659 \else
1660
1661 \strc_floats_prepare_page_caption
1662
1663 \setbox\b_strc_floats_caption\hbox
1664 {\floatcaptionparameter\c!command{\box\b_strc_floats_caption}}
1665 \strc_floats_set_caption_dimensions\b_strc_floats_caption
1666
1667
1668 \strc_floats_build_box
1669 \fi
1670 \or
1671
1672 \or
1673
1674 \fi
1675 \ifconditional\c_floats_store_minimal_package
1676
1677 \else\ifcase\c_strc_floats_rotation
1678 \doifnotinset\v!margin\floatlocation
1679 {\postcenterfloatbox\d_strc_floats_content
1680 \strc_floats_mark_pag_as_free}
1681
1682 \else
1683 \global\setbox\floatbox\vpack
1684 {\rotate[\c!rotation=\number\c_strc_floats_rotation]{\box\floatbox}}
1685 \strc_floats_mark_pag_as_free
1686 \fi\fi
1687 \egroup}
1688
1689\def\strc_floats_prepare_no_caption
1690 {\global\setbox\floatbox\vpack
1691 {\ifinsidecolumns\ifdim\wd\b_strc_floats_content>\hsize
1692 \let\strc_floats_align_content\relax
1693 \fi\fi
1694 \strc_floats_align_content{\copy\b_strc_floats_content}}}
1695
1696\def\strc_floats_prepare_page_caption
1697 {\edef\p_strc_floats_caption_width {\floatcaptionparameter\c!width}
1698 \edef\p_strc_floats_caption_minwidth{\floatcaptionparameter\c!minwidth}
1699 \edef\p_strc_floats_caption_align {\floatcaptionparameter\c!align}
1700 \dostarttagged\t!floatcaption\empty
1701 \doifcommonelse\floatcaptionlocation{\v!top,\v!bottom}
1702 {\strc_floats_prepare_page_caption_top_bottom}
1703 {\ifx\p_strc_floats_caption_width\v!fit
1704 \strc_floats_prepare_side_auto_caption
1705 \else\ifx\p_strc_floats_caption_width\v!max
1706 \strc_floats_prepare_side_auto_caption
1707 \else
1708 \strc_floats_prepare_side_width_caption
1709 \fi\fi}
1710 \dostoptagged}
1711
1712\def\strc_floats_prepare_page_caption_top_bottom
1713 {\ifx\p_strc_floats_caption_width\v!fit
1714 \strc_floats_prepare_page_caption_top_bottom_fit_max
1715 \else\ifx\p_strc_floats_caption_width\v!max
1716 \strc_floats_prepare_page_caption_top_bottom_fit_max
1717 \else
1718 \strc_floats_prepare_side_width_caption
1719 \fi\fi}
1720
1721\def\strc_floats_prepare_page_caption_top_bottom_fit_max
1722 {\ifx\p_strc_floats_caption_minwidth\v!fit
1723 \ifx\p_strc_floats_caption_width\v!max
1724 \strc_floats_prepare_stack_caption_max
1725 \else\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content
1726 \ifx\p_strc_floats_caption_width\v!fit
1727 \strc_floats_prepare_stack_caption_auto
1728 \else
1729 \strc_floats_prepare_stack_caption_width
1730 \fi
1731 \else
1732 \strc_floats_prepare_stack_caption_min
1733 \fi\fi
1734 \else
1735 \strc_floats_prepare_stack_caption_fixed
1736 \fi}
1737
1738\def\strc_floats_caption_set_align
1739 {\edef\m_align{\v!reset\ifx\p_strc_floats_caption_align\empty\else,\fi\p_strc_floats_caption_align}
1740 \doifinset\v!tolerant \floatcaptionlocation{\edef\m_align{\m_align,\v!tolerant}}
1741 \doifinset\v!verytolerant\floatcaptionlocation{\edef\m_align{\m_align,\v!verytolerant}}
1742 \doifinset\v!stretch \floatcaptionlocation{\edef\m_align{\m_align,\v!stretch}}
1743 \setupalign[\m_align]}
1744
1745\def\strc_floats_prepare_side_auto_caption
1746 {\scratchdimen\dimexpr\hsize\wd\b_strc_floats_content\floatparameter\c!margin\relax
1747 \ifdim\wd\b_strc_floats_caption>\scratchdimen
1748 \ifdim\wd\b_strc_floats_caption<1.3\scratchdimen
1749 \scratchdimen0.8\scratchdimen
1750 \fi
1751 \fi
1752 \setbox\b_strc_floats_caption\vbox
1753 {\strc_floats_caption_set_align
1754 \hsize\scratchdimen
1755 \strc_floats_make_complete_caption}}
1756
1757\def\strc_floats_prepare_side_width_caption
1758 {\setbox\b_strc_floats_caption\vbox
1759 {\strc_floats_caption_set_align
1760 \hsize\floatcaptionparameter\c!width
1761 \strc_floats_make_complete_caption}}
1762
1763\def\strc_floats_prepare_stack_caption_fixed
1764 {\setbox\b_strc_floats_caption\vbox
1765 {\strc_floats_caption_set_align
1766 \hsize\floatcaptionparameter\c!minwidth
1767 \strc_floats_make_complete_caption}}
1768
1769\def\strc_floats_prepare_stack_caption_max
1770 {\setbox\b_strc_floats_caption\vbox
1771 {\strc_floats_caption_set_align
1772 \hsize\wd\b_strc_floats_content
1773 \strc_floats_make_complete_caption}}
1774
1775\def\strc_floats_prepare_stack_caption_width
1776 {\setbox\b_strc_floats_caption\vbox
1777 {\strc_floats_caption_set_align
1778 \hsize\floatcaptionparameter\c!width
1779 \strc_floats_make_complete_caption}}
1780
1781\def\strc_floats_prepare_stack_caption_min
1782 {\setbox\b_strc_floats_caption\vbox
1783 {\strc_floats_caption_set_align
1784 \hsize\wd\b_strc_floats_content
1785 \ifx\p_strc_floats_caption_align\empty
1786 \raggedcenter
1787 \fi
1788 \strc_floats_make_complete_caption}}
1789
1790\def\strc_floats_prepare_stack_caption_auto
1791 {\ifx\p_strc_floats_caption_align\empty \else
1792 \doifnotinset\v!middle\p_strc_floats_caption_align{\let\captionovershoot\!!zeropoint}
1793 \fi
1794 \edef\captionhsize{\the\wd\b_strc_floats_content}
1795 \scratchwidth\floatcaptionparameter\c!maxwidth\relax
1796 \ifconditional\c_floats_adapt_to_caption_width
1797 \let\captionminwidth \!!zeropoint
1798 \let\captionovershoot\!!zeropoint
1799 \fi
1800 \ifdim\captionhsize>\scratchwidth
1801
1802 \setbox\b_strc_floats_caption\vbox
1803 {\settrialtypesetting
1804 \strc_floats_caption_set_align
1805 \hsize\scratchwidth
1806 \notesenabledfalse
1807 \strc_floats_make_complete_caption}
1808 \ifdim\ht\scratchbox>\lineheight
1809 \setbox\b_strc_floats_caption\vbox
1810 {\strc_floats_caption_set_align
1811 \hsize\dimexpr\captionhsize\captionovershoot\relax
1812 \ifdim\hsize<\captionminwidth\relax
1813 \hsize\scratchwidth
1814 \fi
1815 \strc_floats_make_complete_caption}
1816 \else
1817 \setbox\b_strc_floats_caption\vbox
1818 {\strc_floats_caption_set_align
1819 \hsize\scratchwidth
1820 \strc_floats_make_complete_caption}
1821 \fi
1822 \else
1823
1824 \ifdim\captionhsize<\captionminwidth\relax
1825 \scratchdimen\captionminwidth
1826 \edef\captionhsize{\the\scratchdimen}
1827
1828
1829
1830 \fi
1831 \setbox\scratchbox\vbox
1832 {\settrialtypesetting
1833 \scratchdimen\dimexpr\captionhsize\captionovershoot3\emwidth\relax
1834 \ifdim\scratchdimen<\hsize
1835 \hsize\scratchdimen
1836 \fi
1837 \notesenabledfalse
1838 \strc_floats_make_complete_caption}
1839 \ifdim\ht\scratchbox>\lineheight
1840
1841 \setbox\b_strc_floats_caption\vbox
1842 {\strc_floats_caption_set_align
1843 \scratchdimen\dimexpr\captionhsize\captionovershoot\relax
1844 \ifdim\scratchdimen<\hsize
1845 \hsize\scratchdimen
1846 \fi
1847 \strc_floats_make_complete_caption}
1848 \else\ifx\p_strc_floats_caption_align\empty
1849 \setbox\b_strc_floats_caption\vbox
1850 {\strc_floats_caption_set_align
1851 \hsize\captionhsize
1852 \raggedcenter
1853 \strc_floats_make_complete_caption}
1854 \else
1855 \setbox\b_strc_floats_caption\vbox
1856 {\strc_floats_caption_set_align
1857 \hsize\captionhsize
1858 \strc_floats_make_complete_caption}
1859 \fi\fi
1860 \fi}
1861
1862\def\strc_floats_between_stack
1863 {\endgraf
1864 \nointerlineskip
1865 \floatcaptionparameter\c!inbetween
1866 \endgraf}
1867
1868\def\strc_floats_build_box_default
1869 {\strc_floats_align_content{\box\b_strc_floats_content}}
1870
1871\def\strc_floats_build_box_next_right#1
1872 {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
1873 {\d_strc_float_temp_height\ht\b_strc_floats_content
1874 \box\b_strc_floats_content
1875 \doifnotinset\v!hang\floatcaptionlocation
1876 {\dotfskip{\floatcaptionparameter\c!distance}}
1877 \vbox to\d_strc_float_temp_height{#1}}}
1878
1879\def\strc_floats_build_box_next_left#1
1880 {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
1881 {\d_strc_float_temp_height\ht\b_strc_floats_content
1882 \vbox to\d_strc_float_temp_height{#1}
1883 \doifnotinset\v!hang\floatcaptionlocation
1884 {\dotfskip{\floatcaptionparameter\c!distance}}
1885 \box\b_strc_floats_content}}
1886
1887\def\strc_floats_build_box_next_outer
1888 {\doifelserightpagefloat\strc_floats_build_box_next_right\strc_floats_build_box_next_left}
1889
1890\def\strc_floats_build_box_next_inner
1891 {\doifelserightpagefloat\strc_floats_build_box_next_left\strc_floats_build_box_next_right}
1892
1893\def\strc_floats_build_box_next_right_hang#1
1894 {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
1895 {\d_strc_float_temp_height\ht\b_strc_floats_content
1896 \box\b_strc_floats_content
1897 \vbox to\d_strc_float_temp_height{#1}}}
1898
1899\def\strc_floats_build_box_next_left_hang#1
1900 {\ifconditional\c_strc_floats_par_float \hpack \else \expandafter \strc_floats_align_content \fi
1901 {\d_strc_float_temp_height\ht\b_strc_floats_content
1902 \vbox to\d_strc_float_temp_height{#1}
1903 \box\b_strc_floats_content}}
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935\def\strc_floats_build_box_next_right_margin_indeed#1#2
1936 {\ifconditional\c_strc_floats_par_float
1937 \hpack\bgroup
1938 \d_strc_float_temp_height\ht\b_strc_floats_content
1939 \box\b_strc_floats_content
1940 \hsmash{\hskip#1\vbox to\d_strc_float_temp_height{#2}}
1941 \egroup
1942 \else
1943 \begingroup
1944 \d_strc_float_temp_height\ht\b_strc_floats_content
1945 \setbox\scratchboxone\vbox{#2}
1946 \ifdim\htdp\scratchboxone>\htdp\b_strc_floats_content
1947 \global\d_strc_floats_overflow\dimexpr\htdp\scratchboxone\htdp\b_strc_floats_content\relax
1948 \fi
1949 \ht\scratchboxone\d_strc_float_temp_height
1950 \everyrightofalignedline{\hsmash{\hskip#1\box\scratchboxone}}
1951 \strc_floats_align_content{\box\b_strc_floats_content}
1952 \endgroup
1953 \fi}
1954
1955\def\strc_floats_build_box_next_left_margin_indeed#1#2
1956 {\ifconditional\c_strc_floats_par_float
1957 \hpack\bgroup
1958 \d_strc_float_temp_height\ht\b_strc_floats_content
1959 \hsmash{\hskip\dimexpr#1\wd\b_strc_floats_caption\relax\vbox to\d_strc_float_temp_height{#2}}
1960 \box\b_strc_floats_content
1961 \egroup
1962 \else
1963 \begingroup
1964 \d_strc_float_temp_height\ht\b_strc_floats_content
1965 \setbox\scratchboxone\vbox{#2}
1966 \ifdim\htdp\scratchboxone>\htdp\b_strc_floats_content
1967 \global\d_strc_floats_overflow\dimexpr\htdp\scratchboxone\htdp\b_strc_floats_content\relax
1968 \fi
1969 \ht\scratchboxone\d_strc_float_temp_height
1970 \everyleftofalignedline{\hsmash{\hskip\dimexpr#1\wd\scratchboxone\relax\box\scratchboxone}}
1971 \strc_floats_align_content{\box\b_strc_floats_content}
1972 \endgroup
1973 \fi}
1974
1975\def\strc_floats_build_box_next_right_margin
1976 {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
1977
1978\def\strc_floats_build_box_next_left_margin
1979 {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance}
1980
1981\def\strc_floats_build_box_next_outer_margin
1982 {\doifelserightpagefloat
1983 {\strc_floats_build_box_next_right_margin_indeed\rightmargindistance}
1984 {\strc_floats_build_box_next_left_margin_indeed \rightmargindistance}}
1985
1986\def\strc_floats_build_box_next_inner_margin
1987 {\doifelserightpagefloat
1988 {\strc_floats_build_box_next_left_margin_indeed \leftmargindistance}
1989 {\strc_floats_build_box_next_right_margin_indeed\leftmargindistance}}
1990
1991\def\strc_floats_build_box_next
1992 {\let\next\strc_floats_build_box_next_left
1993 \processallactionsinset[\floatcaptionlocation]
1994 [ \v!outermargin=>\let\next\strc_floats_build_box_next_outer_margin,
1995 \v!innermargin=>\let\next\strc_floats_build_box_next_inner_margin,
1996 \v!leftmargin=>\let\next\strc_floats_build_box_next_left_margin,
1997 \v!rightmargin=>\let\next\strc_floats_build_box_next_right_margin,
1998 \v!lefthanging=>\let\next\strc_floats_build_box_next_left_hang,
1999 \v!righthanging=>\let\next\strc_floats_build_box_next_right_hang,
2000 \v!outer=>\let\next\strc_floats_build_box_next_outer,
2001 \v!inner=>\let\next\strc_floats_build_box_next_inner,
2002 \v!left=>\let\next\strc_floats_build_box_next_left,
2003 \v!right=>\let\next\strc_floats_build_box_next_right]
2004 \next}
2005
2006\def\strc_floats_build_box_side
2007 {\ifconditional\c_strc_floats_par_float
2008 \let\next\strc_floats_build_box_high
2009 \else
2010 \let\next\strc_floats_build_box_middle
2011 \processallactionsinset[\floatcaptionlocation]
2012 [ \v!low=>\let\next\strc_floats_build_box_low,
2013 \v!middle=>\let\next\strc_floats_build_box_middle,
2014 \v!high=>\let\next\strc_floats_build_box_high]
2015 \fi
2016 \next}
2017
2018\def\strc_floats_flush_right_caption_hang
2019 {\hsmash{\rlap{\dotfskip{\floatcaptionparameter\c!distance}\box\b_strc_floats_caption}}}
2020
2021\def\strc_floats_flush_left_caption_hang
2022 {\hsmash{\llap{\box\b_strc_floats_caption\dotfskip{\floatcaptionparameter\c!distance}}}}
2023
2024\def\strc_floats_flush_caption_hang
2025 {\doifelseinset\v!righthanging\floatcaptionlocation
2026 {\strc_floats_flush_right_caption_hang}
2027 {\doifelseinset\v!lefthanging\floatcaptionlocation
2028 {\strc_floats_flush_left_caption_hang}
2029 {\doifelseinset\v!hang\floatcaptionlocation
2030 {\doifelseinset\v!outer\floatcaptionlocation
2031 {\doifelserightpagefloat{\strc_floats_flush_right_caption_hang}{\strc_floats_flush_left_caption_hang}}
2032 {\doifelseinset\v!right\floatcaptiondirectives
2033 {\strc_floats_flush_right_caption_hang}
2034 {\strc_floats_flush_left_caption_hang}}}
2035 {\box\b_strc_floats_caption}}}}
2036
2037\def\strc_floats_build_box_high
2038 {\strc_floats_build_box_next{\strc_floats_between_stack\strc_floats_flush_caption_hang\vfill}}
2039
2040\def\strc_floats_build_box_low
2041 {\strc_floats_build_box_next{\vfill\strc_floats_flush_caption_hang\strc_floats_between_stack}}
2042
2043\def\strc_floats_build_box_middle
2044 {\strc_floats_build_box_next{\vfill\box\b_strc_floats_caption\vfill}}
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062\def\strc_floats_build_box_top_stack_normal_overlay
2063 {\vbox to \ht\b_strc_floats_content{\vss\strc_floats_build_box_top_stack_normal_content}}
2064
2065\def\strc_floats_build_box_top_stack_normal_content
2066 {\d_strc_float_temp_width\wd\b_strc_floats_content
2067 \ifconditional\c_strc_floats_par_float
2068 \hpack{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}
2069 \strc_floats_between_stack
2070 \hpack{\hbox{\box\b_strc_floats_content}}
2071 \else
2072 \page_otr_command_set_float_hsize
2073 \hpack{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}
2074 \strc_floats_between_stack
2075 \hpack{\strc_floats_align_content{\box\b_strc_floats_content}}
2076 \fi}
2077
2078\def\strc_floats_build_box_bottom_stack_normal_overlay
2079 {\vbox to \ht\b_strc_floats_content{\strc_floats_build_box_bottom_stack_normal_content\vss}}
2080
2081\def\strc_floats_build_box_bottom_stack_normal_content
2082 {\d_strc_float_temp_width\wd\b_strc_floats_content
2083 \ifconditional\c_strc_floats_par_float
2084 \hpack{\hpack{\box\b_strc_floats_content}}
2085 \strc_floats_between_stack
2086 \hpack{\strc_floats_locate_side_float{\box\b_strc_floats_caption}}
2087 \else
2088 \page_otr_command_set_float_hsize
2089 \hpack{\strc_floats_align_content{\box\b_strc_floats_content}}
2090 \strc_floats_between_stack
2091 \hpack{\strc_floats_locate_text_float{\box\b_strc_floats_caption}}
2092 \fi}
2093
2094\def\strc_floats_build_box_top_stack_normal
2095 {\doifelseinset\v!overlay{\floatcaptionparameter\c!location}
2096 \strc_floats_build_box_top_stack_normal_overlay
2097 \strc_floats_build_box_top_stack_normal_content}
2098
2099\def\strc_floats_build_box_bottom_stack_normal
2100 {\doifinset\v!overlay{\floatcaptionparameter\c!location}
2101 \strc_floats_build_box_bottom_stack_normal_overlay
2102 \strc_floats_build_box_bottom_stack_normal_content}
2103
2104\def\strc_floats_build_box_top_stack_grid
2105 {\dp\b_strc_floats_caption\strutdepth
2106 \setbox\scratchbox\vbox
2107 {\d_strc_float_temp_width\wd\b_strc_floats_content
2108 \hsize\d_strc_float_temp_width
2109 \ifconditional\c_strc_floats_par_float
2110 \strc_floats_locate_side_float{\box\b_strc_floats_caption}
2111 \vss\strc_floats_between_stack
2112 \hpack{\box\b_strc_floats_content}
2113 \else
2114 \page_otr_command_set_float_hsize
2115 \strc_floats_locate_text_float{\box\b_strc_floats_caption}
2116 \vss\strc_floats_between_stack
2117 \strc_floats_align_content{\box\b_strc_floats_content}
2118 \fi}
2119 \getnoflines{\dimexpr\htdp\scratchbox10\scaledpoint\relax}
2120 \vpack to \noflines\lineheight{\unvbox\scratchbox}}
2121
2122\def\strc_floats_build_box_bottom_stack_grid
2123 {\dp\b_strc_floats_caption\strutdepth
2124 \setbox\scratchbox\vbox
2125 {\d_strc_float_temp_width\wd\b_strc_floats_content
2126 \hsize\d_strc_float_temp_width
2127 \ifconditional\c_strc_floats_par_float
2128 \hpack{\box\b_strc_floats_content}
2129 \vss\strc_floats_between_stack
2130 \strc_floats_locate_side_float{\box\b_strc_floats_caption}
2131 \else
2132 \page_otr_command_set_float_hsize
2133 \strc_floats_align_content{\box\b_strc_floats_content}
2134 \vss\strc_floats_between_stack
2135 \strc_floats_locate_text_float{\box\b_strc_floats_caption}
2136 \fi}
2137 \getnoflines{\dimexpr\htdp\scratchbox10\scaledpoint\relax}
2138 \vpack to \noflines\lineheight{\unvbox\scratchbox}}
2139
2140\def\strc_floats_build_box_top_stack_stretch
2141 {\dp\b_strc_floats_caption\strutdepth
2142 \setbox\scratchbox\vpack
2143 {\strc_floats_align_caption{\copy\b_strc_floats_caption}
2144 \strc_floats_align_content{\copy\b_strc_floats_content}}
2145 \getnoflines{\dimexpr\htdp\scratchbox10\scaledpoint\relax}
2146 \vbox to \noflines\lineheight
2147 {\d_strc_float_temp_width\wd\b_strc_floats_content
2148 \hsize\d_strc_float_temp_width
2149 \ifconditional\c_strc_floats_par_float
2150 \strc_floats_locate_side_float{\box\b_strc_floats_caption}
2151 \vss\strc_floats_between_stack\vss
2152 \hpack{\box\b_strc_floats_content}
2153 \else
2154 \page_otr_command_set_float_hsize
2155 \strc_floats_locate_text_float{\box\b_strc_floats_caption}
2156 \vss\strc_floats_between_stack\vss
2157 \strc_floats_align_content{\box\b_strc_floats_content}
2158 \fi}}
2159
2160\def\strc_floats_build_box_bottom_stack_stretch
2161 {\dp\b_strc_floats_caption\strutdepth
2162 \setbox\scratchbox\vpack
2163 {\strc_floats_align_content{\copy\b_strc_floats_content}
2164 \strc_floats_align_caption{\copy\b_strc_floats_caption}}
2165 \getnoflines{\dimexpr\htdp\scratchbox10\scaledpoint\relax}
2166 \vbox to \noflines\lineheight
2167 {\d_strc_float_temp_width\wd\b_strc_floats_content
2168 \hsize\d_strc_float_temp_width
2169 \ifconditional\c_strc_floats_par_float
2170 \hpack{\box\b_strc_floats_content}
2171 \vss\strc_floats_between_stack\vss
2172 \strc_floats_locate_side_float{\box\b_strc_floats_caption}
2173 \else
2174 \page_otr_command_set_float_hsize
2175 \strc_floats_align_content{\box\b_strc_floats_content}
2176 \vss\strc_floats_between_stack\vss
2177 \strc_floats_locate_text_float{\box\b_strc_floats_caption}
2178 \fi}}
2179
2180\def\strc_floats_build_box_top
2181 {\let\next\strc_floats_build_box_top_stack_normal
2182 \processfirstactioninset[\floatcaptionparameter\c!location]
2183 [ \v!grid=>\let\next\strc_floats_build_box_top_stack_grid,
2184 \v!lines=>\let\next\strc_floats_build_box_top_stack_stretch]
2185 \next}
2186
2187\def\strc_floats_build_box_bottom
2188 {\let\next\strc_floats_build_box_bottom_stack_normal
2189 \processfirstactioninset[\floatcaptionparameter\c!location]
2190 [ \v!grid=>\let\next\strc_floats_build_box_bottom_stack_grid,
2191 \v!lines=>\let\next\strc_floats_build_box_bottom_stack_stretch]
2192 \next}
2193
2194\def\strc_floats_relocate_caption_right#1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{\hss#1}}}
2195\def\strc_floats_relocate_caption_left #1{\strc_floats_align_caption{\hbox to \d_strc_float_temp_width{#1\hss}}}
2196
2197\unexpanded\def\installfloatboxbuilder#1#2{\setvalue{\??floatbuilder#1}{#2}}
2198
2199\def\strc_floats_build_box
2200 {\strc_floats_build_box_before
2201 \global\setbox\floatbox\vbox
2202 {\strc_floats_set_local_hsize
2203 \forgetall
2204 \ifconditional\c_floats_store_minimal_package
2205 \strc_floats_build_box_separate_make
2206 \else
2207
2208 \let\floatcaptionarrangement\v!bottom
2209 \processcommacommand[\floatcaptionparameter\c!location]\strc_floats_build_box_step
2210 \ifcsname\??floatbuilder\floatcaptionarrangement\endcsname
2211 \lastnamedcs
2212 \else
2213 \strc_floats_build_box_default
2214 \fi
2215 \fi}
2216 \strc_floats_build_box_after}
2217
2218
2219
2220
2221\def\strc_floats_build_box_before
2222 {\let\currentfloatframed\currentfloat
2223 \floatwidth\wd
2224 \ifdim\wd\b_strc_floats_content>\wd\b_strc_floats_caption
2225 \b_strc_floats_content\else\b_strc_floats_caption
2226 \fi}
2227
2228\def\strc_floats_build_box_after
2229 {\doifelseframed\floatframedparameter\strc_floats_build_box_after_indeed\relax}
2230
2231\def\strc_floats_build_box_after_indeed
2232 {\global\setbox\floatbox\hpack
2233 {\edef\m_width{\floatframedparameter\c!width}
2234 \ifx\m_width\v!fit
2235 \let\m_width\floatwidth
2236 \else\ifx\m_width\v!broad
2237 \let\m_width\v!fit
2238 \fi\fi
2239 \letfloatframedparameter\c!strut\v!no
2240 \letfloatframedparameter\c!width\m_width
2241 \inheritedfloatframedframed
2242 {\box\floatbox}}}
2243
2244
2245
2246
2247
2248\newbox\b_strc_floats_separate_content
2249\newbox\b_strc_floats_separate_caption
2250
2251\def\strc_floats_build_box_separate_set
2252 {\settrue\c_floats_adapt_to_caption_width
2253 \settrue\c_floats_store_minimal_package}
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286\def\strc_floats_build_box_separate_make
2287 {\savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n1\relax:a}{\box\b_strc_floats_content}
2288 \savebox\??localfloatstack{\number\numexpr\c_strc_localfloats_n1\relax:b}{\box\b_strc_floats_caption}}
2289
2290\unexpanded\def\strc_floats_build_box_separate_split#1
2291 {\global\setbox\b_strc_floats_separate_content\vpack{\foundbox\??localfloatstack{\number#1:a}}
2292 \global\setbox\b_strc_floats_separate_caption\tpack{\foundbox\??localfloatstack{\number#1:b}}}
2293
2294
2295
2296
2297\def\strc_floats_build_box_step#1
2298 {\ifcsname\??floatbuilder#1\endcsname
2299 \def\floatcaptionarrangement{#1}
2300 \quitcommalist
2301 \fi}
2302
2303\def\strc_floats_locate_text_float
2304 {\let\next\strc_floats_align_caption
2305 \processallactionsinset[\floatcaptionparameter\c!location]
2306 [ \v!left=>\let\next\strc_floats_relocate_caption_left,
2307 \v!right=>\let\next\strc_floats_relocate_caption_right,
2308 \v!inner=>\doifelserightpagefloat{\let\next\strc_floats_relocate_caption_left }{\let\next\strc_floats_relocate_caption_right},
2309 \v!outer=>\doifelserightpagefloat{\let\next\strc_floats_relocate_caption_right}{\let\next\strc_floats_relocate_caption_left }]
2310 \next}
2311
2312\installfloatboxbuilder \v!none \strc_floats_build_box_default
2313\installfloatboxbuilder \s!default \strc_floats_build_box_default
2314\installfloatboxbuilder \v!high \strc_floats_build_box_high
2315\installfloatboxbuilder \v!low \strc_floats_build_box_low
2316\installfloatboxbuilder \v!middle \strc_floats_build_box_middle
2317
2318\installfloatboxbuilder \v!rightmargin \strc_floats_build_box_side
2319\installfloatboxbuilder \v!leftmargin \strc_floats_build_box_side
2320\installfloatboxbuilder \v!innermargin \strc_floats_build_box_side
2321\installfloatboxbuilder \v!outermargin \strc_floats_build_box_side
2322
2323\installfloatboxbuilder \v!left \strc_floats_build_box_side
2324\installfloatboxbuilder \v!right \strc_floats_build_box_side
2325\installfloatboxbuilder \v!inner \strc_floats_build_box_side
2326\installfloatboxbuilder \v!outer \strc_floats_build_box_side
2327
2328\installfloatboxbuilder \v!lefthanging \strc_floats_build_box_side
2329\installfloatboxbuilder \v!righthanging \strc_floats_build_box_side
2330\installfloatboxbuilder \v!hang \strc_floats_build_box_side
2331
2332\installfloatboxbuilder \v!top \strc_floats_build_box_top
2333\installfloatboxbuilder \v!bottom \strc_floats_build_box_bottom
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346\newif\ifpostponecolumnfloats \postponecolumnfloatsfalse
2347
2348\setnewconstant\postcenterfloatmethod\plusone
2349
2350\def\postcenterfloatbox#1
2351 {\scratchdimen
2352 \ifcase\postcenterfloatmethod
2353 #1
2354 \or\ifinsidecolumns
2355 \ifpostponecolumnfloats\makeupwidth\else#1\fi
2356 \else\ifdim#1>\hsize
2357 \hsize
2358 \else
2359 \wd\floatbox
2360 \fi\fi\fi
2361 \global\setbox\floatbox\hbox to \scratchdimen
2362
2363
2364 {\ifconditional\c_page_floats_center_box_global
2365 \donetrue
2366 \else\ifconditional\c_page_floats_center_box_local
2367 \donetrue
2368 \else
2369 \donefalse
2370 \fi\fi
2371 \ifdim\scratchdimen>\effectivehsize
2372 \donefalse
2373 \fi
2374 \hss\ifdone\hskip\effectiveleftskip\fi
2375 \box\floatbox
2376 \ifdone\hskip\effectiverightskip\fi\hss}}
2377
2378\def\strc_floats_set_paragraph_variant
2379 {\bgroup
2380 \forgetall
2381 \postponenotes
2382 \dontcomplain
2383 \setbox\b_strc_floats_content\vbox{\borderedfloatbox}
2384
2385 \ifnofloatcaption
2386 \global\setbox\floatbox\vpack{\box\b_strc_floats_content}
2387 \else
2388 \strc_floats_check_caption_content
2389 \strc_floats_prepare_side_caption
2390 \setbox\b_strc_floats_caption\hbox{\floatcaptionparameter\c!command{\box\b_strc_floats_caption}}
2391
2392
2393 \strc_floats_build_side_box
2394 \fi
2395 \egroup}
2396
2397\def\strc_floats_prepare_side_caption
2398 {\dostarttagged\t!floatcaption\empty
2399 \edef\p_strc_floats_caption_width{\floatcaptionparameter\c!width}
2400 \edef\p_strc_floats_caption_align{\floatcaptionparameter\c!align}
2401 \ifx\p_strc_floats_caption_width\v!max
2402 \strc_floats_prepare_side_caption_max
2403 \else\ifx\p_strc_floats_caption_width\v!fit
2404 \strc_floats_prepare_side_caption_fit
2405 \else
2406 \strc_floats_prepare_side_caption_width
2407 \fi\fi
2408 \dostoptagged}
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418\def\strc_floats_prepare_side_caption_max
2419 {\setbox\b_strc_floats_caption\vbox
2420 {\strc_floats_caption_set_align
2421 \hsize\wd\b_strc_floats_content
2422 \strc_floats_make_complete_caption}}
2423
2424\def\strc_floats_prepare_side_caption_fit
2425 {\ifdim\wd\b_strc_floats_caption>\wd\b_strc_floats_content\relax
2426 \setbox\b_strc_floats_caption\vbox
2427 {\forgetall
2428 \strc_floats_caption_set_align
2429 \hsize\wd\b_strc_floats_content
2430 \strc_floats_make_complete_caption}
2431 \else
2432
2433 \setbox\b_strc_floats_caption\hpack to \wd\b_strc_floats_content
2434 {\hss\hbox{\strc_floats_make_complete_caption}\hss}
2435 \fi}
2436
2437\def\strc_floats_prepare_side_caption_width
2438 {\setbox\b_strc_floats_caption\vbox
2439 {\strc_floats_caption_set_align
2440 \hsize\p_strc_floats_caption_width
2441 \strc_floats_make_complete_caption}}
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477\def\strc_floats_locate_side_float#1
2478 {\begingroup
2479 \alignstrutmode\zerocount
2480 \hsize\d_strc_float_temp_width \forgetall
2481 \alignedline{\floatparameter\c!location}\v!middle{#1}
2482 \endgroup}
2483
2484\def\strc_floats_build_side_box
2485 {\let\strc_floats_align_content\relax
2486 \let\strc_floats_align_caption\relax
2487 \strc_floats_build_box}
2488
2489\def\strc_floats_set_box
2490 {\ifvisible
2491 \par
2492 \edef\floatcaptiondirectives{\floatparameter\c!location,\floatcaptionparameter\c!location}
2493 \ifconditional\c_strc_floats_par_float
2494 \strc_floats_set_paragraph_variant
2495 \else
2496 \strc_floats_set_page_variant
2497 \fi
2498 \strc_floats_set_local_dimensions
2499 \global\advance\totalnoffloats\plusone
2500 \ifconditional\c_floats_store_minimal_package \else
2501 \setbox\floatbox\hpack{\strc_float_save_data\box\floatbox}
2502 \fi
2503 \global\floatheight\htdp\floatbox
2504 \global\floatwidth\wd\floatbox
2505 \ifconditional\c_floats_store_minimal_package \else
2506 \doifnotinset\v!margin\floatlocation
2507 {\setbox\floatbox\vpack
2508 {\parindent\zeropoint
2509 \box\floatbox}}
2510 \fi
2511 \wd\floatbox\floatwidth
2512 \ifdim\dimexpr\floatheight\lineheight\relax<\textheight \else
2513 \global\floatheight\dimexpr\textheight\lineheight\relax
2514 \ht\floatbox\floatheight
2515 \dp\floatbox\zeropoint
2516 \showmessage\m!floatblocks{10}{\the\totalnoffloats}
2517 \fi
2518 \fi}
2519
2520
2521
2522\definefloat
2523 [\v!figure]
2524 [\v!figures]
2525
2526\definefloat
2527 [\v!table]
2528 [\v!tables]
2529
2530\setupfloat
2531 [\v!table]
2532 [\c!frame=\v!off]
2533
2534\definefloat
2535 [\v!intermezzo]
2536 [\v!intermezzi]
2537
2538\definefloat
2539 [\v!graphic]
2540 [\v!graphics]
2541
2542
2543
2544\installcorenamespace{floatmethods}
2545
2546\let\floatmethod \empty
2547\let\floatlabel \empty
2548\let\floatcolumn \empty
2549\let\floatrow \empty
2550\let\forcedfloatmethod\empty
2551
2552\def\setfloatmethodvariables#1
2553 {\clf_analysefloatmethod{#1}}
2554
2555\def\somesomewherefloat[#1]
2556 {\page_floats_save_somewhere_float\s!somewhere{#1}}
2557
2558\def\strc_floats_get_box
2559 {\ifvisible
2560
2561
2562
2563
2564
2565
2566
2567
2568 \ifcsname\??floatmethods\currentoutputroutine:\floatmethod\endcsname \else
2569 \let\floatmethod\v!here
2570 \fi
2571 \ifx\forcedfloatmethod\empty \else
2572 \let\floatmethod\forcedfloatmethod
2573 \fi
2574\let\askedfloatmethod\floatmethod
2575\ifexporting \ifx\askedfloatmethod\v!here \else
2576 \showmessage\m!floatblocks{15}{\askedfloatmethod,\v!here}
2577 \let\floatlocation\v!here
2578\fi \fi
2579
2580 \edef\floatlocationmethod{\floatmethod,\floatlocation}
2581 \csname\??floatmethods\currentoutputroutine:\floatmethod\endcsname
2582 \fi}
2583
2584\installcorenamespace{floatsettings}
2585
2586\unexpanded\def\installfloatmethod#1#2#3
2587 {\setvalue{\??floatmethods#1:#2}{#3}}
2588
2589\unexpanded\def\handlefloatmethod#1
2590 {\csname\??floatmethods\currentoutputroutine:#1\endcsname}
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605\definesystemconstant{tblr}
2606\definesystemconstant{lrtb}
2607\definesystemconstant{tbrl}
2608\definesystemconstant{rltb}
2609\definesystemconstant{btlr}
2610\definesystemconstant{lrbt}
2611\definesystemconstant{btrl}
2612\definesystemconstant{rlbt}
2613\definesystemconstant{fxtb}
2614\definesystemconstant{fxbt}
2615\definesystemconstant{fixd}
2616
2617
2618
2619\installfloatmethod \s!singlecolumn \v!here \page_one_place_float_here
2620\installfloatmethod \s!singlecolumn \v!force \page_one_place_float_force
2621\installfloatmethod \s!singlecolumn \v!left \page_one_place_float_left
2622\installfloatmethod \s!singlecolumn \v!right \page_one_place_float_right
2623\installfloatmethod \s!singlecolumn \v!text \page_one_place_float_text
2624\installfloatmethod \s!singlecolumn \v!top \page_one_place_float_top
2625\installfloatmethod \s!singlecolumn \v!bottom \page_one_place_float_bottom
2626\installfloatmethod \s!singlecolumn \v!auto \page_one_place_float_auto
2627\installfloatmethod \s!singlecolumn \v!margin \page_one_place_float_margin
2628\installfloatmethod \s!singlecolumn \v!opposite \page_one_place_float_face
2629\installfloatmethod \s!singlecolumn \v!page \page_one_place_float_page
2630\installfloatmethod \s!singlecolumn \v!leftpage \page_one_place_float_leftpage
2631\installfloatmethod \s!singlecolumn \v!rightpage \page_one_place_float_rightpage
2632\installfloatmethod \s!singlecolumn \v!inmargin \page_one_place_float_inmargin
2633\installfloatmethod \s!singlecolumn \v!inleft \page_one_place_float_leftmargin
2634\installfloatmethod \s!singlecolumn \v!inright \page_one_place_float_rightmargin
2635\installfloatmethod \s!singlecolumn \v!leftmargin \page_one_place_float_leftmargin
2636\installfloatmethod \s!singlecolumn \v!rightmargin \page_one_place_float_rightmargin
2637\installfloatmethod \s!singlecolumn \v!leftedge \page_one_place_float_leftedge
2638\installfloatmethod \s!singlecolumn \v!rightedge \page_one_place_float_rightedge
2639\installfloatmethod \s!singlecolumn \v!somewhere \page_one_place_float_somewhere
2640\installfloatmethod \s!singlecolumn \v!backspace \page_one_place_float_backspace
2641\installfloatmethod \s!singlecolumn \v!cutspace \page_one_place_float_cutspace
2642\installfloatmethod \s!singlecolumn \s!tblr \page_one_place_float_top
2643\installfloatmethod \s!singlecolumn \s!lrtb \page_one_place_float_top
2644\installfloatmethod \s!singlecolumn \s!tbrl \page_one_place_float_top
2645\installfloatmethod \s!singlecolumn \s!fxtb \page_one_place_float_top
2646\installfloatmethod \s!singlecolumn \s!rltb \page_one_place_float_top
2647\installfloatmethod \s!singlecolumn \s!btlr \page_one_place_float_bottom
2648\installfloatmethod \s!singlecolumn \s!lrbt \page_one_place_float_bottom
2649\installfloatmethod \s!singlecolumn \s!btrl \page_one_place_float_bottom
2650\installfloatmethod \s!singlecolumn \s!rlbt \page_one_place_float_bottom
2651\installfloatmethod \s!singlecolumn \s!fxbt \page_one_place_float_bottom
2652\installfloatmethod \s!singlecolumn \s!fixd \page_one_place_float_force
2653
2654
2655
2656\installcorenamespace{localfloats}
2657\installcorenamespace{localfloatstack}
2658
2659\installsetuponlycommandhandler \??localfloats {localfloats}
2660
2661\setuplocalfloats
2662 [
2663
2664 \c!inbetween=\blank]
2665
2666\initializeboxstack\??localfloatstack
2667
2668\newcount\c_strc_localfloats_n \let\noflocalfloats\c_strc_localfloats_n
2669
2670\unexpanded\def\resetlocalfloats
2671 {\global\c_strc_localfloats_n\zerocount
2672 \initializeboxstack\??localfloatstack}
2673
2674\unexpanded\def\somelocalfloat
2675 {\global\advance\c_strc_localfloats_n\plusone
2676 \savebox\??localfloatstack{\number\c_strc_localfloats_n}{\box\floatbox}}
2677
2678\unexpanded\def\getlocalfloats
2679 {\dorecurse\c_strc_localfloats_n
2680 {\ifnum\recurselevel=\plusone
2681 \directlocalfloatsparameter\c!before
2682 \else
2683 \directlocalfloatsparameter\c!inbetween
2684 \fi
2685 \dontleavehmode\hpack{\foundbox\??localfloatstack\recurselevel}
2686 \ifnum\recurselevel=\c_strc_localfloats_n\relax
2687 \directlocalfloatsparameter\c!after
2688 \fi}}
2689
2690\unexpanded\def\flushlocalfloats
2691 {\getlocalfloats
2692 \resetlocalfloats}
2693
2694
2695
2696
2697\unexpanded\def\getlocalfloat#1
2698 {\foundbox\??localfloatstack{\number#1}}
2699
2700\unexpanded\def\forcelocalfloats
2701 {\let\forcedfloatmethod\v!local}
2702
2703\installfloatmethod \s!singlecolumn \v!local \somelocalfloat
2704\installfloatmethod \s!multicolumn \v!local \somelocalfloat
2705\installfloatmethod \s!mixedcolumn \v!local \somelocalfloat
2706\installfloatmethod \s!columnset \v!local \somelocalfloat
2707
2708\protect \endinput
2709 |