TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to place multiple figures with additional side text using ConTeXT one after the other.

When there are two figures in a row they overlap. How should they be separated?

The following code creates overlapping figures when I run ConTeXT.

\placefigure[force][fig:first]{Caption 1} {\externalfigure[first-figure][width=\textwidth]}}
\inother[width=5cm]{Some text for the other bit}

\placefigure[force][fig:second]{Caption 2} {\externalfigure[second-figure][width=\textwidth]}}
 \inother[width=5cm]{Some text for the other bit 2}

What I'm trying to do is this:

enter image description here

share|improve this question
I am not sure what you are trying to do. Why use \starthanging with a figure that has width=\textwidth. Perhaps you can post an image that shows the desired output. – Aditya Apr 17 '13 at 19:09

As Aditya mentioned, using hanging is the wrong approach here. In the thread he linked to Hans and Wolfgang already provide two solutions. I'll present a third one, based on Wolfgang's solution, with the following features:

  • The additional text is typeset in the margin, not just close to the figure.
  • It uses the margindata interface. This allows the margin text to be manipulated using the usual ConTeXt interface.
  • I attempted to avoid low-level commands as much as possible.
  • The additional figure text is optional.
  • Additional margin texts are centred by default. If the its height exceeds the figure height, they are top aligned.

The code

\useMPlibrary [dum]  %% only for the screenshot



   align={flushleft, lohi}]

\starttexdefinition FigureText


First, an individual margin data set is defined. To correctly align the margin text, it uses a frame with the all the settings that frames usually accept.

Then the command FigureText is defined, which typesets the figure content and the additional margin text. It is not responsible for the caption. The command FigureText takes one argument, which is the figure content. The dowithnextbox trickery allows easy access to the dimensions of the box, which is used to properly align the margin text. This allows the definition of the macro without a parameter.

The margin text is passed as a second argument to \startplacefigure and picked up using \floatuserdataparameter.


Here is an example how to use it:

    [title=Some figure]
    [text=Some additional text for the margin.]

    [title=Another figure]
    [text=Some more margin text for the other figure.]
    \externalfigure [dum] [width=\textwidth]



The height of the margin texts is not taken into account. If floats are placed consecutively, margin texts might overlap. Example:

    [title=Some figure]
    [text=\input ward\par]


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.