Sideheads shown at an incorrect level in the navigator

Hello everyone, please see the following sample document. Using LO

I would like to put my level 4 headings in the margin, aligned with the top of the paragraph they are anchored to. I am using frames with a custom frame style “Sidehead frame” and one of the default paragraph styles “Heading 4”.

In the navigator, I would expect those level 4 headings to appear under level 3 items, however they remain at the very top of the tree.

You can also see that a standard level 4 heading inserted in the text instead of in a frame appears at the expected location in the tree, as shown in the following picture.

When exporting to PDF, bookmarks are “mixed up” in the same way. Is there any setting I should tweak to get this working as expected or is it the software’s intended behavior, or maybe a bug ?

Thanks ! :slight_smile:

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.

Thank you so much for the detailed explanations. You second suggestion allows me to get exactly what I want, even though it requires a fair amount of labor : I might automate the process using macros. I can’t get to see the hidden text though, even with the option you mentioned selected. But this is no big deal, I simply get to edit the style every once in a while to show/hide the headers. Thank you very much again !