On Tue, 10 Nov 2020 at 17:54, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote:
Pablo Rodriguez schrieb am 10.11.2020 um 15:59:
> On 11/10/20 9:55 AM, Sylvain Hubert wrote:
>> Dear List,
>>
>> In the following example, the section title appears at the very end of
>> the first page.
>> [...]
>> Does anyone know where to adjust the penalty in this case, so that the
>> section title can be repositioned to the next page?
> Hi Sylvain,
>
>    \setuphead[title]
>      [before={\blank[preference, big],
>       after={\blank[samepage, big]]
>
> In this case, the blank space before sets a preference for inserting a
> page break. The blank space after requires to be in the same page with
> next paragraph.

Another method is to move the section title to the next page when the
remaining spaces
is below a specified number of lines. The following setup forces a page
break when
less than 4 lines remain on the current page.

\setuphead
   [section]
   [before={\testpage[4]\blank[2*big]}]

Wolfgang

Hi Wolfgang,

Thanks for the suggestion, but as illustrated by the second example, copied here, where the section title is at the top of the page:

    \starttext
    \showframe
    \dorecurse{50}{a }
    \startsection[title=spec][before={\blank[preference,big]}, after={\blank[samepage,big]}]
    \startxtable
    \startxrow
    \startxcell[ny=30]a\stopxcell\startxcell 1\stopxcell
    \stopxrow
    \dorecurse{29}{\startxrow\startxcell 2\stopxcell\stopxrow}
    \stopxtable
    \stoptext

it is sometimes difficult to predict how much remaining space should trigger a line break.

Sylvain