Automatic margin floats using the criterium parameter
Hi, I am working on some float placement code for a project. To not reinvent the wheel I like to know what is currently possible in ConTeXt. Small floats should be placed in the margin and bigger ones centred in the text. Captions always go into the margin. That is the idea. The key to automate this seems to be the \setupfloat[criterium=…] parameter. Details: 1) Captions always in the margin 2) Captions left aligned 3) Figures smaller or equal \marginwidth go into the outer margin 4) Margin figures are aligned to the inner side of the margin 5) Margin figure captions underneath the figure 6) Figures wider than the margin go centred into the text 7) Text figure captions top aligned I got almost everything working. A minimal example is attached. Problems: Mf 1-2 are placed correctly. Problematic are Mf 3-4. The caption is not placed in the margin because of the \setupcaptions [mf] [location=bottom] setting for margin figures. Another thing is the weird alignment of Mf 3-4, I expect the figures to be centred. The reason is the following setting. \setupfloat [mf] [location=inner] If uncommented, the alignment of the margin figures is wrong. Figure 1-2 are examples of how it should look like. I could come up with a hackish solution on my own but maybe someone has an idea how to achieve this with built-in support. Marco
On 5-9-2012 09:43, Marco Patzer wrote:
Hi,
I am working on some float placement code for a project. To not reinvent the wheel I like to know what is currently possible in ConTeXt.
fyi: As I often need conditional placement in projects (mostly width related), it's likely that there will be a pluggable system some day (some snippets are in place but not a coherent framework). It's somewhat complicated by the fact that one has to decide what to do with delayed placement. No time now, so it will happen next year or so. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On 2012-09-05 Hans Hagen
I am working on some float placement code for a project. To not reinvent the wheel I like to know what is currently possible in ConTeXt.
fyi: As I often need conditional placement in projects (mostly width related), it's likely that there will be a pluggable system some day
I already consider the entire float mechanism very flexible and feature rich.
It's somewhat complicated by the fact that one has to decide what to do with delayed placement.
I'm quite happy with the placement in general. The exact problem here is that if the \setupfloat[criterium=…] value is exceeded, it seems that ConTeXt adjusts the values “location” and “default” to place the float in the text. A solution would be to be able to state a fallback float class in case criterium is exceeded. Idea: \definefloat [marginfigure] [marginfigures] \definefloat [marginfigurefallback] [marginfiguresfallbacks] [marginfigure] \setupfloat [marginfigure] [criterium=\marginwidth, criteriumfallback=marginfigurefallback] This way full control is being maintained, since the float and caption style of the fallback class can be individually adjusted. Marco
participants (2)
-
Hans Hagen
-
Marco Patzer