Inserting a Table of Contents (TOC)

The option "Insert" > "Table of Contents…" builds a table of contents (TOC) automatically and inserts it at the text caret.

This operation works by finding all the headings in your document that use a Heading text style (Heading 1, Heading 2, etc.). It won't find headings that you have formatted manually, for example by just making text bold - you must have a heading text style applied to the headings. When you invoke this operation, the following dialog appears...

Table of Contents dialog

Level

This lets you choose which headings should be included in the table. If you only want your top level heading (usually Heading 1) to appear in the TOC, set the level to 1. The default is level 3 so that's Headings 1, 2, and 3, although you can go right up to level 9 if you really need to. The table of contents indents each heading according to the heading's level, so you get nested headings.

Use common website link colors

Each entry in the table of contents is linked to the appropriate heading in the document. So this option lets you choose how the links appear in the table. If selected, the links will use the document's link colors, as specified on the Website tab of the "Utilities" > "Web Properties" dialog.

Include page numbers

Select this option if you want to include page numbers in your table. The page number style is chosen to match the style of page numbers you have in the same document, if there are any. Otherwise it uses the default number style. The table includes tab stops on each line so that the page number appears over near the right edge of the text column or area.

Tab Character

You can set the tab character and spacing between the tab characters here for each tab level. These values can also be changed in the tab stop properties dialog.

Spacing

You can set the tab character spacing here. These values are in em. If you need more precise controls, you can use the Tracking control on the text toolbar.

TOC Text Styles

When your table of contents is generated, a new text style is created for each level of heading included in the table. TOC1 for Heading 1, TOC2 for Heading 2, etc. These styles make it easy for you to customize the appearance of your table.

By default each of these styles is based on the Normal text style, so the table text should look like the main text in your document. To change the style of any level within your table, just make the change you want to one of the headings in your table, then select the Update option in the text styles menu to update the TOC style for that level of heading.

See Text Styles for more info on applying styles.

Updating a Table of Contents

As you update a document, adding and removing headings, you will soon need to update your table of contents. To do this place the text caret anywhere in the table, right-click and choose "Table Of Contents" > "Update". The table is updated, while preserving any changes you made to the TOC styles.

Changing properties or removing a TOC

The right-click TOC context menu also includes a Remove option, for removing the table. It also has a Properties option, which brings up the same dialog you used to create the table. This allows you to change the properties of an existing table, for example to turn page numbers on or off.

 

Copyright © Xara