#88. Creating Tables of Contents
Creating and updating a table of contents, especially for a long book, can be a chore. The names of heads and subheads change, page numbers change, chapter order changesso you're constantly modifying what's supposed to be the "final" table of contents. Then there's the proofreading, making sure all the text and page numbers actually match the final content. Fortunately, there's an automatic way to do this, provided that you use paragraph styles to format the chapter names, heads, subheads, and other text that will become part of the table of contents. InDesign can extract the text in those paragraph styles, and then produce and update a richly formatted table of contents for a single document or a bookno proofreading required.
Note that although the feature is called "table of contents," it's useful for creating any type of list from a document. For example, you might create a list of images or charts for a book. You can, in fact, create as many different types of "tables of contents" for a book as you need.
Preparing for a Table of Contents
Creating a table of contents requires a little preparation and planning. Here are a few steps to start with:
Figure out what text you want in the table of contents, such as chapter heads, section heads, and subheads.
Determine which paragraph styles are applied to that text. (If necessary, make sure the paragraph styles are applied consistently throughout the documentsif not, text may be left out.)
Decide how you want the table of contents to look, including the title of the table of contents, the text formatting, and the placement and look of page numbers.
Create paragraph and character styles for the table of contents, including its title, each level of text (chapters names, section heads, etc.), and page numbers. If you're going to use a tab to separate each table of contents entry from its page number, be sure to set that tab and specify any leader characters you want (such as ...) in the paragraph style.
Create a placeholder for the table of contentseither blank pages in a document or a blank document in a book. If the table of contents will have a special design, create a master page for it as well.
As an example, this craft book has a main table of contents for the entire book and a mini-table of contents for each chapter (Figure 88a). Some of the formatting, such as the bullets and the bracket under the chapter name, are on the master page. The text consists of the chapter name, "Backyard Botanicals," the craft names followed by a tab, a bracket, and the page number. In the formatted table of contents, the chapter name is centered in 27-point Baskerville Old Face font; the craft names are deeply indented, 12-point Syntax; and the page numbers are 11-point Helvetica Neue Medium Italic.
Figure 88a. InDesign can create richly formatted tables of contents such as this one.
Importing Tables of Contents from Word
If you import text from Microsoft Word that has a table of contents, the entries and page numbers can be imported as well. However, the page numbers may not be accurate after the text is flowed into the InDesign document, and there is no way to update them. You may be better off not importing the table of contents. To do this, click Show Import Options in the Place dialog box, and then uncheck Table of Contents Text in the Include area.
Generating a Table of Contents
Once you've prepared by identifying the text you want in the table of contents and creating paragraph and character styles for it, choose Layout > Table of Contents. In the Table of Contents dialog box, you can specify the styles used to create the table of contents or list, how it should be formatted, and more.
Title area: If you want to place a heading on the table of contents (such as "Contents" or "Figures List"), enter the text in the Title field. To specify the formatting of the title, choose an option from the Style menu at right.
Styles in Table of Contents area: This is where you specify what text goes into the table of contents. In the Other Styles list at left, locate the paragraph style applied to the first level of head that will go in the table of contentssuch as Chapter Head. Select it in the list and click Add. Then select the paragraph style applied to the second level of head and click Add. Continue adding paragraph styles in order until you've added all the styles that should appear in the table of contents. Be sure to add the styles according to the hierarchy of information, such as Chapter Heads, Section Heads, Subheads, etc.
Style area: To specify the formatting for the table of contents, click the first paragraph style in the Include Paragraph Styles list. Then choose a paragraph style from the Style menu below. For example, you might map the Chapter Head paragraph style to the TOC Level 1 paragraph style.
More Options button: To further fine-tune the formatting for each table of contents entry, click More Options. In the Style area, you can specify where page numbers are placed (such as before or after the text) and how they are separated from the entries (such as with an em space or tab). You can also choose character styles for the page numbers and separation characters. In this same area, you can specify that the entries are alphabetized and change the level of information. All the controls in the Style area are specific to the paragraph style selected in the Include Paragraph Styles area; therefore, you may need to set these options for each included style.
Options area: To produce a table of contents for an entire book, check Include Book Documents. Other options in this area let you automatically create PDF bookmarks for table of contents entries, replace an existing table of contents, create a "run-in" table of contents (with semicolons rather than paragraph returns separating entries), and specify whether to include text on layers that are hidden.
Once you're finished setting up the table of contents, click OK in the Table of Contents dialog box (Figure 88b). InDesign looks through the document or book, finds all the text, formats it, and then loads the cursor with the fully formatted table of contents. Flow the text into a text frame as you usually would.
Figure 88b. The Table of Contents dialog box lets you specify what text goes into a table of contents and precisely how it should look. To make the table of contents shown in Figure 88a, the paragraph style "2 Craft Head" is mapped to "TOC Level 2" and separated from its page number with a tab and a right-facing bracket. Both the page number and bracket are formatted with a character style called "TOC Page Numbers."
Don't be surprised if it's not perfect the first time. With all the detailed settings, you might miss a paragraph style or forget to select the character style for the page numbers. But don't be tempted to manually touch up the table of contents. For one thing, manual changes will not be reflected if you created PDF bookmarks. For another, you will inevitably end up making those manual changes more than once. No matter how "final" you think the document or book is, you usually end up generating the table of contents several times. Generating the table of contents is fairly quick, even for a long book, so you can whip one up just to see how many pages you need or to see if you got all the settings right. Then update it as often as needed.
Creating a Table of Contents for a Book
If you're creating a table of contents for a book, follow these steps:
Be sure all the documents in the book are available (not missing or open by another user).
Make sure all the fonts are active. If text is reflowing due to missing fonts, the page numbers may not be accurate.
Choose Repaginate from the Book palette menu before you create the table of contents.
Create the table of contents for the book in a document that will contain it. The document must contain all the necessary paragraph and character styles for creating and formatting the table of contents. If necessary, synchronize the book to make sure all the necessary styles are in that document. See #85 for more information.
If the table of contents is in the first document in the book, you may want to run a "draft" version first to see how many pages it takes up. Then repaginate the book and update the table of contents. If, for example, you save one page for a table of contents and end up using 10 pages, all the page numbers listed in the table of contents will be wrong (unless the table of contents is in its own section of page numbers).
Check Include Book Documents in the Table of Contents dialog box when setting up the table of contents.
Saving Tables of Contents as Styles
If you have multiple "tables of contents" in a document or bookfor example, an actual table of contents and a figures listyou can save those as styles. You can then select a style from the TOC Style menu at the top of the Table of Contents dialog box.
To save table of contents settings as a style, click Save Style in the Table of Contents dialog box. Or, choose Layout > Table of Contents Styles to create, edit, and delete table of contents styles.
Updating a Table of Contents
As you work on a document or book, the table of contents does not update automatically. You need to manually update it to reflect changes to text, page numbers, and so on by choosing Layout > Update Table of Contents. If Replace Existing Table of Contents is checked in the Table of Contents dialog box, an alert displays indicating a successful update. If the option is not checked, the loaded text icon displays, and you can flow the table of contents wherever you want.