Table of Contents with only specified headings using legal numbering

I have a document with legal numbering. I would like to get the Table of Contents (TOC) shown below. The key point is that all of the level 1 paragraphs but only some of the level 2 paragraphs are to appear in the TOC.

(I do know how to generate a TOC with all Level 1 paragraphs, or all Level 1 and 2 paragraphs.)

My requirement is that not all of the level 2 paragraphs are to be shown in the TOC, only the ones described as ‘sub-headings’. I can’t find an way to define the second level “headings” differently from the second level “paragraphs”, so that only the former appear in the TOC, yet both continue with the legal numbering in the body of the document.

I feel sure its to do with Style definitions, but I can’t seem to figure it out.

Document Body with legal numbering

1. First Heading

1.1 A paragraph with some text

1.2 A paragraph with some other text

1.3 Another paragraph about something

2. Second Heading

2.1 A sub-heading

2.1.1 A paragraph about something

2.1.2 Another paragraph about something

2.2 Another sub-heading

2.2.1 This paragraph describes something

2.2.2 Another paragraph describing something

3. Third Heading

3.1 A paragraph of text

3.2 Another paragraph of text


Table of Contents (desired)

1. First Heading

2. Second Heading

2.1 A sub-heading

2.2 Another sub-heading

3. Third Heading

This is tricky but do-able since you request only 2 levels in your TOC.

From your specification, you want to exclude some level-2 headings from the TOC. This implies that those “not headings” are not styled Heading 2. Design a similar-looking paragraph style with all the visual properties of Heading 2 but without outline level attribute:

  1. right-click on Heading 2 in the paragraph style side pane and New
  2. name it Not Heading 2 (or any name of your liking)
  3. OK

This new paragraph style is a clone of Heading 2 and will inherit all settings from Heading 2. So, any change you make in Heading 2 is also forwarded to Not Heading 2. Only the outline level is not inherited.

Numbering of your “non-headings” will be done with field insertion in a manner parallel to captioning. Either create your “non heading” or put the cursor at head of an heading to be transformed.

  1. style the paragraph as Not Heading 2
  2. with the cursor at start of this “non-heading”, Insert>Field>More Fields, Variables tab
  3. Type Number range, Select Text, Format choose one identical to your chapter numbering
  4. Numbering by Chapter Level 1 (this is the important point, where the trick lies)
  5. Insert

See the example file Partial TOC.odt (16.8 KB).

Limitation:

This will work if you don’t mix headings and non-headings in the same chapter.
The reason is the use of 2 independent numbering sequences (chapter numbering and Text). Consequently, a chapter is entirely made of sub-headings or (exclusive) entirely of non-headings.

EDIT 2023-10-27
This limitation can be partially lifted. You can set Level to 10 and numbering will auto-adapt to current outline level. Of course, the “non-heading” item can only be a leaf in the chapter structure, i.e. all preceding levels must be real headings for the number to be consistent.

Thank you, that does indeed work.

However, manually inserting the field for the number at the start of each ‘non-heading’ is rather laborious. I have only a few headings but many ‘non-headings’.
I’ve attempted to get the number into the non-heading style (in addition to having it in the Heading 2 style), but it seems I can only have one style per level of Chapter Numbering. Is there any other way to achieve this?

Yes, write once a non-heading with empty title. Select it, including the paragraph mark. Make it an AutoText and give it a “name” like NH2.

When you need such a non-heading, type “NH2” followed by F3.