How to prevent page break between title and content?

I may be spoiled and probably need a pagination-focused software at this point, but:

How can i setup my styles in a way to prevent a section title to be alone in the end of a page?

i would like an automatic page break inserted there. ideally being able to set up the number of lines following the title so that one or two lines also get a page break before the title.

is this possible? I’m assuming not otherwise i think this would already be the default?

Widow/orphan are fundamentally different from Keep with next paragraph, but let’s start at the beginning.


Since you didn’t mention OS name and save format, a bit of warning: any advanced formatting is guaranteed to work repeatedly only if your document is saved .odt.

And I disagree with your statement about built-in help: I learnt all I know through the built-in help, but you must read carefully every word and understand the meaning of the typography terms.

In your case you try to play on two aspects:

  • keep a heading on the same page as the first contents paragraph
  • ensure a minimum of lines in the first contents paragraph at bottom of page

The first aspect is easy to manage: tick Keep with next paragraph in the heading paragraph style definition (usually, this is a member of the Heading n family). As I already mentioned, this will work as you expect if vertical spacing between paragraph is done through paragraph style configuration and not with empty line. Otherwise, the heading will be kept with the empty line, which is not want you want.

The second aspect is motivated by some aesthetic criterion. Lines at bottom of page are called orphans. Therefore you must alter the orphan control in the paragraph style for your text, i.e. Text Body (you never use Default Paragraph Style, do you? If you do, this is an error but it would be too long to explain in this question).

Note that orphan setting will affect all text paragraphs in your document.

You may also want to control the number of lines at top of page. These lines are called widows. By adjusting this control you can avoid a situation where you have a single line at top. Experiment to find the optimal values for your document to minimise wasted space at bottom of pages. So, don’t exaggerate with the values. Be careful because the settings taken globally interact in a non-trivial way.

Configuring these settings in paragraph styles results in predictable behaviour. If you practice dreaded direct formatting, you must manually configure all your paragraphs and it is easy to do so inconsistently or to forgot paragraphs here and there.

thank you! you are right on all accounts.
.
The feature I was looking for was number of lines in the section following the Heading. I.e. Several paragraphs, not just a single one.
.
Which covers the odd case where the paragraph following the Heading only have 1~4 lines, but you want to avoid 6 orphan lines, regardless if they are one paragraph or more.
.
I guess it is not possible and i must add a last manual revision step to add manual page breaks in those cases… thankfully it is easy to search for such cases with regex since they know about style (even though it is a pain that searches history are not saved between sessions, and there’s no way to save a list of regex in a text document because to use styles in the search they require UI button clicking :frowning: )

There may be a solution to your “multiple-paragraph 6-line block” but I don’t like it because it involves direct formatting, i.e. if you modify your text, the behaviour configuration doesn’t update automatically.

For short paragraphs following a heading, tick Do not split paragraph and Keep with next paragraph in Text Flow tab. Orphan setting in second paragraph after heading will govern the page break.

Do this with Format>Paragraph because you don’t want it to apply to all your paragraphs.

When setting the value for orphan, take into account the distance between paragraphs. Note that having a single orphan may be acceptable in this case.

Your “solution” is not clear at all. Did you tick Keep with next paragraph or did you play with widow/orphan controls?

The reliable solution to your question is to tick Keep with next paragraph in the heading paragraph style(s), i.e. the Heading n family if you use the built-in ones.

Note however that this works only if you don’t vertically space with empty paragraphs. Keep with next paragraph will make the heading and the next paragraph an atomic block. If you have an empty line after the heading, only this empty line will be kept on same page as the heading.

Space between paragraphs should be specified within the paragraph style definition in Indents & Spacing tab so that you don’t insert empty paragraphs. This way, contents immediately follows the heading and you get what you expect.

PS: when asking here, always mention OS name, LO version and save format.

you are correct. i spoke too son. I was indeed playing with the orphan values, but while it seem to have worked for one paragraph, it was by chance. these settings seem to not do anything in a predictable manner :frowning:
.

The help doesn’t help much either.
.

The only vertical spacing i have is the after/“before paragraph” and 1.5 line height. No blank lines anywhere.

.
I see the same behavior on Linux and windows. using a range of 7.5* versions. e.g. 7.5.7.1 (stable/still)
.

let’s say on one page i have a title with orphan/window both 6. Then I have 3 lines of space left on the page and a 2 line paragraph followed by another 2 line paragraph. (paragraph style have “[ ] keep with next paragraph” disabled.

HEADING
p1-l1...
...p1-l2.
(unused blank line)
-- page break --

p2-l1...
...p2-l2.

Q1: why it ignores i want 6 lines and keep the heading and paragraph1 on the bottom of the page?
.

now if i add more lines to paragraph 1:

HEADING
p1-l1...
...p1-l2...
...p1-l3.
-- page break --

p2-l1...
...p2-l2.

ok, it used the empty line… lets add another.

HEADING
p1-l1...
...p1-l2...
(unused blank line)
-- page break --

...p1-l3...
...p1-l4.
p2-l1...
...p2-l2.

it went back to wanting to use 2 lines of “orphan”.
.

I already tried to change my style to orphan=6 on the headings, doing “clear formatting” on the whole document (i only use some 4 styles) and forced a “tools > update all”
.
if i add 10 lines to the 1st paragraph it keeps 3 lines before the page break.
.

still do not understand that feature. …almost feel like there’s another feature keeping from orphaning 1 line of the paragraph taking precedence.

found something else that is confusing on the interface. the window and orphan are it’s own option. :slight_smile:
.
assumed they were suboptions for the “keep with next paragraph”. my bad.
.
So that is the thing that was moving doing the “keep 2 out of 2 lines even if we can fit 3 in the page” thing… so there was another feature.
.
But no luck with the original issue. disabling that still leaves the original issue broken. i.e. 2 orphan lines while i wanted minimum 6.

ok, it does solve the mystery.
.
Only the paragraph itself can move to another page based on orphaned lines. “orphans” and “windows” ARE NOT suboptions for the “keep with next paragraph”, which means just that, nothing else.
.
i guess there is no option of moving the title if I want a minimum of 6 lines, but the next paragraph have 1~5 lines.
.
(ps: now, ironically, this website refuses to space my paragraphs :slight_smile: )