Ensure paragraph is surrounded by preceding and following paragraphs

I am writing a novel with Libre Writer 24.2.7.2. A few times per chapter, I place three asterisks on their own line to indicate a scene change. However, these asterisks sometimes end up at the very top or bottom of a page such that none of the previous or following paragraphs respectively are visible. I dislike this behavior, but I suppose it’s acceptable. I also insert a blank line (instead of asterisks) between paragraphs to mark minor scene changes. When these blank lines end up at the top or bottom of a page, however, they are impossible to notice.

How can I make a line stay with some portion of the previous and following paragraphs, i.e.:

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere.
Blank line or line with three asterisks
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere.

And not

Top of page
Blank line or line with three asterisks
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere.

Or

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim aeque doleamus animo, cum corpore dolemus, fieri tamen permagna accessio potest, si aliquod aeternum et infinitum impendere.
Blank line or line with three asterisks
Bottom of page

Furthermore, how much of a previous or following paragraph to stay glued to this center line should be governed by widow and orphan control. That way, if either paragraph surrounding the center line is long, only, say, two lines would stay attached to the center line.

I hope that makes sense… Is this possible? If not, is there some way to emulate this behavior?

Thank you for your help.

The parameters you need are all located in the Text Flow tab of a paragraph style.

My guess: at least three paragraph styles are necessary:

  • one for the scene boundary banner (with three asterisks)
    Can automatically switch to narrative style.
  • one for narrative paragraphs
  • one for start of minor scene change
    Can also automatically switch to narrative style.

Never use blank line to space paragraph apart. They’ll sooner or later play nasty tricks on your back. An empty paragraph has no semantic contents. Therefore it should not exist. If you need extra spacing in some paragraph, this is an intrinsic property of the paragraph significance. E.g. this extra spacing can be encoded as Spacing Above in the minor scene change paragraph style.

If you don’t want page breaks between specific paragraphs, use Keep with next paragraph text flow property. This can be set in the scene boundary style.

Keeping the scene boundary with the preceding paragraph is more complicated and needs a specific “end-of-scene” paragraph style (which can automatically switch to boundary and have the Keep with next paragraph attribute). This is necessary to avoid setting Keep with next paragraph in the narrative style which would turn your whole document into an atomic block. Therefore you specifically tag end of scene with the dedicated style.

PS: the suggestion above assumes your document is fully styled (and you’re familiar with styles) and your document is saved native .odt.

Thank you very much for helping me out, @ajlittoz. I’ll give it a try and let you know how it goes!

Yes, I was able to create minor scene changes by adding space after the last paragraph before a minor scene change via the paragraph-style menu, i.e., “edit style,” “indents & spacing,” “spacing,” and “below paragraph.” I then enabled “keep with next paragraph” under “text flow.” This works great if the preceding paragraph is less than two lines. However, if it is a longer paragraph, it no longer breaks properly across pages. Instead, it moves the whole paragraph onto the top of the next page.

This behavior confuses me considering that both “keep with next paragraph” and “allow to split paragraph” are enabled. It seems that enabling the former de facto disables the latter.

Paragraph style, text flow

Why won’t the paragraph at the end of one minor scene change break across pages when it belongs to a style that has “keep with next paragraph” and “allow to split paragraph” settings enabled? Yes, I want it to keep with the next paragraph (i.e., the first paragraph of the next scene), but I also want it to be able to split across pages, as governed by the “allow to split paragraph” settings.

Any ideas?

(This is only problematic when the minor or major scene change happens to be at the top or bottom of a page.)

Attach a short sample file exhibiting the issue.

Ensure paragraph is surrounded by preceding and following paragraphs, sample.odt (48.7 KB)

As you suggested, @ajlittoz, this sample document uses three styles: a narrative-paragraph style (“keep with next paragraph” is off and “allow to split paragraph” is on), an end-of-scene paragraph with space added below via the style properties (“keep with next paragraph” is on and “allow to split paragraph” is on), and an end-of-major-scene transition paragraph for the asterisks, which has space added below it ("keep with next paragraph is on and “allow to split paragraph” is on).

As you can see in the sample, paragraphs preceding the major or minor scene changes (those belonging to the “end-of-scene paragraphs,”) do not split properly across pages, despite being longer than four lines, the minimum dictated by the “no split at beginning of paragraph” and “no split at end of paragraph” settings.

I have included some comments in the sample to help.

I am afraid you bumped into a Writer limitation.

From experiment with your sample, Keep with next paragraph and Allow to split paragraph seem to be conflicting.

Allow to split paragraph alone works fine and I can adjust the parameters.

But as soon as I enable Keep with next paragraph, everything behaves as if Allow to split paragraph was unticked.

It is particularly visible on the first occurrence where the *End-of-scene paragraph is huge. (I change page size to A5 to make the phenomenon even more pronounced.) The second example is more sensitive to widow-orphan settings because the paragraph is much smaller and ends up as an unsplit paragraph (because it is smaller then the sum of orphan and widow).

I don’t remember such a behaviour but I use the Keep with next paragraph on headings which a commonly single-liners. There may be a regression. I’ll submit a bug report later to have the opinion of developers.


EDIT 2025-06-28 Bug report tdf#167278

1 Like

Yes, it does feel like the way “keep with next paragraph” and “allow to split paragraph” are interacting is a bug. I would not understand why users shouldn’t be able to keep (some portion) of a paragraph with the following paragraph, as governed by the “allow to split paragraph” settings. If, for whatever reason, this is the intended behavior, “allow to split paragraph” should become grayed out when “keep with next paragraph” is enabled. But I really hope this is not the intention.

Thank you very much for your help, @ajlittoz. I greatly appreciate it.

Hi again, @ajlittoz. I read through the discussions in the bug report your submitted. Thank you for advocating for me!

I would like to reply to what Justin L. said on Comment 2:

The implementation ought to be identical to what MS Word would do. (When I saved this example document as a DOCX, Word 2010 displayed it identically to what LO is doing).

I recreated my file from scratch in Microsoft 365 Word. I have attached this file.

Word behaves differently than Libre Writer. When “Widow/Orphan control” and “Keep with next” are enabled for a style, paragraphs belonging to that style do break when appropriate. This ensures that (a) some portion of these paragraphs stays attached to the following paragraph and (b) there are no awkward blank spaces at the end of the previous page.

For Word to behave as Libre Writer does, an additional paragraph setting, “Keep lines together,” must be enabled. This causes the whole paragraph to keep with the next paragraph. I have attached a screenshot of this setting too.

Ensure paragraph is surrounded by preceding and following paragraphs, sample from Microsoft Word.docx (25.4 KB)

I updated the bug report with your DOCX sample file.

Telesto said in Comment 6 that they are having trouble exporting the Microsoft Word sample I provided as a PDF. Perhaps it appeared odd because they exported it with my comments. I have created a PDF version without those comments and attached it here. This PDF appears as it should.

Ensure paragraph is surrounded by preceding and following paragraphs, sample exported as PDF from Microsoft Word.pdf (34.9 KB)