Bug in Table of Contents?

My Table of Contents is behaving strangely. I don’t know if it is due to a recent update, or a bug, or something I broke, or what. This is what’s happening:

I have a document with custom styles. The style customizations are modest: A third party, Free Open Source Font, (Cormorant and a few variants, to be specific), Font size, and some modest spacing changes. The custom heading styles were appropriately assigned in the TOC properties and saved. I also modified the TOC appearance style as well.

Initially, when I added new sections, using the appropriate heading styles, then manually updated the TOC, the table would update appropriately. This worked fine, until recently.

After applying the very same style to a new section header, the TOC does not update after the usual manual ‘Update Index’ operation. The little shaded bar that precedes the other headers does not appear in the new section title as they do in the other sections.

However, and this is why I believe a bug may be in play:

If I copy the the beginning part of an already indexed section that includes the little shaded part, then paste it into the new section title – after changing the text title, the TOC will update properly when I perform the ‘Update Index’ operation.

It’s the exact same header style. The only difference is that the shaded bit, (probably an index marker of some sort), is not being added.

I don’t know what changed. But TOC is no longer working the way it’s supposed to. I tried recreating the TOC, as suggested in another thread. I even temporarily changed the write protection in Options. Those didn’t work. (I changed the write protection back after the experiment.)

Is anyone else having this issue?

Here are the version details:

Version: 7.4.1.2 (x64) / LibreOffice Community
Build ID: 3c58a8f3a960df8bc8fd77b461821e42c061c5f0
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: Skia/Vulkan; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Can’t tell without looking at the document. Reduce it to a size compatible with upload limit but still exhibiting the issue and attach it to your question. (Please edit it to attach instead of adding an extra comment; it is simpler for contributors to have everything in a single location instead of being forced to hunt for information through myriads of posts.)

In case you think contents is private, send it to me through private mail. For that, click on my name then on the Message button.

Thanks for your offer to help. Unfortunately, the contents are proprietary and it would not be appropriate to disclose it at this time. However, a friend of mine just suggested to me that I create a new document with the standard styles to see what happens. They work.

Then I created another new document and imported the custom styles from the broken document. They don’t work.

With this new information, I believe my custom styles, or other document property has been corrupted. I will attempt to recreate the entire document, with brand new custom styles later this evening. I will update the community with the results.

Thanks again for your offer to help.

Please upload a small, ODF type sample file here.

Using “heading” styles (those used in an index) in headers/footers looks suspicious by itself… Or what “section” and “header” terms could mean in this context?

Your suspicions were correct. After my little test where I imported the broken styles to a brand new document, as I posted above, I discovered that my styles were not only a mess, but were being incorrectly applied, viz., the Table of Contents – a result of me misunderstanding how styles work and how TOC uses them. Many mistakes were made. In short, there is no bug. I simply broke the document with my incompetence.

I have created a brand new document. Prior to copying any text over, I investing my time creating new styles ahead of time, in a hierarchical format – preserving the parent style in its default state. I simply assign those custom Heading Styles to the appropriate sections titles. My TOC now works fine. I also created other custom styles under the Text Body parent style – and frankly, the document now looks a lot cleaner.

As I previously stated, I cannot disclose the contents of the document I am working on. But I can provide a snip of my new styles set up. (I hope I uploaded the snip correctly. I’m limited to just one snip.) Note: The names inside the parentheses indicate the ‘Next Style’. The numbers are the font size. I’m going to guess that even this setup is not standard. But I think it’s a step in the right direction in my education. As for the broken mess of the original document, it’s best that it be forgotten.

I see several mistakes on your way of organising your styles. Ultimately consistent use of styles separate documents contents from appearance.


This is only possible if styles are used to mark up or tag the semantics of the underlying paragraph. For example, a level-1 heading can have only one semantic significance. It can’t be split into Heading 1, H1 Centered, H1 Centered Justified, … otherwise it is not simply a heading. Note that your style names describe the appearance instead of the significance, making impossible to tune this appearance by using a contradictory attribute.


If you really have different values for level-1 headings, is your current structuring for the document adapted to its purpose? Technically, it is possible to achieve it but you won’t be able to consistently number the headings with Tools>Chapter Numbering because you can have only one style per level. Keeping your current organisation means you must drop Tools>Chapter Numbering and manage yourself numbering and TOC collection through some dedicated list style.


Another serious problem is the link you create between two paragraphs of different semantic values. The fact that H1 C J or H1 C J U is followed by one of your Text Body variants doesn’t change the significance of the heading. You needlessly create complication in your document. The sole purpose seems to benefit from the automatic style assignment when you hit Enter. But, for that, you have to select an adequate H1 style. Equivalently, you can delay this choice to the use of Text Body. Some number of steps are required, just at a different moment in time.


Your routine calls for the multiplication of styles without semantic necessity. From my experience with very complex documents, ~15 paragraph styles, ~15 character styles, 3 pages styles for chapters and a few others for non-chapter parts, ~3-4 frame styles and 2 list styles should be sufficient in all cases.


With a correct semantic mark up (styling), you can drastically change the appearance of the document in a matter of seconds. But don’t limit yourself (and don’t confuse yourself) by describing the look of the style in the name. Use rather Comment, Description, Explanation, Hypothesis, Question, … for names.