How to let a (sub)section be placed on a new page if the previous page is more than x% filled?

I wondered how I can add a pagebreak before a section, sub-section, or sub-sub-section heading only in case the previous page has less than x% of the horizontal space available yet? E.g. don’t begin a new (sub)section below the middle of a page but rather move it to the next one.

1 Like

I think this thread and this answer is an implementation of that. It supports both relative and absolute measures for space.

1 Like

Duplicate of

Thanks for pointing it out @bluss! @joffdd, feel free to flag my reply/message me if you think this is an error.