How can I have identical layout, with the same template, for a standalone .odt, and as part of a master document

LibreOffice version 7.2.3.2, I use to write a book. I want to divide them with with parts (Heading 1), containing 1 short sentence on a further empty right page. The parts contains chapters (Heading 2) on a left page, with 10 mm with space above the heading. This white space above a chapter is a very common way to indicate a new chapter begins. I do this by modify the template, with tab “Indent a& spacing” with group Spacing the field “Above paragraph” has the value: 10 mm. For both Heading 1 and heading 2 I modify the template, tab “Text Flow” with the right block named “Breaks”. I checked the “insert” checkbox, field “type” : Page, field “Position”: Before. The checkbox “With page style” is checked, with in the field value, the required page. This does work well, using a template, and one large document.

But I want to use a master document, .odm with as inserted files the “part description” (Heading 1). This is just one right page. And each chapter as a specific document, .odt, this starts with a “blank page” inserted by LO. The second page is the page starting with heading 2 and the content. This work almost fine. Almost. Heading 2, does have a white space of 10 mm above in one large document. But not anymore when it starts with a “blank page”.
If, in the chapter document, I move the cursor in front of Heading 2, a new left page is created, then a LO generated “blank page” and the Heading 2. With the desired 10 mm white space before the Heading.

I have a lot of small chapters and I must minimize the number of pages of the book. The number of pages of the chapter must be even (left and right page), 2, 4 and sometimes 6 or more pages. In the chapter .odt file a chapter just seems to fit. But when loaded in the .odm file sometime one sentence, or even one word is to much. And so two more, almost blank, pages are added. This I do not want.

This is very hard to control, because the layout in the standalone .odt file differs form in .odm inserted file. Although the same template is used. My text fit quit often, just in the even numbers of pages. So it is very hard to control this manual. I tried to a have dummy page before Heading 2. This works, I have a good indent, but this dummy page will be also used in the .odm, which I do not want.

So it quite weird. The standalone .odt file does not give the desired layout. But when I insert it in a master document it has. If it would be the opposite, one might expect direct formatting in master document.

How can I have a identical layout, with the same template, in standalone .odt file, and when inserted in a master document?

If there is no vocabulary confusion, all your documents are based on the same template file (extention .ott). A template file stores all the styles which are then shared between your documents. Then it should work unless …

… unless you added some direct formatting in the master (because modifications in the master override definitions in the subdocs and the template).

The most frequent occurrences of direct formatting are “decorations” on words instead of character styles and adjustments on pages instead of page styles. Both are used because M$ Word has no equivalent notions and forces direct formatting usages. And unfortunately, M$ imposes its procedural writing method upon the vast majority of users, thinking that Word is THE ultimate truth in ergonomics and process.

Please, improve your question by providing more details on your formatting and mentioning your OS name and LO version (even if this seems irrelevant to you because there are subtle differences between versions, notably in menu items wording).

1 Like

@ajlittoz I added the desired info into my original question. To my opinion it can not be direct formatting in the master, because when I added before Heading 2, two empty lines, the the correct style is implemented in the stand alone .odt file.

@Bernard12 If you’re 200% sure you didn’t DF your files, even by accident, attach sample files: your template (doesn’t contain private data in principle), the master and one sample subdoc (3 pages max). If necessary replace any confidential details with dummy text. Make sure the problem still occurs. Add comments in the file(s) (either master or sub) to draw attention immediately on the issue, kind of expected result vs. observed result.

@ajlittoz My desire is not direct formatting, but the problem is, you never can be sure.

As you can see in document scientific_chapter_b.odt, Heading 2 has no white space indent above the heading. But is has in the template. So I assumed it would just fit, with the lines A, B, C in the end.

But inserting in a (total new created) master.odm the 10 mm white space is inserted, as my desire. But now I need two additional pages. If I knew that in advanced, I would have skipped line C.

Scientific_book_test5.ott (17.1 KB)
Master.odm (14.0 KB)
Scientific_chapter_b.odt (29.6 KB)

@Hrbrgr This is the basic, and I try to use that always. Before I post something I double check this. This does not mean I can not make a mistake.

This might be a feature for LO. The subdocument .odt and the master .odm should point to the same version of the template .ott. There might be a warming if this is not the case.

1 Like

@ajlittoz For more than a decade I did not use MS Word. MS Word should not be the standard for word processing, I do agree with you totally.

