Number Range is not intended to number “lists” but to number drawings, figures, images, … It is in no way a means to interfere with chapter numbering.
The Numbering by Chapter parameter provides a way to alter the number in order to “integrate” it with chapter numbering. When you enable it, chapter number up to the requested level is prefixed to the number range. It also tells the number range is reset whenever the designated level changes (which is also implied for lower levels per definition of chapter numbering behaviour).
Your problem is not to number your headings but to prevent some of them from being retained in the TOC. This is completely different. Your specification lacks an important requirement: should this “omitted” heading be numbered in continuity with the others (thus creating “holes” in the TOC) or can it be unnumbered, out of order, …?
I assume your question is not simply to restrict the TOC to the first n levels but you want some Heading 2 be omitted from TOC while all others are included. The “simplest” solution I think of is based on cross-reference insertions and one character style for the “omitted” heading.
EDIT 2023-01-02
Solution to drop “trailing” headings from TOC
From a long exchange through comments, it appears that OP’s specification may be summarised as follows:
- headings are numbered according to their level, without exception
- in the part defined by a Heading m up to the next Heading m, there are Heading m+1 headings to subdivide the part (and possibily deeper headings)
- it is requested that the last k Heading m+1 are not collected into the TOC while all those preceding are collected into the TOC
The difficulty comes from the fact that Heading m headings are treated differently inside the same level.
What is needed?
- the unaltered Heading n so that chapter numbering is not tampered with and behaves normally
- a clone of Heading n; call it Heading n No TOC
You create it by right-clicking on Heading n in the side style pane and coosing New
. Don’t modify anything (so that any change you make to Heading n is also propagated to this new style. Just go to Outline&List
to make sure the paragraph style is attached to Outline level Text Body
- a character style named Invisible
The only attribute you set is Hidden in Font Effects
tab.
Procedure
When you want to insert a “not-in-TOC” heading
- type it as usual
It will get its number as expected
- select the whole heading and apply character style Invisible
To avoid losing visibility and editing possibility, it is highly recommended to enable the view hints Tools
>Options
, LibreOffice Writer
>View
: in Display fields, tick Hidden text
- to make the “not-in-TOC” heading reader-visible, use a Heading n No TOC paragraph immediately below the now hidden heading and fill it with fields
-
Insert
>Cross-reference
, Type Heading, Selection your heading, Refer using Chapter
- type the same separator which follow the heading number (space, tab, newline, …) so that your fake heading will have the exact same look as the hidden one
-
Insert
>Cross-reference
, Type Heading, Selection your heading, Refer using Referenced text
Operating considerations
You say the recipe will be put into the hands of ordinary writers.
Create a template file where all styles can be stored and made available to any document based on the template.
The three steps may look tremendously ununderstable to the majority of your authors which are probably totally unaware of styles and likely direct format their documents. Here direct formatting means failure.
So create an auto-text with dummy heading contents. The whole construct invisible fake heading, cross-referenced user-visible heading and a Text Body empty paragraph can be generated by AutoText.
You just have to tell your people to fully select the “invisible” heading (it displays with a dotted underline) and to overwrite the real heading contents. The user-visible heading is automatically updated.
Don’t hesitate to ask for clarification or improvement.