excluding levels from the document TOC

Everything related to our flagship word processor.
Post Reply
shmuel
Posts: 13
Joined: 2019-10-18 06:55:45

excluding levels from the document TOC

Post by shmuel »

My document has 6 levels of headings, and each of them is included in the Table of Contents. So far, so good: in the Navigator, it's nice to see all levels and be able to collapse and expand them as needed.

Now in the printed TOC (i.e., the one I'll insert at the beginning of the document), I'd like to be able to exclude certain levels of headings shown, e.g. levels 4 to 6, so that only levels 1 to 3 will be shown. At the same time, however, I'd like to keep the Navigator TOC complete.

Is it possible to have both sets of TOC – one to insert in the document, one for the Navigator?
User avatar
phspaelti
Posts: 1256
Joined: 2007-02-07 00:58:12
Location: Japan

Re: excluding levels from the document TOC

Post by phspaelti »

As far as I can see, this does not seem to be possible.

A possible workaround is as follows:
  1. Save the styles relevant for the TOC in a style sheet called "Full TOC".
  2. Remove the "include in TOC" from levels 4-6.
  3. Save the relevant styles in a style sheet called "Short TOC".
  4. Now you can switch between the two types of TOC easily by using import from style sheet, and then overwriting the styles
Note also that since the TOC does not update automatically, if you insert the TOC using the "Short TOC" styles and then switch back to the "Full TOC" styles you will in fact have what you want until you need to update the TOC again.
philip
shmuel
Posts: 13
Joined: 2019-10-18 06:55:45

Re: excluding levels from the document TOC

Post by shmuel »

Thank you Philip, that is clever and makes sense!

Shmuel
User avatar
martin
Official Nisus Person
Posts: 5119
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: excluding levels from the document TOC

Post by martin »

Philip is correct that there's no built-in support for this, but as he mentioned there are ways to workaround it if you really want. All the same I'll consider your post here as a feature request, thanks Shmuel!
ThosGreen
Posts: 9
Joined: 2021-09-15 03:28:09

Re: excluding levels from the document TOC

Post by ThosGreen »

I would also like to be able to exclude ToC levels in a simple way. Surely can't be hard to implement?
adryan
Posts: 492
Joined: 2014-02-08 12:57:03
Location: Australia

Re: excluding levels from the document TOC

Post by adryan »

G'day, ThosGreen et al

I think there is a simple way to do this.

(1) Select your Table of Contents.
(2) Use Find/Replace to replace In Selection all paragraphs having the desired property (eg, Paragraph Style "TOC 2") with nothing. In PowerFind Pro the Find expression would be ".+\n" (without the quotation marks). You select this expression in the Find window and use Format > Paragraph Style > (desired Style). Multiple such expressions (each relating to a different property; eg, "TOC 2", "TOC 3", "TOC 4") could be separated by the "|" character in the Find window. The Formatting Sensitive checkbox needs to be ticked. Leave the Replace field empty. The process could be Macroized if desired.

The result is that the TOC is culled appropriately, but the relevant Styles remain elsewhere in the document and are still visible in the Navigator. The full TOC can be rebuilt at will.

You don't have to use Find/Replace: you can simply delete any unwanted entries (which may or may not satisfy some set of criteria) from the TOC manually without affecting the structure of the main document (apart, perhaps, from page numbering, if page numbering inclues the TOC and the culled TOC occupies fewer pages than the original).

Cheers,
Adrian
MacBook Pro (M1 Pro, 2021)
macOS Monterey 12.6
Nisus Writer user since 1996
fgvs
Posts: 23
Joined: 2015-12-21 07:46:31

Re: excluding levels from the document TOC

Post by fgvs »

@Martin: Yes please!
Post Reply