That is not the case. You should be able to work with documents based on different templates. It’s just that the style definitions in the MD will override the definitions in the styles with the same names in the SD.

You do everything right. I think there is some “glitch” in Writer, not sure it is a bug.

You have a “complex” sequence of page styles (alternating pairs of left/right constrained styles).

Your sub-document starts with a Heading 2 which forces a left page break. There is no data before it. Therefore Writer inserts a blank page to meet the page parity constraint.

If I add anything, be it an empty paragraph before your Heading 2, all attributes of Heading 2 are applied, spacing before included.

I don’t understand why the “no-data-before” case behaves erroneously. If I have other Heading 2 thereafter, the spacing before is present after the inserted blank page.

Sounds really like a bug (LO 7.2.4.1 here).


If the result is correct in the master, don't bother about it. Only the master is important. The way Writer works allows you to have "compact" styles in the subdoc (for ease of typing) with "full layout" applied in the master. Of course, if you're constrained on the number of pages, it is preferable to see where you go while typing and, apparently, you can't rely on this presently.
PS: when I open your document, I get "Missing hyphenation data, install nl-NL". Your text is declared nl_NL which seems consistent with the message. However, if you also get this message (I assume your have all locale files correctly installed), it reminds me of a problem related to the internals of the XML encoding of the file. It is extremely difficult to get rid of the message. Unfortunately, I don't remember the context and the cure.
2 Likes

I see the same as ajlittoz. LibO 7.2.4.1.

@ajlittoz @anon87010807 Thanks. I know if there is data before it works well. I know also the master is leading. I happy my understanding was ok. I just have to be really careful now keeping addition space in the end of the document.

Just for this forum. Your answer is not a solution. But I am satisfied with the answer, and know what to do to make a good master document. For future readers, should I mark this as a solution?

I didn’t use a “solution” but a “comment” because I am fully aware it does not solve the issue. So, don’t mark it as a solution. However, you can “like” the comment so that others can focus on it.

A word-around solution is to add in the sub-document a condition section. The condition is the number of pages. A sub-document will have less pages then the master. In this example the sub-document has 10 pages, and the master 50, so 20 pages will be a good number for the condition.

  • Menu → Insert → Section
  • Tab “Section”, Checkbox hide: Checked, Condition: PAGE > 20
  • Give the section so much (empty) lines to achieve the same distance what Heading n would generated.

In the sub-document this section is visible, not in the master. Check if the end of the page is identical in the sub-document as in the master.

Why not simply a hidden paragraph? Sections always cause subtle problems and make the document structure more brittle.

You give this hidden paragraph a very dedicated style (used only here) with only spacing above/below to compensate for the missing spacing before in the heading.

And since a condition on page count may be problematic due the various page counts in your chapters, you can set a variable in the master. Don’t do it in the subdoc.

When you edit the subdoc, since the variable doesn’t exist, its value in the condition expression is 0. Therefore, your condition should be v != 0 to unhide paragraph contents.

In the master, you insert a field to set the variable to a non-zero value, which will hide the paragraph in the subdocs.

@ajlittoz First of all, it is a bug in LO 7.2.3.2 because the derived version of Heading 2, Heading 2 appendix, see https://ask.libreoffice.org/t/using-appendix-headers/72188/3 does work fine.

Second an hidden paragraph could be better. I tried to do so using them, according the manual instructions:

  • Click in the paragraph to be hidden.
  • On the Functions tab of the Fields dialog, select Hidden Paragraph in the
    Type list.
  • Enter the condition, in the condition field.
    But without success, I can not hide a paragraph.

I have redone the test and it works here (LO 7.2.4.1 and I don’t think there is a difference with 7.2.3.2). What is your condition?

It looks like if you have a condition like v = <something> somewhere instead of v == <something> (single equal sign instead of double sign), all hidden paragraphs can no longer be hidden.

You are right, I have tried both 1==1 now, and the paragraph is indeed hidden. That was my mistake.
In the sub-document I could add your condition v != 0, and now indeed it is hidden.
But not in the master if I create field v with value 1.
To check if I made a mistake, I repeated the creation of field v in the sub-document, to assign the value 1 to variable v. And that did work. But this has, of course, not use for what I tried to achieve.

So it seems to be specific to at least the version 7.2.3.2