1

Using ConteXt, how could one prevent a page break between a heading and an image or text + image? For example, given:

 \section{With a Chart}
 \placefigure[here] {}{\externalfigure[Chart.pdf]}

 % or

 \section{With a Chart}
 \placefigure[right] {}{\externalfigure[Chart.pdf][width=5cm]}
 Hello, world ...

The above sequences regularly result in a page break between the section heading.

I noticed a couple related questions, but nothing exactly on this - what I would think as a trivial situation that might have a more straightforward answer than I have seen in the other questions.

Brian M. Hunt
  • 14,277

1 Answers1

2

The first heading-figure splitting can be remedied by using force in the location parameter. As for the second, I have found no solution and I don't think there is an easy one, because the wrapped figures mess quite a bit with how paragraphs are built and it's not easy to interact with this.

\starttext

\input knuth
\input knuth
\input knuth
\input knuth

\startsection[title={With a Chart}]

  \startplacefigure[location={force,here}]
    \externalfigure[Chart.pdf]
  \stopplacefigure

  \input knuth
  \input knuth
  \input knuth

\stopsection

\startsection[title={With a Chart}]

  \startplacefigure[location={force,right}]
    \externalfigure[Chart.pdf][width=5cm]
  \stopplacefigure

  Hello, world ...

\stopsection

\stoptext

enter image description here

Henri Menke
  • 109,596