Creating table of contents starting from level 3 (sub chapter)

It seems to me that it is not possible to create a ToC starting from level 3 (sub chapter). The feature is currently limited to level 1 (Entire document) or level 2 (Chapter) in the Edit Index > Type > Create ToC for… contextual menu of the table of contents.

Anyway I submitted the following request for enhancement:
https://bugs.documentfoundation.org/show_bug.cgi?id=130318

Does anybody have an idea to circumvent this limitation in the meantime?
I attach an example file of what I mean.

ToC for lower level Headings proposal_00.odt

Apart from manual editing the “partial” TOCs (right-click and Edit Index, uncheck Protected against manual changes, then deleting the offending parts), I don’t see an automatic solution presently. If you have many such TOCs, it becomes quickly tedious and impractical.

I have many of them. I am currently updating them one by one… You are right, very impractical.

A workaround that I just used:

  1. Look for the paragraph style of level 1
  2. Select your table of contents
  3. Search for the style in the selected area
  4. Replace with nothing
  5. Repeat from step 1 until reaching desired level
  6. Delete the empty paragraphs

@LeroyG Your workaround gave me an idea.

It looks, first, that there is now an improvement in 25.8.4.2 (I don’t know in which release it appeared): a Chapter TOC starts collection at current level.

Generally such a chapter TOC is inserted immediately after the chapter heading and I prefer not to repeat this heading.

Since I don’t like to tamper with generated contents because the manual operation has to be repeated every time contents is refreshed and I can forget it, I looked to see if I could simulate erasure with proper style configuration. The answer is yes.

I create a paragraph style with name Erasure. It is configured with Hidden attribute in Font Effects. To be on the safe side you can also set spacing above and below to 0 and font size to 2pt (the latter is not necessary).

When you insert the TOC, go to Styles tab and assign Erasure paragraph style to the to-be-eliminated levels.

On screen you can still see the paragraph (if you enable viewing hidden text as I do), but Writer never renders fully hidden paragraphs to the final output. You can check with print preview.

You do it only once. Hidden levels can be changed with a right-click on the TOC and Edit TOC: modify the style association.

1 Like

Maybe related to tdf#104182.

Do not create the ToC from “Headings” but from “Additional Styles”. There you can select which Heading style is shown on which level in the ToC. Thereby 0 means, that it is not shown at all.

ToC for lower level Headings proposal_01.odt (94.0 KB)

This setting is useful for the global ToC too, in case you have an appendix, that has not “Heading1” because you want a different numbering than the ordinary chapters.

Oh, I see. ¡That’s great!
imagen

Edit Index (right click on TOC)

Ignore the box that says “For:” to the right there is another box that asks you to choose a level. Use that one.

No, this setting will limit the maximum level but does nothing on the minimum level.

The point in the original question is to collect only the elements (headings) relative only to the heading subtree of the present location. The current TOC engine collects everything, without consideration of the location of the TOC in the logical structure of the document.

1 Like