Custom text on same line as index/TOC entry?

Is it possible to manually add text to an index or TOC entry, on the same line, with different custom text for each entry? I am able to add text in the field area, but when the index is updated the entered text disappears.

Edit: Here is an example of a very basic Index with fields for chapter no. and entry:

[chapter no.] [entry]

What I would like to do is add text after the entry (as commentary, e.g.) on the same line. At the moment I can enter text but when the index is updated the text will disappear.

Any advice appreciated. I have also tried making an index with ‘references’ to the chapter and manual text added after. The problem with this is that fields cannot apparently be sorted. So if I move the chapters around after they will be in the wrong order.

LibreOffice 6.1.4.2 on Windows 10.

Edit 2: Attached example

Example TOC.odt

Could you clarify and give a more explicit example? TOC and index are handled quite differently, so be specific. Don’t forget to mention LO version and OS.

Please provide this additional information editing your question (not using an answer).

PS: don’t hesitate to use double-Return to create a line break while formatting your question.

Still not understanding what you intend to do. Please attached a reduced version of your file to your question.

When you update your TOC, the whole document is scanned to collect th Heading n paragraphs and the TOC is rebuilt with this collected data. Consequently, any previous addition to the TOC is wiped out.

Consequently, if you want to keep your annotations, they must be part of the collected data. Here is a suggestion.

Write you annotation in the Heading n paragraph, right after what is the “official” heading. You need then to make this annotation invisible. For that, create a character style with the following property:

  • in the Organizer tab, give it Name "Annotation* (or any name meaningful for you)
  • in the Font Effects tab, select Font color the same as the page background, usually white

Style all your annotations with this style. They become invisible.

When Heading n are scanned, only text is retained, all styling is removed; thus, the annotation is “promoted” to the same status as the real heading.

To edit your annotations, temporarily modify the Font color in the style. The annotations become visible again. When done, reset the Font color to the background.

Note 1: this trick is incompatible as is with a Heading n background color and needs adaptation in this case.

Note 2: I noticed that the structure of your TOC is E# E without separator between the fields. Either enter a space in the text box between them or add a T tab field. This will avoid your manual TOC editing to separate the entry number from the heading.

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!

Thanks for your help. It has solved the problem as I explained it, so I will mark this solved. Hopefully it will be of use to others. However, I didn’t explain the specifics of my problem clearly enough. What I really want to do is make annotations to an index after the index entry. The hidden text solution presumably wouldn’t work for that as the annotations couldn’t be hidden as easily in a body of text? I genuinely appreciate the expertise and advice. Have a good Christmas!

Is your question really about index entries? Contrary to TOC entries where there is a one-to-one correspondence between heading and TOC entry, index tags are merged into a single entry followed by a list of pages, i.e. a many-to-one relation. Describe your intended result in the index and I’ll try to design a solution.