summaryrefslogtreecommitdiff
path: root/doc/context/sources/general/manuals/details/details-floatingaround.tex
blob: 11fe0601c31b6a3408aa516dd00e54124b8a28c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
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
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
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
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
% language=uk

\environment details-environment

\startcomponent details-floatingaround

\startchapter[title={Floating around}]

\index {floats}

Graphics, tables and alike are often treated as floating bodies. This means that
when such a body does not fit on the current page, it will be moved to the next
one. In the examples we will use figures, but everything we demonstrate here
applies to all floats.

A side float is a float which placement one way or another depends on the text
that follows it. In its simplest form, the text flows around it, for instance in:

\startbuffer
\placefigure[left,none]{caption}{\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer

The first keyword of such a call is treated as a placement directive, so this
figure will be placed left. The \type {none} directive nils the caption.

\getbuffer \fakewords{60}{80}

When the figure does not fit on the page, a page break is issued. A figure can
span multiple paragraphs. When a next graphic is placed the previous figure will
be padded if needed. First an example of multiple paragraphs.

\getbuffer \fakewords{30}{40} \par \fakewords{30}{40}

Multiple floats in a row will lead to padding. The amount of padding is a
combination of empty lines and the normal white space following the float. The
visual quality of the result depends on the graphic itself.

\start \tracesidefloatstrue

\getbuffer \fakewords{30}{40}

\getbuffer \fakewords{30}{40} \fakewords{30}{40}

\stop

Here we show the baseline of the first paragraph after the float as well as the
filler. The whitespace around a graphic also depends on the inter|-|paragraph
whitespace. As with many automated mechanisms, compromises are made. A one point
smaller figure may result in an extra empty line.

Later we will demonstrate a lot of tuning options, but first we give a few more
examples. Most of the tuning options can be driven by keywords as well as
(global) settings.

\startbuffer
\placefigure
  [left,nonumber]
  {caption} {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer

The \type {nonumber} keyword suppresses the label and figure number. You can do
this for all figures with

\starttyping
\setupcaption[figure][number=no]
\stoptyping

The previous placement command results in the following side float.

\getbuffer \fakewords{80}{100}

Another handy keyword is \type {none}.

\startbuffer
\placefigure
  [left,none]{quoting knuth}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer \getbuffer \fakewords{80}{100}

Control over spacing is exercised by means of the keywords \type {high}, \type
{low} and \type {fit}.

\startbuffer
\placefigure
  [left,none,high]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer \getbuffer \fakewords{80}{100}

\startbuffer
\placefigure
  [left,none,high,low]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer \getbuffer \fakewords{80}{100}

\startbuffer
\placefigure
  [left,none,fit]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer \getbuffer \fakewords{80}{100}

In the examples so far, we saw additional spacing around the graphic. We will now
(for a while) disable the surrounding whitespace.

\startbuffer
\setupfloat
  [figure]
  [sidespacebefore=none,
   sidespaceafter=none]
\stopbuffer

\typebuffer

With these settings a simple left placement looks as follows. The top of the side
float aligns with the maximum height of a line.

\start \getbuffer \tracesidefloatstrue

\startbuffer
\placefigure
  [left,none]
  {} {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40} \par \stop

You can change the alignment by setting the \type {sidealign} variable, for
instance:

\starttyping
\setupfloat
  [figure]
  [sidealign=line]
\stoptyping

The three keywords \type {height}, \type {line} and \type {depth} can also be
passed directly:

\startbuffer
\placefigure
  [left,none,height]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\typebuffer

The three alignments disable the spacing before the float and show up as follows.

\bgroup \tracesidefloatstrue \getbuffer \fakewords{30}{40} \par \egroup

\startbuffer
\placefigure
  [left,none,line]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\bgroup \tracesidefloatstrue \getbuffer \fakewords{30}{40} \par \egroup

\startbuffer
\placefigure
  [left,none,depth]{}
  {\framed[height=1cm]{graphic}}
\stopbuffer

\bgroup \tracesidefloatstrue \getbuffer \fakewords{30}{40} \par \egroup

So far the floats took up space in the main text body area. In addition to the
\type {left} (or \type {right}) directive we can use \type {inner} or \type
{outer} to force left or right placement depending in the spread.

Instead of spoiling paper in the text areas, we can use the margin and edges:
\type {leftmargin} and \type {leftedge}, \type {rightmargin} and \type
{rightedge}, but also \type {innermargin} and \type {outermargin}, \type
{inneredge} and \type {outeredge}.

The next couple of pages we will highlight the margins and edges so that we can
see what happens.

\setupbackgrounds [text] [leftedge]    [background=color]
\setupbackgrounds [text] [rightedge]   [background=color]
\setupbackgrounds [text] [leftmargin]  [background=color]
\setupbackgrounds [text] [rightmargin] [background=color]

\startbuffer
\placefigure
  [leftmargin,none]
  {} {\framed{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure
  [leftmargin,none]
  {} {\framed[width=1cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure
  [leftmargin,none]
  {} {\framed[width=1.5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

The placement directives can be combined with setting distance and width
parameters, thereby not only opening a world of possibilities, but also creating
confusion. Therefore, we will illustrate these features by cloning floats.

\startbuffer
\definefloat
  [marginfigure]
  [figure]

\setupfloat
  [marginfigure]
  [leftmargindistance=-\leftmargintotal,
   default={left,none,low}]
\stopbuffer

\typebuffer \getbuffer

The definition command clones figure into a new class of figures. There are two
ways to use such a float :

\starttyping
\placefloat
  [marginfigure]
  {} {\framed[width=1.5cm]{!}}
\stoptyping

or directly:

\startbuffer
\placemarginfigure
  {} {\framed[width=1.5cm]{!}}
\stopbuffer

\typebuffer

Both placement calls will result in a figure sticking into the margin.

\getbuffer \fakewords{30}{40}

By manipulating the margin distance, you can align graphics to vertical grid
lines, like the edge:

\startbuffer
\definefloat
  [edgefigure]
  [figure]

\setupfloat
  [edgefigure]
  [leftmargindistance=-\innercombitotal,
   default={left,none,low,high}]
\stopbuffer

\typebuffer \getbuffer

The \type {\innercombitotal} is one of the many available dimensions. This
measure is the combined width of the margin and edge.

\startbuffer
\placeedgefigure
  {} {\framed[width=1.5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placeedgefigure
  {} {\framed[width=\innercombitotal]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

You need to be aware of the fact that the margins and edges are not related to
the backspace and cut space settings. When you set up a layout, you need to think
of the right page as starting point. In a double sided layout, the margins are
swapped in the page composition stage. Unless you explicitly go to a left or
right page, you don't know if your left margin will be swapped or not.

For this reason \CONTEXT\ provides the inner and outer margin|/|edge dimensions.
These are automatically synchronized when the float is constructed. So, if you
want to automatically adapt the float placement and width to the current left
margin in a double sided document, you can use the inner dimensions.

\starttabulate[||||]
\NC dimension                  \NC left page
                               \NC right page                 \NC\NR
\NC \type{\outermarginwidth}   \NC \type{\leftmarginwidth}
                               \NC \type{\rightmarginwidth}   \NC\NR
\NC \type{\innermarginwidth}   \NC \type{\rightmarginwidth}
                               \NC \type{\leftmarginwidth}    \NC\NR
\NC \type{\outermargindistance}\NC \type{\leftmargindistance}
                               \NC \type{\rightmargindistance}\NC\NR
\NC \type{\innermargindistance}\NC \type{\rightmargindistance}
                               \NC \type{\leftmargindistance} \NC\NR
\stoptabulate

Similar dimensions are available for the edges. You can save yourself some
calculations by using the following dimensions:

\starttabulate[|||||]
\NC \type{\leftmargintotal}  \NC left  margin width \NC + \NC left  margin distance \NC\NR
\NC \type{\rightmargintotal} \NC right margin width \NC + \NC right margin distance \NC\NR
\NC \type{\innermargintotal} \NC inner margin width \NC + \NC inner margin distance \NC\NR
\NC \type{\outermargintotal} \NC outer margin width \NC + \NC outer margin distance \NC\NR
\stoptabulate

As you may expect, the edge totals are available as well, which leave a few more
totals, namely the combinations of margin and edge.

\starttabulate[|||]
\NC \type{\leftsidetotal}   \NC left  margin width \NC + \NC left  edge total \NC\NR
\NC \type{\rightsidetotal}  \NC right margin width \NC + \NC right edge total \NC\NR
\TB
\NC \type{\innersidetotal}  \NC inner margin width \NC + \NC inner edge total \NC\NR
\NC \type{\outersidetotal}  \NC outer margin width \NC + \NC outer edge total \NC\NR
\TB
\NC \type{\leftcombitotal}  \NC left  margin total \NC + \NC left  edge total \NC\NR
\NC \type{\rightcombitotal} \NC right margin total \NC + \NC right edge total \NC\NR
\TB
\NC \type{\innercombitotal} \NC inner margin total \NC + \NC inner edge total \NC\NR
\NC \type{\outercombitotal} \NC outer margin total \NC + \NC outer edge total \NC\NR
\stoptabulate

Adaptive back- and cutspace dimensions are also available:

\starttabulate[|||||]
\NC \type{\innerspacewidth} \NC adaptive backspace \NC\NR
\NC \type{\outerspacewidth} \NC adaptive cutspace  \NC\NR
\stoptabulate

There is one drawback in using the inner and outer dimensions: if you also change
the height of the float dynamically, you may end up in a kind of loop because a
page break may occur at a non||expected place.

While negative values move float into the margin, positive values will move the
float into the text. It will be of no surprise that you can also set the right
margin distance. Keep in mind that this distance is not related to the text
margin, but to the float margin.

\startbuffer
\setupfloat
  [edgefigure]
  [leftmargindistance=-\outercombitotal,
   rightmargindistance=-\outercombitotal,
   default={outer,none,low,high}]
\stopbuffer

\typebuffer \getbuffer

The locations \type {inner} and \type {outer} change with the left or right page.

\startbuffer
\placeedgefigure
  {} {\framed[width=\outercombitotal]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placeedgefigure
  {} {\framed[width=8cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

As a result of manipulating the floats margin settings, the side floats can start
in the margin (or edge). You should not confuse this with margin floats, i.e.\
side floats that are explicitly placed in the margins.

\startbuffer
\placefigure[leftmargin,none]
  {} {\framed{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure[leftmargin,none]
  {} {\framed[width=.5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure[leftmargin,none]
  {} {\framed[width=1.5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure[leftmargin,none]
  {} {\framed[width=5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

The margin side floats align to the margin and the edge floats to the edge. This
way you can create bleeding figures.

\startbuffer
\placefigure[leftedge,none]
  {} {\framed{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

There are situations where you don't know the dimensions in advance. In order to
prevent unwanted side effects, for instance part of a graphic disappearing
outside the page boundary, \CONTEXT\ provides a few options. The most crude one
is setting the \type {criterium}, as in:

\starttyping
\setupfloat
  [figure]
  [criterium=.25\textwidth]
\stoptyping

This will automatically turn figures that are wider than 25\% of the text width
into normal floats instead of side floats. But let's not fall back on that
feature now.

You can use \type {maxwidth} and \type {minwidth} variables to control the
placement in more detail. The exact result depends on the settings of \type
{location}. By default we center, but you can set the location to \type {left} or
\type {right} to achieve a different alignment.

\startbuffer
\definefloat
  [midmarginfigure]
  [figure]

\setupfloat
  [midmarginfigure]
  [minwidth=\leftmarginwidth,
   default={leftmargin,none}]
\stopbuffer

\typebuffer \getbuffer

You can use \type {maxwidth} and \type {minwidth} variables to control the
placement in more detail. The exact result depends on the settings of \type
{location}. By default we center, but you can set the location to \type {left} or
\type {right} to achieve a different alignment.

\startbuffer
\placemidmarginfigure
  {} {\framed[width=1.5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

The meaning of \type {maxwidth} depends on the kind of float. First we place a
left float with a width smaller than \type {maxwidth}.

\start

\startbuffer
\setupfloat[figure][maxwidth=2cm]
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\placefigure[left,none]{}{\framed[width=1cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

When the width exceeds the maxwidth, the float will be centered. This is because
we have no reference alignment point.

\startbuffer
\placefigure[left,none]{}{\framed[width=5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

In margin floats, the \type {maxwidth} settings have a different result. First we
place a small graphic.

\startbuffer
\setupfloat[figure][maxwidth=\leftmarginwidth]
\stopbuffer

\typebuffer \getbuffer

\startbuffer
\placefigure[leftmargin,none]{}{\framed[width=1cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

Because the left and right margin of this document are the same |<|the edges
differ|>| we don't need to use inner and outer dimensions.

\startbuffer
\setupfloat[figure][maxwidth=\leftmarginwidth]
\stopbuffer

\typebuffer \getbuffer

A wider than \type {maxwidth} graphic will behave like a mixture of a margin and
text side float. Watch how we align the float to the margin.

\startbuffer
\placefigure[leftmargin,none]{}{\framed[width=5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\stop

Instead of setting the width you can give \type {hanging} a try. The next
examples demonstrate this.

\startbuffer
\placefigure[leftmargin,hanging,none]{}{\framed[width=5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure[left,hanging,none]{}{\framed[width=5cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

You can move down|/|up margin floats with the \type {\movesidefloat} macro. Such
shifts come in handy when you have multiple side floats near to each other.

\startbuffer
\movesidefloat [+2*line]
\placemidmarginfigure {} {\framed{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

Given the default placement template, this is equivalent to the following
command. Watch out, a simple \type {line} has a different effect (alignment).

\starttyping
\placemidmarginfigure
  [leftmargin,none,+2*line]
  {} {\framed{!}}
\stoptyping

Another nice keyword is \type {long}:

\startbuffer
\placefigure
  [leftmargin,none,long]
  {} {\framed[height=2cm,width=2cm]{!}}

Watch how we move down. The effect is that we skip over the margin figure.

\placefigure
  [leftmargin,none]
  {} {\framed[height=1cm,width=2cm]{!}}
\stopbuffer

\typebuffer \getbuffer \fakewords{30}{40}

\startbuffer
\placefigure
  [leftmargin,none]
  {} {\framed[height=2cm,width=2cm]{!}}

Do we clash or not?

\placefigure
  [leftmargin,none]
  {} {\framed[height=2cm,width=2cm]{!}}

Did we clash or not?
\stopbuffer

\typebuffer \getbuffer

There are a few macros that can be of help with solving clashes in side floats:

\starttabulate
\NC \tex {flushsidefloats} \NC
    This macro moves down as much as is needed to separate the side floats of
    each other. \NC \NR
\NC \tex {forgetsidefloats} \NC
    this macro kind of forgets that a side float is in progress. \NC \NR
\stoptabulate

Use these macros with care. If you change the dimensions of the graphic and|/|or
content involved, reconsider the use of these directives.

The next couple of spreads we will demonstrate some example definitions. These
placements are taken from one of the styles we made for typesetting a series of
school math books which illustrations and tables all over the pages.

First we fine tune the spacing around side floats and verbatim text.

\startbuffer[setupa]
\setupfloats
  [sidespacebefore=none,
   sidespaceafter=depth]

\setuptyping
  [margin=]
\stopbuffer

\typebuffer[setupa]

The placements have rather verbose names. In this case the word \quote {edge} is
used to identify bleeding floats (with an cut||off margin of 3mm). The \quote
{text} floats are side floats positioned in the main text flow.

\startbuffer[setupb]
\definefloat [marginfigure]       [marginfigures]       [figure]
\definefloat [middlemarginfigure] [middlemarginfigures] [figure]
\definefloat [middlefigure]       [middlefigures]       [figure]
\definefloat [textfigure]         [textfigures]         [figure]
\definefloat [leftfigure]         [leftfigures]         [figure]
\definefloat [rightfigure]        [rightfigures]        [figure]
\definefloat [bleedfigure]        [bleedfigures]        [figure]
\stopbuffer

\typebuffer[setupa]

Watch how we define fall backs for too wide content (\type
{criterium} as well as use \type {maxwidth} to manipulate
the placement of content that falls off the margins.

The black rules are set up with:

\startbuffer[setupc]
\setupblackrules[color=tred,depth=0pt,height=1.5cm]
\stopbuffer

\typebuffer[setupc]

\page[left]

\startbuffer[series]

\startbuffer
\setupfloat
  [marginfigure]
  [criterium=.5\textwidth,
   maxwidth=\rightmarginwidth,
   default={outermargin,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemarginfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemarginfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [middlemarginfigure]
  [minwidth=\rightmarginwidth,
   criterium=\backspace,
   location=middle,
   default={outermargin,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placemiddlemarginfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [middlefigure]
  [default={here,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placemiddlefigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer

%\startbuffer
%\placemiddlefigure{}{\blackrule[width=16cm]}
%\stopbuffer
%
%\getbuffer \typebuffer

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [textfigure]
  [criterium=.5\textwidth,
   default={outer,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placetextfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [leftfigure]
  [criterium=.5\textwidth,
   default={left,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placeleftfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placeleftfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [rightfigure]
  [criterium=.5\textwidth,
   default={right,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placerightfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placerightfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [bleedfigure]
  [criterium=.5\textwidth,
   leftmargindistance=-1mm,
   rightmargindistance=-1mm,
   default={backspace,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placebleedfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\startbuffer[series]

\startbuffer
\setupfloat
  [bleedfigure]
  [criterium=.5\textwidth,
   leftmargindistance=-1mm,
   rightmargindistance=-1mm,
   default={cutspace,none}]
\stopbuffer

\getbuffer \typebuffer

\startbuffer
\placebleedfigure{}{\blackrule[width=.25cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=.5cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=1cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=2cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=4cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=8cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\startbuffer
\placebleedfigure{}{\blackrule[width=16cm]}
\stopbuffer

\getbuffer \typebuffer \flushsidefloats

\stopbuffer

{\getbuffer[setupa,setupb,setupc,series]} \page
{\getbuffer[setupa,setupb,setupc,series]} \page

\page

\setupbackgrounds [text] [leftedge]    [background=]
\setupbackgrounds [text] [rightedge]   [background=]
\setupbackgrounds [text] [leftmargin]  [background=]
\setupbackgrounds [text] [rightmargin] [background=]

\stopchapter

\stopcomponent