Thanks, Pablo and Bruce. Both solutions work well.

> I had similar issues with \section and only the Latin script was involved.

Btw, just in case if anyone shares this idea: is it possible to have a zulip channel for ConTeXt? It's free for open source projects, has a interface for existing mailing lists, and has a reasonable builtin search engine, which could serve as another de-facto documentation, considering the fact that very few of the massive useful use cases asked in the mailing lists so far have been transcribed into official documentations.

On Mon, 20 Feb 2023 at 05:22, Pablo Rodriguez via ntg-context <ntg-context@ntg.nl> wrote:
On 2/19/23 20:34, Sylvain Hubert via ntg-context wrote:
> Dear list,
>
> I have a long document (A4 * 170 pages) with some CJK fonts, where some
> of the \subject{...} are placed at the end of the corresponding pages,
> which looks awkward. How can one flush those last-line titles to the
> next pages?

Hi Sylvain,

the hard part for the rest of us is figuring out what you may have on
your screen.

\setuphead[subject][before={\blank[preference]}] might help.

Another approach would be \setuphead[subject][after={\blank[samepage,
line]}].

I mean, either you set a preference for breaking pages before \subject
or you force \subject to be on the same page with next paragraph.

Nothing prevents you from doing both.

BTW, default values for before and after in \setuphead[subject] are
\blank[2*big] and \blank (respectively [copied from strc-def.mkxl]).

> Currently I don't have a MWE, as trivial filling-up with 1-2 pages of
> \lipsum doesn't reproduce the problem. I'm optimistically asking without
> MWE, but if it is necessary anyway, please tell me and I will obfuscate
> the 170-page document and find a way to upload it.

I hope it might help. It is not clear for me whether the CJK fonts are
only for fragments in these languages or the main text is written in any
of these languages.

I had similar issues with \section and only the Latin script was involved.

Again, I hope it might help,

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

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________