How do I fix inconsistent spacing between paragraphs in master and source documents?

I am working on a book that has several documents as chapters, and a master document where they are combined.

One set of paragraphs shows up correctly in the source document, but not the master document. There should be one extra line space between each of the paragraphs. There is only a single line break and the extra space is made with the before and after spacing. On the master document there are two lines. Strangely, both documents have the same styles, imported from the same template. I tried to reimport and replace and i still get the same results.

If I check “do not add space between paragraphs of the same style”, then all the spaces go away. it seems like there should be an option to only add the top or bottom space between paragraphs of the same style. Is there another property somewhere that’s affecting this outside of the paragraph styles?

Can you reupload the screenshot with “view\formatting marks” turned on?

For headings it is common to specify spacing above and below.

For Body Text it is usual to have spacing only below the paragraph.

LibreOffice always adds the spacings together. If you have been using Word, then it only uses the largest of the spacings between paragraphs, it doesn’t add them together. If the document originated in Word then this might be where the problem arose.

Can you describe how you did the “import”? In principle, you don’t “import” from a template but you base a document on a template while creating it (File>New>Template) so that the documents remain associated to the template and benefit from the modifications to it


Have you modified the styles in the master document? In case you allowed live modification of sub-documents in the master, have you added direct formatting?

Are your subdocuments fully and exclusively styled, without any direct formatting?

If you still can’t find the cause of the problem, attach a reduced master document and a reduced sub-doc for analysis. Eventually, attach also the template file.

All direct formatting has been removed, and I import using Styles → Load Styles From Template , which allows me to reimport or update styles from the original template.

These were originally written in Google docs, then exported which gave me .docx. So this sounds like the issue. However, once I cleared all the direct formatting and assigned styles, it still looked correct when I resaved it as an .odt document. (I noticed some settings would not save if i just saved as .docx)

So since the .odt file still continues to combine the lines, is there a way to disable that in the .odt or enable it in the .odm ? Or is this an artifact that’s hidden in the original data some where? If the latter is the case, that sounds like a bug.

One more experiment I did was to copy the 3 paragraphs. I made a new file from the template and pasted, and it combined the spaces. The template was originally a .docx that was saved as a template so that setting is there. Then I made a new document from no template and pasted, and the extra space was there.

Here is the template. Again, this was originally saved from the docx file, and the spacing in this one is correct the way i would like it.

template2.ott (14.0 KB)

Can you modify the relevant paragraph style in the master so there is only the below paragraph spacing?

I can, but then there is no spacing as it transitions back into the other paragraph type. If i add it to the body type, then there will be too much space under the heading. Otherwise I have to go back through all the files and add the final line break manually. Which would be annoying but i guess it would work if there’s no other way. It seems like there are a bunch of hidden settings though that I might not be able to control. I was trying to do a diff on one minimal document that works and one that doesn’t, but i can’t because they are binary. I found the style inspector which seems to show a lot of properties that aren’t even listed in the documentation. Some are in the API docs, but not all of them.

Your template is already plagued with DOCX → ODF conversion artefacts. You have a lot of junk character styles inherited from Word lists. Your page styles seem to be safe.

Regarding paragraph style, I assume that normal style is inherited from default Word style. But you have (or Word has) “vassalised” many Heading n styles and others under it instead of the common Writer inheritance from Heading, Body Text or Default Paragraph Style.

Nearly all your styles have 0/0 cm spacing. Therefore don’t expect any spacing between paragraphs. Your Block Quote inherit from Block Quotation which has 0.64/0.64 cm. A few Heading n have non-zero spacing.

I recommend you redesign your template from scratch. Apparently you don’t use its contents. Only customise/create styles without contents. Then install and use Template Changer extension to rebase your documents on this “clean” template (even the master, which can’t be done from the normal Writer UI). With correctly template-based documents, style changes are automatically transferred when you reopen your docs or File>Reload (better to save before this command in order not to lose last changes).

When you work with a master and sub-docs, only what happens in the master matters. Formatting is driven by style name and the corresponding style configuration is taken from the master, not from the original sub-doc. This allows for funny tricks but I don’t think you’re ready for them.

If you still don’t get what you expect, check all your documents for empty paragraphs. This is a particularly sneaky form of direct formatting. An empty paragraph contains no information; consequently, a document should contain absolutely no empty paragraphs. In addition, empty paragraphs may induce shifts in page breaks (happening where you expect them the least).

I noticed your templates contains meaningless empty paragraphs.

Since Word has no notion of paragraph styles, I bet you have direct formatting in your docs for bold, italic, underline, colour, … Replace them with character styles unless your docs are intended to be exported as DOCX (where any style other than paragraph will be replaced by direct formatting).

A more targeted analysis requires a small master and a sub-doc.

Thank you for the detailed analysis of the document. I realize i probably need to rethink how I make these documents in the future. For now, I was able to find a solution that will get things working without the additional work.

Tools > Options > LibreOffice Writer > Compatibility and uncheck: Add spacing between paragraphs and tables