How to include List/numbering in Table of Contents

I’ve wrote a reasonably long document (35pages) which is numbered 4 levels, to be able to have a nice index, but when I inserted Table of Contents it only displays Heading styles. I later checked and all my list is in the Text Body style, even though it’s a list and numbered and idented.
I tried to include extra style to the Index, but it would only allow me to use Text Body but then it shows all text of the document.
I tried to change a couple of Level 1 styles to be Heading 1 and Heading 2, but then numbering is gone…
Is there an easy way to have included Level 1 and Level 2 list in the Table of Contents. Or I have to line by line and change style?
I use LibreOffice 7.4.3 in Fedora 37

Please edit your question to include OS name, LO version and save format.

What you’re asking for is possible provided your formatted your document not only with styles but also with the method I call semantic styling. In this approach, styles don’t denote typographical or “geometric” properties of your text (though in the end you assign such attributes to styles) but are a consistent mark up for text significance, i.e. paragraphs or sequences with a different meaning or importance are assigned different styles.

From your description, I guess you turned some Text Body paragraphs into list items by using the toolbar buttons. This is akin to direct formatting, i.e. it does not confer “remarkable” mark up to the text which can’t be distinguished from other similarly styled sequences but with a different meaning.

Lists are specific sets of paragraphs which are tagged with a list style (which defines the numbering and controls the indent, taking over what is set in the paragraph style). In the semantic styling approach, a list needs a dedicated list style. And if you have several “independent” lists, i.e. list with different significance, not several occurrences of th same abstract list, you’ll define several list styles.

Inserting extra data in a TOC (in addition to the Heading n family), is different from list creation or numbering. The data can be assigned any paragraph style but this paragraph style must be configured to “advertise” to which TOC level it belongs. This can also be done on styles used in lists but it is a bit more complicated because list styles automatically define multi-level lists while a paragraph style may be attached only to a single level (unless you want all your list items, whatever the level, collected at the same level in the TOC).

For a more targeted help, give an example of what you want to achieve. Describe precisely your requirement. Eventually, attach a short sample file (2 pages max) containing what you’ve already done.

1 Like

Thanks for some clarification. I didn’t find any styles that would have numbering in, so yes I checked bullets and numbering on the first paragraphs and then continue down several layers, and all seemed to be nicely formatted, but now seem impossible to add it to ToC. Following is an excerpt from the document which i save in .odt format. The 1st line is “Heading 1” then all others are “Text Body” style. I would like to have level 1 (X) and level 2 (X.Y) listed in ToC

Content:
Run down of lectures:
     1. Introduction to Level 2 course and short overview of the coming subjects
         1.1. Intro and my bio
             a) Ability to influence can be ability to inspire, ability to inspire can be ability to heal
             b) 15+ years in Domancic Method
             c) Professional Sportsman
             d) Teacher, Consultant
             e) Guide
         1.2. List of subjects in this course
             a) DAY 1
                • Intro to Level 2,
                • Overview of Level 1,
                • Psychosomatic and Symptoms,
                • Distance Therapy,
                • Workshop
             b) DAY 2
                • Psychology of Clients,
                • Pathological Influences - Technical,
                • Pathological Influences – Geopathic,
                • BioTherapy for Animals,
                • Workshop

I think your a), b), c), etc. lines also belong in the document outline and should be styled Heading 3. With Tools>Chapter Numbering, you can choose and alphabetical “numbering” with a “)” after separator.

Similarly, your bullet points can be styled Heading 4 but there is problem: Tools>Chapter Numbering doesn’t allow bullets for the number. However there is a workaround. Define your level 4 as unnumbered and set the bullet as the after separator.

Fully relying on the Heading n family is much simpler and reliable than tentatively configuring a multi-level list (and I’m at super-expert guru level about Writer styles) and you avoid the real complications to insert a list (and worse, a multi-level list) into the TOC.

As a general rule, try to design the simplest structure for your document. The fewer complex features you use, the better you feel and the more stable your document is. And, of course, save .odt.

1 Like

Thanks for a tip. If I define numbering for Heading 1 and Heading 2, it will still use numbers 1,2,3 in heading 2 rather than 1.1, 1.2, 1.3… ?
So I assume if I define chapters with numbering, then I have to go and select each line to change it to proper Heading?
My goal was to make it as simple as possible, so I just added numbering, but didn’t realize it wouldn’t show up in ToC.

Aha I figured to use sublevel of 2 and will show 1.1, 1.2, 1.3.

Tools>Chapter Numbering is your friend. You can configure each level independently from the others. You can make a consistent global set or, at the opposite, a completely crazy illogical inconsistent numbering. It’s up to you.

1 Like

Thanks, I’ve managed to format it to my liking.
btw is there a way to select all level 1/2/3 numbering lines? Not clicking each line to change it to different Heading

