Writer 6.4.6.2: Table of Contents bug?

Hi, I created a table of contents according to the instructions here: Formatting an Index or a Table of Contents

Problem is that the hyperlinks don’t appear in the table of contents items.

Is anyone aware of a bug?

I’m using LibreOffice 6.4.6.2 (x64)


Upload of ODF sample:

web-statuten-BDIP-2020.odt

Please upload your ODF type sample file here.

You messed everything while trying to customise the styles. As shown in the Navigator, you have no heading in your document. Let’s see all your errors in order.

##Invalid use of Default Style

All your document is written under Default Style paragraph style (except your “headings”). In Writer, contrary to Word, the “standard” style for content is Text Body. Default Style is a “ghost” style intended to define defaults for all other styles. All styles directly or indirectly descend from Default Style and inherit the properties of Default Style unless you override them.

##Ubiquitous direct formatting

As a consequence of your universal use of Default Style, you manually applied stylistic variations to your paragraphs with the toolbar buttons to create numbered and bulleted lists instead of using a dedicated style. For your defense, the various list styles cannot be used out of the box because they need to be explicitly associated with a bullet or counter.

Direct formatting is the fact to format text outside the style machinery. Though it is fine for experimenting, it is the surest way to bump into formatting hell when time comes to document revision.

Also all your vertical spacing is done with empty paragraphs. Worse, not all these spacing paragraphs are Default Style. One of them in the cover page is Heading 1 (and even 2 if I count the empty paragraph where you anchored the frame wit word STATUTEN). Such vertical spacing should be part of style definition.

Using empty paragraphs makes you vulnerable to various changes, such as margin modifications. This would either push empty paragraphs into the TOC page or move part of the TOC into the cover. Same for what you did at end TOC. To sync with pages, use page breaks.

##Damage on Heading n

You tried to customise Heading 1 and Heading 3. In the Outline & Numbering, you assigned the style to Outline level Text Body which made them invisible to the TOC engine. They should have kept their initial assignment of Level 1 and Level 3.

I suppose you did that because you added bookmarks on all your Heading 3 clauses and you generated the TOC without unchecking Index marks in the Create From section. This resulted in duplicating all entries.

##Messing up TOC generation

Since you removed the outline level from Heading n, these paragraphs are no longer considered when building the TOC.

To compensate you added indexes to your Heading 3 paragraphs and requested to enter them at TOC level 1.

To complicate matters, you tried to assign a specific style to these entries (ending up at level 1) by changing the “standard” Content 1 style to Heading 3. TOC and heading formatting are decoupled through this TOC configuration so that you can have heading formatting in the text (i.e. use bold, big font size, colour, …) and a more “modest” formatting in the TOC. You connecting both formatting which should be avoided.

Your headings were entered into the TOC as index entries. Since the same index label can refer to several locations, Writer does not provide a hyperlink from the TOC index entry back to the occurrence(s) (it doesn’t know which one to point to). Only the TOC outline entries provide hyperlinks back to the headings (a one-to-one correspondence).

You’ll get your hyperlinks once you restore the standard Heading n.

##Invalid use of frame

In you cover page you inserted a frame apparently for the sole purpose of drawing a border around the STATUTEN title. Borders are a property of paragraph styles. You can do that by customising one . I suggest to use Title which is intended for book/document title instead of Heading 1 which is part of the document outline.

Also, frame content is outside the main text flow. As a consequence, if you style frame content with Heading n, the heading may not always be listed in the TOC where you visually expect it.

#Fix & improvements

  • Restore the “standard” Heading n configuration

  • Don’t use Heading 1 for the document title

  • Use contiguous outline level

    There is no point here to have Heading 1 and Heading 3 without any intermediate Heading 2. In this specific case, style the title as Title and all your clauses can be Heading 1 since you have no other sublevels.

  • Remove all your bookmarks and manual hyperlinks

  • Restore the “standard” TOC configuration

This should fix all your issues.

To get the document “Writer-style”, notice it is made of three parts: cover, TOC and discourse. Each part should have its own page style. You switch from one part to the next with a special page break Inset>More Breaks>Manual Break where you specify which page style becomes active after the break. From the built-in collection, I suggest First Page for the cover, Index for the TOC and Default Style for the discourse.

You can even auto-number all your clauses (as "Artikel 99 - ") through Tools>Chapter Numbering where "Artikel " (with a post space) is a prefix and " - " is a suffix to the number (or any other separator) thus eliminating the risk of a duplicate or missing number when you update the document.

And last but not least, download the [Writer Guide](http://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.) and read it.