Is this TOC flavor possible to achieve?

Everything related to our flagship word processor.
Post Reply
fgvs
Posts: 23
Joined: 2015-12-21 07:46:31

Is this TOC flavor possible to achieve?

Post by fgvs »

Hi,

I'm wrapping up a book and would like to achieve a TOC where the chapter levels are as usual, but then the chapter sections are not separated into different lines and are immediately followed by page numbers in brackets. Something like this:

Introduction..............................................2
What (2), Why (6), How (10)

Is this possible? How? Thank you in advance for any clues.

Best,
Francisco
Amontillado
Posts: 41
Joined: 2019-06-20 11:13:06

Re: Is this TOC flavor possible to achieve?

Post by Amontillado »

I don't think Nisus will do this without help, but where there's a will there's a way.

Use Tools->Table of Contents->Insert TOC.

Manually edit the TOC without deleting any page numbers.

As you add and remove pages, use Tools->Table of Contents->Rebuild TOC with the option to only update page numbers.

On a quick test, that worked for me.

The option to only update page numbers won't include new entries, though. If I were using hand-edited tables of contents, I would suffer with what Nisus created until I had a need to share the document. Then I would insert or rebuild the TOC and hand edit.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Is this TOC flavor possible to achieve?

Post by phspaelti »

Basically you have to reformat the lines after you insert the TOC. If you refresh the TOC at any time after that the TOC will be restored to the original version with each entry on it's own line.

The most convenient way to do this reformatting is to use a macro. If you have this as a macro you can run it, each time you update the TOC. I am attaching here a macro that should reformat according to your example. Try it on a copy or a small sample, and see if it doe what you want.
Attachments
Reformat TOC Level 2 to Inline.nwm
(6.82 KiB) Downloaded 105 times
philip
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Is this TOC flavor possible to achieve?

Post by phspaelti »

To Amontillado's point. Once you have the TOC entries on a line, rebuilding the TOC using the "page numbers only" option will not work correctly.
Instead you should always rebuild using the "Update all content" option and then reformat. Which is why you should try the macro.
philip
fgvs
Posts: 23
Joined: 2015-12-21 07:46:31

Re: Is this TOC flavor possible to achieve?

Post by fgvs »

Wow. Thank you, guys.

Thank you, Philip! This macro is exactly what I needed. Redoing the TOC each time I update it was out of the question, but with this bit of magic it became feasible.

Over the last few years, as I worked on the book, I often thought how pleasant it is to use Nisus for the purpose. And, well, this user community certainly adds to that.

Cheers!
Francisco
Amontillado
Posts: 41
Joined: 2019-06-20 11:13:06

Re: Is this TOC flavor possible to achieve?

Post by Amontillado »

phspaelti wrote: 2022-08-10 06:11:32 To Amontillado's point. Once you have the TOC entries on a line, rebuilding the TOC using the "page numbers only" option will not work correctly.
Instead you should always rebuild using the "Update all content" option and then reformat. Which is why you should try the macro.
I made a file with three main TOC entries and five second level entries.

Then I edited the TOC to put the second level entries one one line underneath the main topic they were in. I was careful not to delete the numbers, I left them as whatever code Nisus used to mark them.

After inserting some pages to change the page numbers, rebuilding the TOC, page numbers only, updated the page numbers for all the second level entries.

I'm not saying it's a good idea. If you delete and retype a page number Nisus won't know to update it.

But it really does seem to work. The macro would be a far better solution.
User avatar
martin
Official Nisus Person
Posts: 5227
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

Re: Is this TOC flavor possible to achieve?

Post by martin »

Amontillado wrote: 2022-08-10 16:35:19
phspaelti wrote: 2022-08-10 06:11:32 To Amontillado's point. Once you have the TOC entries on a line, rebuilding the TOC using the "page numbers only" option will not work correctly.
Instead you should always rebuild using the "Update all content" option and then reformat. Which is why you should try the macro.
I made a file with three main TOC entries and five second level entries.

Then I edited the TOC to put the second level entries one one line underneath the main topic they were in. I was careful not to delete the numbers, I left them as whatever code Nisus used to mark them.

After inserting some pages to change the page numbers, rebuilding the TOC, page numbers only, updated the page numbers for all the second level entries.

I'm not saying it's a good idea. If you delete and retype a page number Nisus won't know to update it.

But it really does seem to work. The macro would be a far better solution.
This is definitely a supported workflow. It's the primary reason the "only update page numbers" option exists. If you're careful to edit the generated TOC, so as not to disrupt the specialness of the automatic page numbers, then updating only the TOC's page numbers option should work as desired.

That said, a macro that can process a freshly generated TOC to recreate the desired text is the ironclad solution. It's highly likely that at some point the TOC will need to be fully rebuild to account for textual changes in document headings.
Post Reply