Be more specific. Do you mean paragraphs assigned to level 1-3 in some list? If so, no. All the more since your applied Format>Bullets & Numbering to “ordinary” Text Body. This is why semantic styling is so important in document maintenance et reviewing.

For Heading 1 paragraphs, use the Navigator. You can quickly jump to any heading by double-clicking on its name. To change the level without assigning a specific Heading n, put the cursor at the very beginning of the heading and use Tab for one level deeper or Shift+ Tab for one level shallower. Multiple presses for more levels.

1 Like

I assumed it would have to be done manually to select individual lines or each level of numbering and define them as particular Heading.
What I noticed also that having them defined as headings, and pressing at the end of line of say Heading 3, it will jump to Text Body and even clean out page underneath, and put all lines bellow to a new page. That is not very useful behaviour, as I will have to define Heading level every time I press enter (want to make another point). Though, at least at current headings Tab and Shift+ Tab go down and up the levels.
Probably there is some settings what is next line after each Heading level

Here, you seem to use Heading 3 or Heading 4 as a corner case. You think of them as members of a list (this is perfectly legitmate anyway) and not as headings preceding a sequence of contents paragraphs.

In this case, untick Keep with next paragraph in Text Flow tab of the offending style(s) so that it does not force a page break to keep it with the next paragraph which is not an elaboration on the “heading”.

1 Like

Yes you are right normal behavior would be to have a Heading and then normal text in next line. So maybe using Headings aren’t the best way go around this. Do you think I should use some other styles to be more appropriate for being numbered and could also be displayed nicely in ToC?

As I have issues to have proper ident in Level 4 which is very close to numbering whereas Level 3 is maybe even too far. I didn’t find any settings where the 1st line of text starts. I tried Tab stop at in Tools=>Chapter Numbering but it moved a little up to some point but then when more that 1.5cm no change.

This helped to get rid of new page after entering new line, but still new line is Text Body style.

You can use Heading n in this atypical case and it is probably the simplest way to do it.

As already mentioned, to make your level 4 akin to a common list item, untick Keep witn next paragraph in Heading 4 Text Flow tab. And possibly also in Heading 3 if you use it as a list item.

Once again, Tools>Chapter Numbering is your friend but Position tab this time. Long story short:

  • set Tab stop at and Indent at to same distance
  • keep Numbering followed by Tab stop
  • position of your bullet is controlled by Aligned at

To sum up: set Aligned at where you want your bullet; set Tab stop at and Indent at (same value) further away to the right to start your list/item/fake heading. Indent at guarantees that multi-line items align nicely with the first line (with the bullet outdenting on the left).


PS: screenshots have practically no value to diagnose a problem, all the more when View>Formatting Marks are not enabled.

That’s part of automation with Heading n. Here you have a non-standard usage for Heading 4 which is used to create a list. Effectively, when you start a list, you implicitly expect it continues until you decide to end it. To fix this behaviour, customise Heading 4 Organizer tab, to change Next Style from Text Body to Heading 4 (continue on same style).

1 Like

Tab stop doesn’t seem to have any effect on indent I modified vales from 1-4cm and all lines in Heading 4 stay with the same ident

Indent at implicitly defines a tabstop. So, in your configuration above, you have 2 stops: 2.
0cm and 3.0cm. When the tab stop after the numbering is taken into account, it requests moving to the next stop, which is here the one at 2.0cm.

Tab stop at will take over only if is located before Indent at, i.e. smaller than 2.0cm.

This is why I recommend to set it equal to Indent at, which is what most people want. Don’t put it at 0cm in the hope to silence it. This causes other unexpected results. A smaller value than Indent at is equivalent to a negative First Line Indent in paragraph styles. This is possible but the aesthetic outcome is ugly when the heading/list item is multi-line (personal taste, you may disagree).

1 Like

Still how come Heading 3 has such an ident, and Heading 4 less

f) Bugs
• Help “good ones” bees, butterflies
8.3 Categories of animals and approach
a) Own pets/domestic animals - easy
b) Others Pets
c) Others Domesticated Animals
d) Random Animals
8.4 Prior knowledge and skills for animal treatments
a) How to approach animals

and no horizontal indent is defined in the Heading 3 or Heading 4 style settings. Not sure Where it gets this idents from.
What is the best way to show then excerpt from the document if not screen shot? Is there some formatting as “Writer” possible in the message?

Tools>Chapter Numbering defines a list (with additional properties compared to ordinary lists). In every list, indents are taken over by the associated list style, here Tools>Chapter Numbering.
Don’t try to modify Before text and First line indent in the paragraph style if is associated with a list style. At best, you create a mess; at worst you crash Writer or damage your document.

When a list is concerned, indents are defined in the list style Position tab.

Attach a sample file using the “Upload” tool icon (the one looking like a mail basket with an up-arrow).

1 Like