LO Writer randomly ignores keep with next paragraph setting in a file linked by a section

I’m using LO 6.4.7.2 on MacOS Big Sur 11.2.1. I have created a glossary chapter (always begins on a new page) as a separate shared source file that I link to my other documents using a section. In my glossary, I set the text flow (direct formatting on each term) for each term to “Keep with Next Paragraph” to keep the term from being orphaned at the bottom of a page. The Orphan and Widow settings are the default of 2. There are no orphaned terms in the source file, but when the file is included in the other documents, there is one orphaned term while the rest are fine. This same term is not orphaned in the source file, but it is when I open the document where the file is included.

In this document, I do the following: 1) Use Edit Section to turn off write protection. 2) Double-click the orphaned term and select Paragraph > Paragraph > Text Flow. My settings there are correct, so I don’t make any changes. 3) Click OK. When I do that, voila! The orphaned term moves to the next page.

I don’t want to edit the 8 destination documents every time I update the glossary, so I’m looking for a way to stop this orphaned term in my source file. I’ve tried changing the Orphan and Widow values to 4 and 6, but the same thing happens: it works in the source file but not in the destination file until I edit the section to turn off write-protect, go in and look at the settings, and click OK.

The term and page location that is orphaned is random, but so far it’s been only one term. I’m wondering if the Write Protect setting has something to do with it, but I haven’t found a way to turn it off and keep it turned off in my destination document sections. I also can’t just put an empty paragraph or change the “below the paragraph” value because one of the documents has a different page size so the text flow is different.

Any help or hints you can give will be greatly appreciated. Thank you.

When you work on sophisticated or complex documents, never repeat seven times) work with direct formatting, always work with styles.

Direct formatting is “local” to the file where it occurs.

Your glossary was written in its own file. I don’t know which is the base style of your “term”, likely to be Text Body or, worse, Default Paragraph Style if you work only with DF.

When you Insert>File (section not needed), the paragraphs are formatted according to the definition of styles as they exist in the “importing” document.Formatting is selected on the name of the style, with all direct formatting discarded. Thus, Keep with next paragraph has the value existing in the importing document, not the one in the glossary.

How do you handle such a situation?

Your glossary should be styled with paragraph and character styles at least. Page styles are less relevant in first approximation. Prohibit any direct formatting.

Your importing document must define the same styles names and the definition in the importing document takes precedence over those in the glossary. To be more accurate, if styles in the glossary are unique (no override in the importing document), they will be used.

This suggests, for safety, that your glossary may use dedicated unique styles for terms and definitions.

The best way to guarantee predictable (for newbie) formatting is to base all your documents on the same template (defining your styles) and absolutely refrain from any direct formatting. Should you change your mind about formatting, change styles in the template. Next time you open your glossary or your document, you’ll be asked if the styles should be updated.

Read the chapters about styles and templates in the Writer Guide.

To show the community your question has been answered, click the ✓ next to the correct answer, and “upvote” by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

Thank you very much for your explanation. I didn’t know that the importing file’s styles take precedence over the imported one. My glossary and the importing documents do use a shared template with styles designed by someone else. The style that I direct-formatted with the “Keep with Next Paragraph” is a custom style named “Body” probably based on the LO Text Body style you mention. It’s a basic paragraph, to which I apply a custom “FirstEmphasis” character style, also in the shared template. I have 2 questions:

  1. Can I take this “Body” style (with the custom char style applied), apply the KWNP to it, and create a new unique style from this named “GlossaryTerm” in my local glossary file to fix the problem? There won’t be a corresponding term like this in the importing file. OR, do I need to add this style to the shared template to fix the problem?

  2. Does Insert > File automatically update the inserted file when it’s changed, like Section does?

Again, thank you for your help.

I suggest you create a dedicated style GlossaryTerm (and a symmetric on GlossaryDef) for your purpose. If your Body is used exclusively for terms, you can rename it when modifying the style. If it used only in the glossary, leave it in the glossary. If there is no such style in the “importing” documents, the style in the glossary will be used.

You don’t apply a character style to a paragraph style. You set the attributes in Font and Font Effects tab.

Insert>File does a copy of the text and its formatting. The section link does on the contrary keep an active relation with the original file allowing for updates.

If you have several such insertions in your document, a better approach is master document+slaves. Current state is always checked when you open the master and order of slaves can be very easily changed.

Thanks again for your good advice. I did create a dedicated style GlossaryTerm in my to-be-imported glossary file using “New”. Our Body style is used as the basic paragraph style so I didn’t touch it. First time around, I specified Body in “Inherit from” (on the Organizer tab) when defining my GlossaryTerm style. I had the same problem: the importing document ignored the imported formatting. Next, I modified the GlossaryTerm style to inherit None. Still no luck. The importing doc is still overriding “GlossaryTerm” KWNP, even though the style is unique to my glossary and does not inherit any style in the template shared between my glossary and the importing docs. I’m still using a template style for the definition. GlossaryTerm specifies it as the Next Style (Organizer tab). Do you think this style is affecting things somehow? Will adding GlossaryTerm and GlossaryDef to the template fix the override problem? Thanks again for your time and for sharing your know-how.

Make absolutely sure you have no direct formatting in the importing document. If it still does not work, edit your question to attach a one-definition glossary + a 1-page importing document (you can’t attach to a comment).

I added GlossaryDef to pair with GlossaryTerm and increased the widow/orphan values in GlossaryDef for better page breaks. The importing docs ignored the values (I tested 2 docs). I tried removing all direct formatting in one test doc, and that still didn’t work. So I deleted the test doc and made a new copy, just to see if there was something that might have been corrupted in the old test doc. The new importing test doc now honors the styles. My thought is that I didn’t properly save my changes in the imported doc or I didn’t properly close and re-open the imported docs, and that’s why the styles wouldn’t take. However, I really don’t know what happened. But now the solution you proposed - unique styles in the imported doc that don’t conflict with any styles in the importing doc - works. Thank you so much for your time and your assistance. Now I will try to figure out how to mark your answer as the correct solution.