Table of Contents in Word

The basic options for making a Table of Contents in a Word document.

In this issue we’ll look at the basic options for making a Table of Contents in a Word document.

It’s very easy to do this in Word and it’s not just for people who are making books, for it can be useful in any long document such as a contract. A table of contents can be there for ‘in house’ use while making the document, and later removed from the final version. It’s a good way to see an overview of a long document and ensure that it’s in a logical structure.

Finally it can be a way to jump to parts of the document if you don’t like using the Document Map feature in Word.


Preparing your document

Before you make your Table of Contents (aka TOC) you need to setup your document with headings that will make up the TOC.

Word takes the text from paragraphs in nominated styles to make up the TOC. Normally you’ll use the ‘Heading 1’, ‘Heading 2’ etc styles in Word to define the headings that you want to show in the Table of Contents.

That’s the easy way however you can assign any paragraph style to a level in the TOC.

If you haven’t already, go through your document applying Heading styles to heading and sub-headings.


Making a simple TOC

Once you’ve got some headings formatted in your document you can make a Table of Contents. The basics haven’t changed much for many versions of Word. In Word 2003 you’ll find it under Insert | Reference | Index and Tables | Table of Contents. Word 2007 has it under the ‘References’ tab on the ribbon.

Table of Contents - default options in Word 2003 image from Table of Contents in Word at Office-Watch.com

If you just click OK you’ll get a standard TOC showing headings from ‘Heading 1’, Heading 2’ and Heading 3’.

Chances are you’ll notice some anomalies in your initial TOC – headings missing or items that should not be there. Just go through your document and adjust the styles accordingly.

$$PAGE$$

Updating a TOC

The Table of Contents is a Word field code – the Word 2003 default looks like this:

{ TOC o “1-3” h z u}

Press Alt+F9 to reveal the field codes in any Word document, press a second time to return to standard view.

Thankfully you should never need to worry about the field code parameters – the menu gives you access to all the options. However we’ve copied the TOC field parameters below if you’re interested.

But it’s important to understand how the TOC works so that you know how to update it.

As with any field, pressing F9 will update the field, but if you do that with a TOC you’ll get the choice to:



  • Update Page Numbers only
  • Update entire table

The default is ‘update Page Numbers only’ which is fine if you’ve not changed or moved any headings and only added or removed text. This choice is faster but we generally avoid it because a change in the headings may be overlooked.

We prefer to use ‘Update entire table’ to ensure the TOC is fully up to date. It rarely takes a noticeable time to update even on a long document. Certainly it’s a wise move to fully update the TOC before sending a document out.

Note: the use of the word ‘Table’ in the second option should not mislead you into thinking that the TOC is a Word table – it isn’t.


Changing the TOC

Unless you dig into the details of the field codes, the way to change a Table of Contents is to replace it.

If you right-click in a TOC field and choose Edit Field you get the standard Field codes edit box, scroll down to TOC in the Field Names then click on the Table of Contents button.

Table of Contents - from Edit Fields dialog in Word 2003 image from Table of Contents in Word at Office-Watch.com

Then make the changes you want and Word will replace the current TOC field with a new one.

$$PAGE$$

The TOC settings

Which brings us to the Table of Contents settings, there are a lot and we’ll look at the main ones here.

Table of Contents - default options in Word 2003 image from Table of Contents in Word at Office-Watch.com

The two preview panes show how the current settings will look in printed form or online. The term ‘Web Preview’ really means any non-paper form not just a HTML document.

Show Page Numbers: you can uncheck this option if your document is meant to be printed, for example our ebooks don’t have page numbers in the TOC but do use the ‘Use hyperlinks instead of page numbers’ to make each TOC line clickable and jump to that chapter.

Right align page numbers tells Word to justify the page numbers on the right edge of the page while ‘Tab Leader’ indicates what character to use between the TOC entry and the page number (to guide a readers eye along the line).

Formatting can be done from the TOC styles in the current template or from some pre-defined options available in the drop-down list. You can refine the look of your TOC by choosing ‘from template’ then adjusting the TOC1, TOC2 etc styles via the Modify button (or the standard Styles dialog boxes or taskbars).

As we mentioned earlier, the TOC entries are normally taken from the Heading styles but if you click on the Options button you’ll see there are other, er, options.

Table of Contents - options dialog - Word 2003 image from Table of Contents in Word at Office-Watch.com

You can assign a TOC level to any style or use Outline levels instead of styles (which is why there’s an option to enable the Outlining toolbar). Most of the time, you’ll stick with the Heading styles but the ability to change that is under the ‘Modify’ button.

Table of Contents - Modify style dialog - Word 2003 image from Table of Contents in Word at Office-Watch.com

You don’t have to show all the levels of Heading in the TOC. For example you can have a document using Heading styles 1 to 9 but only display in the TOC the main headings. Do this from the ‘Show Levels’ settings. This means you can have many levels of headings and perhaps display all of them in drafts of the document then hide all but a few in the final document.

$$PAGE$$

Multi-level TOC

A table of contents doesn’t have to use only main headings in the document, for it can have multiple levels just like a numbered or bulleted list.

For example a book could have these headings based on Heading 1 only:



  • Akira Kurosawa
  • Stanley Kubrick
  • Preston Sturges

