Table of Contents Formatting Shenanigans

There’s some hidden, non-obvious, unintuitive shenanigans going on with formatting for TOCs. When given the option, I choose to format from the source text, since the TOC is generated from that very text, yet the TOC format is not even the same font, despite the fact that my user-defined style is highlighted when I have the cursor within my TOC. I cannot format the Tab Stop “fill character” without the whole TOC going mad and re-aligning and changing fonts.

I find it unfathomable that formatting the TOC isn’t as straightforward as formatting any other text within a document.

Can someone explain this madness to me before I just manually make my own?

Here are just general hints and helps:

English documentation

Index / Table of Contents / Alphabetical Index / Bibliography

Creating a Table of Contents (TOC) in Writer

I find it unfathomable that formatting the TOC isn’t as straightforward as formatting any other text within a document.

Please note that in a properly managed document almost everything has styles.
Place your cursor in the position of the text or table of contents and look in the sidebar at styles, e.g. which paragraph style is displayed.


Try to understand what the developers have come up with for their workflows.

Well, an automatically generated ToC is very different from any other text in a document, which, after all, you actively write. But you don’t write and format the ToC, Writer does that for you. In order to make that work well, the developers invented an ingenious scheme. They defined inbuilt paragraph styles for headings in the body text and the items in the ToC (and also for the items in indexes). And those styles are “linked”. Heading 1 is linked to Contents 1, Heading 10 is linked to Contents 10. So, when you have a chapter title in your document, formatted as Heading 1, Writer will insert a ToC item for that, formatted as Content 1. The Content styles are descended from Default, and the Heading 1 etc styles from Heading, so if you change the font for your headings in the Heading styles and you want the same font in the ToC, all you have to do is change the font in the Content styles.

To be more accurate:

  • all Heading n descend from Heading
  • all Contents n descend from Index

The reason why the Contents n ancestor is not named Content(s) is a TOC is only a special case of an index. Therefore all styles for the various indexes (TOC, alphabetical index, figure, table, … indexes, user indexes) descend from Index.

Set font face in Heading to change all headings and in Index to change all indexes and TOC.

1 Like