Create a Table of Contents in InDesign
For many years, I made the tables of contents for my books manually. I would finish the book and then, one by one, I would open the file for each chapter and write down the name of the chapter, the name of the A Heads, and the page numbers for each. It averaged 200 entries for each book's table of contents (TOC). It was a tedious process, but manageable.
Thankfully, Adobe has since added an automatic TOC feature to InDesign. Its dialog box is a little confusing, but by following the tips in this article, you'll master it in no time.
Benefits of the Automatic TOC
There are several benefits to using InDesign’s TOC command:
• InDesign doesn't make typos. Humans, on the other hand, can easily enter an incorrect page number or entry.
• If anyone makes changes to your documents (a new chapter name or additional pages, for instance), it only takes one click from you to update the TOC.
• When you export a PDF from the document, the page numbers in the TOC are hyperlinked to the actual pages in the document. If you want to go to chapter three, you just click on the page number in the TOC.
• When you create a style for a TOC in the InDesign document, that TOC can be added to an ePub.
Preparing the Document for a TOC
You need a page or two in your document that will hold the TOC. Using the Pages panel, insert those pages (sometimes called front matter) in the front of the book. Then select the page where the TOC will start and choose Numbering & Section Options from the Pages panel menu. In the resulting dialog's drop-down Style menu (Figure 1), choose the appropriate numeral style (in my case, that's Roman).
Figure 1. The Numbering & Section Options allow you to set the front matter where a TOC is located to Roman numerals.
Select the page where the main text starts and choose Numbering & Section Options again. Set this to restart at page 1 (Figure 2); that way you can add pages for the front matter without changing the numbers of my main document. I also changed the style to Arabic numerals (Figure 3).
Figure 2. Use the Numbering & Section Options to reset the main document back to page 1 and Arabic numbers.
Figure 3. An example of how the front matter of a document is numbered with Roman numerals while the main body is set with Arabic numbers.
Understanding the TOC Dialog
While the Table of Contents dialog is complicated, you can figure it out with a little exploration.
To begin creating the actual TOC, go to Layout > Table of Contents. This opens the Table of Contents dialog box (Figure 4).
Figure 4. The Table of Contents dialog box at its default settings.
Setting the Title of the TOC
When you first open the TOC dialog box, the Title field default is “Contents.” I change it to the phrase “In this chapter” to describe the TOC entries I have at the front of each chapter in my Visual QuickStart guides. You can insert any word or phrase that makes sense for your book (Figure 5). If you don’t want any description, delete the default entry. It's very important that you make this — and all subsequent TOC changes — in the TOC dialog box. Any manual modifications you make can cause errors in the automatically generated TOC.
Figure 5 . Fill in the Title field with whatever description you want to head up the TOC.
Setting the Style for the Title
Once you have entered a title for the TOC, you need to format it. Move to the right side of the dialog box and click the Style menu to see a list of paragraph styles in your document (Figure 6).
Figure 6. The Style menu for the Title field of the TOC.
Apply the style for the title. If you haven’t created a style in advance, you can use the New Paragraph Style command at the bottom of the list to create a new style without leaving the TOC dialog box.
Choosing the Entries for the TOC
The entries for each line of your TOC come from the lines of text that have been styled with a certain paragraph style. No paragraph style = no TOC entry. For instance, if you want InDesign to automatically list the pages on which each chapter begins, you must apply a paragraph style to the chapter title, chapter number, or some other paragraph at the start of the chapter. For my books, I tell InDesign's automatic TOC builder to look for two paragraph styles: one that's applied to the name of each chapter, and another that's applied to the A heads (main subsections) of each chapter.
To add paragraph styles as entries in the TOC, simply click the name of the style under Other Styles and then click the Add button (Figure 7). The style appears under Include Paragraph Styles. This indicates that the style will be used as an entry in the TOC.
Figure 7. Click the Add button to move a paragraph style from the Other Styles list to the Include Paragraph Styles. This adds the text formatted with this style to the TOC.
As you click each entry, it appears indented in the Include Paragraph Styles list. Ignore the indents, which are only used under a very esoteric situation that I’ll explore later.
Formatting the Entries
Now that you have the entries listed for the TOC, you need to format them with a paragraph style. Confused? I don't blame you. You’re choosing the text formatted with a specific paragraph style to be inserted in the TOC, but that text still must have a paragraph style applied to it (Figure 8).
Figure 8. Use the paragraph style list to format entries in the TOC.
The paragraph style for the TOC entry does not need to match the original paragraph style applied to the text in the main part of document. The paragraph style I use for TOC entries is different than the styles I use in running text; for example, the B head in the running text is 14 points, and the B head TOC entries are 10 points. For the sake of clarity, I name the paragraph style within the document as "B head" and the style for the TOC as "B head TOC".
Viewing all the Setting
Still in the TOC dialog, click the “More Options” button to see all the available controls (Figures 9 and 10).
Figure 9. The abbreviated controls for formatting a TOC.
Figure 10. The complete options available for formatting a TOC.
Page Number Location
Use the Page Number dropdown menu to choose where the page number should appear in relation to the entry: After Entry or Before (Figure 11). You can also choose to omit a page number for the entry, which is helpful if you want to create a list of all illustration captions or photographers in the book, but don’t want to list the pages on which they appear.
Figure 11. Use the Page Number menu to choose where the page number should be located or if you should have a page number at all.
Styling the Page Number
Once you’ve set a location for the page number, you set a character style for the number (Figure 12). This makes it possible to style the number with a color, italic text, or some other indicator.
Figure 12. Use the Style list to the right of the Page Number menu to apply a character style to the page number.
Separating the Entry and Page Number
TOCs need a divider to separate an entry from its page number. The default is a tab character, written as ^t. You can use the drop-down menu to choose a special character, such as an em dash, forced line break, and so on (Figure 13). My favorite is to change the tab to a right indent tab (^y). This forces the page number all the way to the right side of the margin.
Figure 13. The special characters you can insert between the entry and the page number.
Understand, though, that adding a character between the entry and the number does not create a tab leader. The tab leader comes from the tab created as part of the paragraph style applied to the entry.
You’re not limited to the items in the special character dropdown menu: You can insert your own! Say you want a colon after each entry. You simply insert the colon before the tab character so the field reads “:^t”. This adds the colon after the entry. You can also get fancy with the entry between the entry and the page number and type text, such as “On Page”.
Styling the Separator
Just as you can apply a character style to the page number, you can also apply a character style to the separator between the entry and the page number. This isn’t important if your separator is invisible, such as a tab or space. But if a tab leader is part of the paragraph style, you may want to apply a character style that makes the leading periods smaller (Figure 14).
Figure 14. Use the Style list to apply a character style to the separator between the entry and the page number.
Looking at the Levels
Perhaps the most misunderstood section of the TOC dialog box is the setting for Levels. When you add each paragraph style to the Include Paragraph Style, it's indented from the previous entry (Figure 15). That’s because the levels are automatically set to indent the next style.
Figure 15. The indents for entries automatically appear as each paragraph style is added to the list.
However, except in two very specific circumstances, the levels are there solely for display in the dialog box. They don’t affect anything in an ordinary TOC. You can leave the entries indented or you can change them using the Levels control (Figure 16).
Figure 16. Use the Levels control to set the indents for each entry.
Levels don’t do anything to the actual TOC unless the entries are sorted alphabetically (see the next section). In that case, the entries are sorted by alphabetically within each level. Levels are also used when the TOC style is applied as part of an export to ePub.
Most of the time, you want TOC entries to appear in the same order they appear in the document: by page number. However, some TOCs don't need page numbers, such as those that list all the photographers or illustrations in a document. In these cases, you might want the entries to be listed alphabetically. That’s where the Sort Entries in Alphabetical Order comes in (Figure 17).
Figure 17. Use Sort Entries in Alphabetical Order to list the items in the TOC in alphabetical order.
Apply the Settings for Each Entry
This may seem like a lot of work, and you're not done yet: You must repeat it for each paragraph style in the document text that you want to show up as a TOC entry. This is probably the most common mistake made in creating a TOC: You set up all the options for one entry, but forget to set it for the others.
Go back to the Include Paragraph Styles area, select a new style, and set all the options (Figure 18).
Figure 18. Each entry in the TOC needs to be set by the Style options. Here the options for the B head have been set.
Setting the Options
The Options settings (Figure 19) are pretty straightforward.
Figure 19. The Options area for the TOC dialog box.
Create PDF Bookmarks creates the bookmark navigational aids in the exported PDF.
Replace Existing Table of Contents allows you to make changes to an existing TOC.
Include Book Documents is available only when the book that contains the open document is open. This setting is important if you want to create a TOC for all the documents in a book.
Run-in puts all the entries in a single paragraph. Each entry is separated by a semicolon and a space.
Include Text on Hidden Layers includes entries from layers that are hidden in the Layers panel. The benefit of this setting is you can include items such as advertisers or photographers that you don’t want to appear in the main body of the document.
Working with Numbered Paragraphs
There’s a slight twist to working with numbered paragraphs. Most people don’t want those paragraph numbers in a TOC. The Numbered Paragraph drop-down menu lets you tell InDesign how to treat them (Figure 20).
Figure 20. Use the Numbered Paragraphs menu to control how numbered paragraphs are handled.
Include Full Paragraph uses both the number and the text for the paragraph.
Include Numbers Only uses just the number for the paragraph.
Exclude Numbers drops the numbers from the TOC and includes just the text for the paragraph.
Saving as a TOC Style
You can save all these settings you've been slaving over by clicking the Save Style button. This opens a dialog box where you can name the style so all these settings are maintained in the document. Then you choose that TOC style when you create a new TOC for the document (Figure 21).
Figure 21. A saved TOC style appears in the TOC Style list.
If you save a TOC style for your document, you have the option when exporting as an ePub to use that TOC Style to create a TOC for the ePub. You don’t have to create a TOC for the document. You just need a TOC style.
The Big Payoff: Automatic Updating
After all this work, you need a big benefit. If you (or anyone else) has made any changes to the main body of your work — text, page numbers, order of items, or paragraph and character styles — simply put your insertion point in the text frame that holds the TOC and choose Layout > Update Table of Contents. The text updates automatically.