TOC in alphabetical order

Everything related to our flagship word processor.
Post Reply
itisi
Posts: 1
Joined: 2018-05-26 20:48:15

TOC in alphabetical order

Post by itisi »

is there good way to do this ? when I rearrange them, the formatting is removed.
I can manually add hyper links to bookmarks but it becomes a bit ugly when exporting to pdf / html.
and the text is hard to edit because it is a link.
I would like to have the same formatting as the page order TOC
(with just the page numbers a link and plain text description but still clickable in pdf and Epub)
thank you, this is a great word processor
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: TOC in alphabetical order

Post by Þorvarður »

Hi,
is there good way to do this ?
You can do this very easily if you use the *index* feature instead of TOC. An index is sorted alphabetically and can be placed at the beginning of a document (or wherever you want.) It can also be formatted in various ways.
I would like to have the same formatting as the page order TOC
Then all you have to do is to select the index, make your Styles palette visible and then click on the TOC 1 style. That will make the index look exactly like a TOC. Use the Paragraph and Character palettes for ad hoc formatting of the index, or create a new Paragraph style for this purpose.

Assuming each of your headings is not more than 40 characters, then you can use this macro to automate the process:

Code: Select all

Find All @Text<^(?:.|\n|\f){1,40}\n>, 'Ea'
Tools:Index:Index
Select Start
Type Text "

"
Select All
Select Start
Tools:Index:Insert Index
When prompted, choose 1 column. The index remains selected so you can assign the TOC 1 (or any other) style to it.
Remember, for quick formatting you can vertically select all the headings in the index by holding down the Option key while dragging with the mouse.
The page numbers should remain clickable if you export the doc as PDF.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: TOC in alphabetical order

Post by phspaelti »

That's a clever approach, Þorvarður!

I was going to write a complicated macro, but the Index should work fine. I would just make a few suggestions.

First, NW allows you to create as many index styles as you want, so you can make an index style for just this purpose. You can then also configure the style to use the TOC style of Nisus. Then when you insert the index, it will already have the desired formatting.

Second, you can attach the indexing to the Heading style(s). That way the headings are automatically included in the alphabetical TOC. So you wouldn't need to search for them and apply the indexing.

Finally a word of caution. Indexing does behave differently from TOC styling. Indexing can be applied to any span of text, but if it's not applied contiguously you will get two entries. Vice-versa if you have two headings with the indexing applied and no intervening text, then the two will be merged into a single index entry. And also if you have two headings with the same text, they will be merged as a single entry in the index with 2 page numbers, or with a span.
philip
Þorvarður
Posts: 410
Joined: 2012-12-19 05:02:52

Re: TOC in alphabetical order

Post by Þorvarður »

Thank you, Philip, for these additional suggestions.

Þ.
Post Reply