# [NTG-context] widow and orphan control

Hans Hagen pragma at wxs.nl
Thu Mar 31 09:11:49 CEST 2005

Paul Tremblay wrote:
> On Wed, Mar 30, 2005 at 08:53:31AM +0200, Hans Hagen wrote:
>
>>>What I would need is some type of macro that can determine how much
>>>space is left on the page. If the space is less than some small,
>>>pretermined amount (say, 24 points, for example), then put the title on
>>>the next page, or put in a \blank[24pt, flexible]
>>>
>>>I know nothing about writing macros, or if this is possible.
>>
>>\testpage[24pt]
>>
>>
>
>
> This produces an unwanted "pt" in my text.
>
> But if I use:
>
> \testpage[3]
>
> I get some very interesting result. It almost seems from my tests that
> ConTeXt will break if it can't put 3 more "lines" on the page. Almost,
> anyway. If I have spaces as in:
>
> \testpage[3]
> Title\par
> \blank[24pt]
>
> The code doesn't quite work. It might even make an ugly orphan of poor
> title. In that case I have to increase the option in \testpage to 5 or 6
> to work.

actually it's

\testpage[noflines][dimensions]

normally you will indeed use a value of 5 or 6 (whitespacee + title of two lines
+ whitespace + first line of paragraph)

i don't know how you place titles, but why not:

\definesection[mytitle][subsubsubsubsubject]

\mytitle{...}

because that takes care of most situations

Hans

-----------------------------------------------------------------