What you get is to be expected.
An outline (Heading n paragraphs) is determined by scanning the text from start to end, recording Heading n as they are met. When your document is made solely of the default flow (the “main flow”), the Navigator gets all Heading n is the right sequence.
Your document is made of several flows: the main flow and independent flows in the frames. There is no defined “temporal” or “geographic” relationships between them. Therefore, the order in which they are recorded in not predictable. From prior experience, the order in which frames where created may also play a role. Consequently, you’re quite happy that “4th hdr 1” and “4th hdr 2” are in the correct order, but they might as well be inverted.
Your Heading 4 must imperatively be in the main flow where they are logically supposed to appear. You have then two fixes:
-
Play with Indents & Spacing
for Heading to move it inside the margin with a negative Before teext: indent.
But this creates a paragraph of its own which cannot be vertically aligned with the top of the next one.
-
Outsmart LO:
-
Modify Heading 4 in Font Effects
to set Hidden attribute. Don’t forget to enable Tools
>Options
, LibreOffice Writer
>View
Hidden text so that you can see your Heading 4 as you type them.
-
Type your Heading 4 in the main flow where they logically occur
-
Insert
>Frame
>Frame
anchored at the first paragraph after the Heading 4. Instead of typing your level-4 heading there, Insert
>Cross-reference
, Cross-references
tab, Type Headings, select the target one and Insert reference to Reference.
Of course, the paragraph type in the frame must not be Heading 4 to avoid the problem.
I also recommend you create a dedicated frame style for all your side-headings because the frames have all the same properties.
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!
In case you need clarification, edit your question (not an answer which is reserved for solutions) or comment the relevant answer.