Exported PDF is missing heading bookmarks if headings uses numbering with no more content after the number

Hi, in my document I’m using a custom Numbering style that puts the text “Chapter n” for each heading with n being incremental after each use of the heading.

However when I export to PDF the bookmarks to the heading are missing, if I add a comment (or a single character) at the heading then the heading bookmark appears again. Why is that?

I’m not sure if this is intended libreoffice beavhoir or a bug, it looks pretty random. I’ll put here an example document and try to export to PDF and get the bookmarks working.
example.odt (9.2 KB)

This is my exported result, You’ll see only the heading with the comment has the bookmark.
example.pdf (10.9 KB)

I’ll wait for an answer, ask if something isn’t clear.

  • In my older posts I’ve got some users tell me to not use custom heading, which I use in my and the example document. The reason being that with a custom heading I can edit the numbering style, default headings have that option locked.

Version: 25.2.5.2 (X86_64) / LibreOffice Community
Build ID: 03d19516eb2e1dd5d4ccd751a0d6f35f35e08022
CPU threads: 12; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: it-IT (it_IT); UI: en-GB
Calc: CL threaded

I looked at your .odt.

Your “chapter” lines are not headings from Writer point of view. There are "simple list items. Therefore they will not be captured into the TOC bookmarks in the PDF.

This happens not only in PDF.

Most people don’t read manuals and even don’t think for 2 seconds about the specificities of a document processing program. They use it “intuitively”, just like they would a typewriter. A mechanical typewriter is a dumb tool with which everything is done manually, in particular vertical spacing. A document processor is much more powerful but needs a minimum of mark up to understand author’s intent.

As I mentioned, most people don’t realise that any paragraph is modelled according to a box concept providing spacing on all four sides. This spacing is an intrinsic property of the paragraph category (heading, narrative, note, …), eliminating the need for manual spacing.

Since this bas habit is extremely common, M$ Word, rather than educating its users, “fixes” it by applying “pragmatic” rules, unfortunately causing these bas habits to persist. LO Writer has adopted these “fixes” as “compatibility” rules with M$ Word on crowd request.

Your “headings” are “empty” paragraphs: they have no explicit contents. The number is the result of list style application and does not count as contents. The compatibility rules eliminate “empty” paragraph from TOC (and others) scanning.

The workaround is to force at least a space in your heading. I don’t like this idea but the paragraph is no longer “empty”.

When you attach a comment to your paragraph, it is not empty, though this contents is “non-text” (i.e. it won’t print in the main flow).

If you want to have fully customised headings, you must first understand how the heading machinery works. This is quite complex. My recommendation is rather to customise the standard Heading n styles and the internal protected list style.

Access to the internal list style for headings is Tools>Heading Numbering where you find everything similar to usual list styles (and more because you can associate a specific paragraph style to a level).

What option locked? The options in Tools > Heading Numbering are not more limited
HeadingNumbering