Changing the TOC settings to include ‘Heading 2’ would change the TOC to show the sections under each main heading.



  • Akira Kurosawa

    • Seven Samurai
    • Rashomon
    • Yojimbo

  • Stanley Kubrick

    • Paths of Glory
    • 2001, A Space Odyssey
    • Barry Lyndon
    • Full Metal Jacket

  • Preston Sturges

    • Sullivan’s Travels
    • Palm Beach Story

There’s no need to create and remove Headings to do this, leave the document unchanged and just change the ‘Show Levels’ option in the TOC options dialog.


TOC within a chapter

You might want to start each chapter with a summary of the sections within it, and this is possible but not as elegantly done in Word as you’d like.

In short, there’s no way to directly make a TOC such as ‘Level 2’ but only until it reaches the next ‘Level 1’. Instead you have to separately define the part of the document to make the TOC for then tell the TOC field to only summarise that area. That’s done with the bookmark feature in Word.

Select the entire chapter or section you want the sub-TOC for and then define a bookmark for it using Insert | Bookmark.

Make a TOC in the usual way but change the levels to omit Level 1 (assuming that’s the chapter heading) and only show Levels 2 and below as you wish.

Insert the TOC into your document (presumably under the main chapter heading). Word assumes you only want one TOC in a document and you’ll get a message asking if you want to replace the existing TOC with the new one – in this case click No.

Finally you have to tell the TOC to only look at the chapter. There is no dialog box to do that, press Alt+F9 to reveal the field codes and add the b switch followed by the name of the bookmark eg b Kurosawa or b Chapter1 etc. Eg { TOC o “1-2” h z u b Kurosawa}

Press Alt+F9 again then F9 to update the entire TOC.

$$PAGE$$

Field Parameters

Here, direct from the Word 2003 help files, are the TOC field code settings in case you want to get down in the detail.


a Identifier

Lists items captioned with the Caption command (Insert menu, Reference submenu) but omits caption labels and numbers. The identifier corresponds to the caption label. For example, although a caption on page 12 is “Figure 8: Mercury”, the field { TOC a figures } displays entries as “Mercury…………12”.

Use the c switch to build a table of captions with labels and numbers.


b BookmarkName

Collects entries only from the portion of the document marked by the specified bookmark


c “SEQIdentifier”

Lists figures, tables, charts, or other items that are numbered by a SEQ (Sequence) field. Word uses SEQ fields to number items captioned with the Caption command (Insert menu, Reference submenu). SEQIdentifier, which corresponds to the caption label, must match the identifier in the SEQ field. For example, { TOC c “tables” } lists all numbered tables.


f EntryIdentifier

Builds a table from TC fields. If EntryIdentifier is specified, the table is built only from TC fields with the same identifier (typically a letter). For example, { TOC f t } builds a table of contents from TC fields such as { TC “Entry Text” f t }.


h Hyperlinks

Inserts TOC entries as hyperlinks


l Levels

Builds a table of contents from TC fields that assign entries to one of the specified levels. For example, { TOC l 1-4 } builds a table of contents from TC fields that assign entries to levels 1-4. TC fields that assign entries to lower levels are skipped.


n Levels

Omits page numbers from the table of contents. Page numbers are omitted from all levels unless a range of entry levels is specified. For example, { TOC n 3-4 } omits page numbers from levels 3 and 4. Delete this switch to include page numbers.


o “Headings”

Builds a table of contents from paragraphs formatted with built-in heading styles (heading style: Formatting applied to a heading. Microsoft Word has nine different built-in styles: Heading 1 through Heading 9.). For example, { TOC o “1-3” } lists only headings formatted with the styles Heading 1 through Heading 3. If no heading range is specified, all heading levels used in the document are listed. Enclose the range numbers in quotation marks.


p “Separators”

Specifies the characters that separate an entry and its page number. For example, the field { TOC p “—” }, with an em dash, displays a result such as “Selecting Text—53.” The default is a tab with leader dots. You can use up to five characters, which must be enclosed in quotation marks.


s Identifier

Includes a number such as a chapter number before the page number. The chapter or other item must be numbered with a SEQ field. Identifier must match the identifier in the SEQ field. For example, if you insert { SEQ chapter } before each chapter heading, { TOC o “1-3” s chapter } displays page numbers as 2-14, where “2” is the chapter number.


d “Separator”

When used with the s switch, specifies the number of characters that separate the sequence numbers and page numbers. Enclose the characters in quotation marks. Word uses a hyphen (-) if no d switch is specified. In the table of contents generated by { TOC o “1-3” s chapter d “:” }, a colon (:) separates chapter numbers and page numbers — for example, “2:14.”


t “Style,Level, Style,Level,…”

Builds a table of contents from paragraphs formatted with styles other than the built-in heading styles. For example, { TOC t “chaptertitle,1, chapterhead,2” } builds a table of contents from paragraphs formatted with the styles “chaptertitle” and “chapterhead.” The number after each style name indicates the table of contents entry level that corresponds to that style.

You can use both the o switch and the t switch to build a table of contents from built-in heading styles and other styles.


u

Builds a table of contents by using the applied paragraph outline level (outline level: Paragraph formatting you can use to assign a hierarchical level (Level 1 through Level 9) to paragraphs in your document. For example, after you assign outline levels, you can work with the document in outline view or in the Document Map.).


w

Preserves tab entries within table entries.


x

Preserves newline characters within table entries.


z

Hides tab leader and page numbers in Web layout view.