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

Attachment: floatmargin.pdf
Description: Adobe PDF document

\setupexternalfigures
  [height=2cm]

\setupblackrules
  [height=2cm]

\def\graph
  {\blackrule}

\setuplayout
  [width=9cm,
   margin=4cm]

\setupcaptions
  [location={outermargin, high},
   width=\marginwidth]

\setupcaptions
  [mf]
  [location=bottom,
   width=\marginwidth]

\definefloat
  [mf]
  [mfs]

\setupfloat
  [mf]
  [criterium=\rightmarginwidth,
   location=inner,
   default=margin]

\starttext
\showframe

\input knuth

\startplacefigure [title=Figure description] \graph[width=3cm] \stopplacefigure
\startplacefigure [title=Figure description] \graph[width=5cm] \stopplacefigure

\startplacemf [title=Short]              \graph[width=2cm]   \stopplacemf
\startplacemf [title=Figure description] \graph[width=4cm]   \stopplacemf
\startplacemf [title=Figure description] \graph[width=4.2cm] \stopplacemf
\startplacemf [title=Figure description] \graph[width=8cm]   \stopplacemf

\stoptext
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to