"Text Body" style showing up in Table of Context *sometimes*

I am using LO Writer 6.4.2.2 and I have a table of contents which is fairly well customized. I am not using Heading 1, etc. but rather my own styles. Everything was working fine, until I got some strange results.

Basically, each chapter starts with a Chapter Number which is followed by a Chapter Title (these are the names of the styles). After Chapter Title comes Text Body. This is true in all chapters except the first one which is Introduction. It has a Chapter Name but no Chapter Number (I have played around with this and adding a Chapter Number before the Chapter Title does not fix anything).

So, in the introduction, after the Chapter Title, there are Text Body words, like the other chapters. However, the Text Body words in Introduction actually show up in the Table of Contents. This behavior is not repeated in other chapters, just the Introduction.

I have tried changing styles in various places to fix the problem, but I have not found success.

Could anyone help me identify why this problem is happening (or better yet, how to correct it)?

The file in question is attached here: BrokenToC.odt

To attach the file, edit your question and use the paperclip tool.

Thanks. I’ve attached it.

Nothing serious in your document, just some direct formatting left over from your prior experiments.

Your paragraphs “Even more fun text.” and “Yes, still more fun.” are both styled Text Body but when you look at their Outline & Numbering tabs, you see they are assigned to Level 1 outline level while the paragraph style says Text Body.

This comes from a direct formatting and illustrates the dangers and pitfalls of direct formatting. You have four layers of formatting in Writer:

  • the deepest level is Tools>Options and by extension Default Style paragraph style (this one reason among many why you should not use Default Style in any decent document – look at your title page, you use it; be prepared for formatting surprises)

  • next paragraph style

  • then character style

  • shallowest is direct formatting

Each layer overrides the underneath ones. Changing attributes in one layer has no effect on the other layers. This is why changing paragraph styles attributes will not be reflected if the same attribute is set in direct formatting.

Fix: select all your text and Format>Clear Direct Formatting or Ctrl+M. If you lose some formatting in the process, then you used it instead of character styles. Create the ones you need or customise built-in character styles.

Morale: either work exclusively with styles so that your styles control every aspect of your formatting or work exclusively with the prehistoric method of direct formatting, but never mix both or you’ll experience the kind of inconvenience you complained about.

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) or comment the relevant answer.

Thank you so much. It really helps to know these details. They make sense but I would have never guessed them without your answer.

thanks for this post - I didn’t think I was doing any fancy formatting, but I had the same issue with my ToC. Selecting all my text, clearing the formatting and recreating the ToC was the solution - yay!