Problems keeping headlines on the same page as the text that follows

Inevitably on a multipage document, headlines sometimes end up at the bottom of the page. I am trying to format them in a way that always keeps them on the same page as the text that follows (separated by an empty line).

I have tried the obvious: select the headline, then go to Format → Paragraph and select “keep with next paragraph.” Nothing happens. I tried this numerous times and went through every iteration of checking and unchecking the other three boxes around it, too, all to no avail. Am I using the wrong method? If so, please let me know how to achieve what I described. Any helpful suggestions appreciated!

Apparently, you’re working in direct formatting mode, i.e. you apply manually what you need.

The simplest solution to your problem is to apply ad hoc paragraph styles to your text.

Built-in Body Text is intended to format your main topic (not Default Paragraph Style which has a technical role as a recipient for your preferred “defaults” all over the document, such as font face, size, weight, alignment, spacing above and below, …).

Your headlines will be formatted with Heading 1-10, 1 corresponding to chapter, 2 to sub-chapter, etc. By default, all Heading n come with *Keep with next paragraph enabled. This will keep the headline and the immediately following paragraph on the same page.

BUT, if you’re vertically spacing with *empty paragraphs, only the heading and this empty para will be kept together on the page, not the text which follows.

Empty paragraphs have no value; they contain no information, thus they should be eliminated. Empty paragraphs always cause problems in Writer, first regarding vertical spacing.

Vertical spacing is a property of the type of paragraph. For example, a headline has a rather tall spacing before ans a smaller one below. Main topic has moderate spacing split equally above and below (refrain from setting only one because this will make your life difficult when you mix various paragraph styles).

Therefore, to fix your problem, eliminate all empty paragraphs and direct formatting, apply an adequate style to your text (Heading -, Body Text and many others as fit). Then customise the style settings to adjust spacing above and below to your liking. Since there is now no empty paragraph between your headline and text, both are guaranteed to keep together.

Why is it necessary to clear direct formatting (DF)? DF takes precedence over character style which itself takes precedence over *paragraph style Therefore DF settings will mask the same settings in the style making them ineffective.

Note also that adjusting styles has an immediate effect on the whole document. You no longer need to track and chase your individual DF applications.

Thank you, ajlittoz! I do of course want to have a line under the headline, but not increase line spacing, as I want the text that follows to be single spaced.


The solution (which I haven’t found anywhere in this forum so far and just discovered by accident), appears to be to select both the headline and the following empty line, then doubleclick on the Paragraph style that does the trick (e.g. headline, or one that one specifically creates), and then wait a few seconds. Somehow this currently works for me.

The Heading style has a setting for how much space above and below it should have. This is unrelated to the line spacing, especially of the following paragraph style.

The Writer Guide should help as a reference, especially the chapter on styles, download from LibreOffice Bookshelf

The paragraph style that follows a Heading (Ctrl+1 to Ctrl+5) is Body Text (can also be applied with Ctrl+0). By default, Body text has line spacing of 1.15 for ease of reading. This can be changed by right-clicking the Body Text style in the Sidebar and selecting Edit style > Indents & Spacing, Change Line Spacing to Single and OK out.
.
To increase the spacing below a Heading style, Right click the Heading style, select Edit style > Indents & Spacing and increase the Below paragraph spacing.
Here is a sample document
HeadingStaysWithFollowingParagraph137567.odt (54.4 KB)

Default Paragraph Style is the ancestor of all styles, they inherit from that style. It is not intended to be used in the document but rather to make global changes easily such as changing the font.

  • Paragraph Styles can be overridden by
  • Character styles which can be overridden by
  • Direct Formatting or macros. A document that is direct formatted is problematic to change if, say someone wants the font changed

You can open a blank document, make the changes above and set that as the default template. After making the changes to the styles click File > Templates > Save as template.
In the dialogue, give your template a relevant name, select My Templates, tick the box Set as default template and click the Save button.

To remove the default status of your template, click File > Templates > Manage templates. In the dialogue, right click your template (should have a green tick) and select Reset default