[Tex/LaTex] ConTeXt: Keep title on same page with next paragraph

contextcontext-mkivtitles

I have a document with many chapters and sections. All my chapters starts with new page, but sections does not. Sometimes section title appears at the bottom of page alone, next paragraph starts with new page.

-----------------
|               |
| page content  |
|               |
|               |
| section title |
-----------------

-----------------
| paragraph of  |
| the section   |

How to prevent this for all titles authomatically? Section title must be placed on same page with next paragraph.

Best Answer

Depending on how the section headers are set up (show code, please, not ASCII art), a possible option is the \testpage command, used as:

\setuphead [section] [before={\testpage[2]}]

This inserts a page break before a section header, unless at least one line can fit below the header without introducing a page break.

See also: