TOC Tips and Tricks

Home Tutorials My MVP FAQs Useful Links

 

Recent versions of Word have made inserting a table of contents (TOC) increasingly (perhaps even deceptively) easy. Unfortunately, Word makes it extremely (one might even say unreasonably) difficult to modify either the content or the format of a TOC once it has been inserted.

For instructions on the basics of inserting a TOC, see Word MVP Shauna Kelly’s article “How to create a table of contents in Microsoft Word.” If you have never used a TOC before, I highly recommend that you read Shauna’s article before reading this one. This article builds on the basics to deal with intermediate issues of content and formatting.

Note: This article was originally written for Word 2003 and earlier. Some instructions for Word 2007 and above are included in the topics below. Issues peculiar to Word 2007 and above are discussed at the end of this article.

Some specific TOC effects can be achieved only by editing the TOC field that Word inserts. My article on “Customizing your table of contents with switches” describes the specific switches that can be inserted in the field to achieve these effects. Some of the tricks detailed in the present article also require editing the TOC field; if you have never edited a Word field, you can find instructions for editing any field later in this article.

Here's what you'll find in this article:

Controlling what goes into the TOC

One way or another, you can generate a table of contents that includes exactly what you want to include and nothing more, but this is much easier to do if you give some thought to the TOC when you are creating the document itself. Because Word by default builds a TOC based on Word’s built-in heading styles, inserting a TOC will be most straightforward if you have used these heading styles in the way they were intended to be used: Heading 1 for the title of the highest division you want included (which may be a part, section, or chapter), Heading 2 for the title of the next-lower division, and so on. There are also many other good reasons for using Word’s built-in heading styles.

Using heading styles and outline levels
Using the TOC Options
TOC entry for part of a paragraph
TOC entries that don’t appear in the document
A TOC for part of a document

Using heading styles and outline levels

By default, Word creates a TOC based on Headings 1–3. It also includes other built-in styles that have an outline level of 1, 2, or 3, such as the Title (Level 1) and Subtitle (Level 2) styles (Word 2003 and earlier only). To see the outline level of any given paragraph, look in the Paragraph dialog.

To access the Paragraph dialog:

  • Word 2003 and earlier: Click Paragraph... on the Format menu.

  • Word 2007 and above: Click the dialog launcher (tiny arrow) in the bottom right corner of the Paragraph group on the Home tab of the Ribbon.

  • Any version of Word: Right-click and choose Paragraph... from the context menu).

The Paragraph dialog showing outline level

Figure 1a. The Paragraph dialog in Word 2003 showing outline levels

s

Figure 1b. The Paragraph dialog in Word 2021 showing outline levels

The outline level of paragraphs in Word’s built-in heading styles cannot be changed; if you look at the Paragraph dialog for a paragraph in one of these styles, you’ll see that the outline level box is disabled. The outline level for any other style or paragraph can be changed, so that theoretically it is possible to have paragraphs in the same style (Normal, for example) with different outline levels. I don’t recommend this, as it seems to me unnecessarily confusing, but in theory it is possible to have an entire document in Normal style with certain paragraphs marked as Level 1, 2, or 3 rather than the default Body Text. The default TOC field will pick up these paragraphs and include them in the TOC.

One way to assign these outline levels to paragraphs is to use Outline view. By default, if you promote a Body Text–level paragraph to, say, Level 1, Word will accomplish this by applying the Heading 1 style. But you can also change the level without changing the style. I repeat that I do not recommend this.

Using the TOC Options

Figure 2 shows the Table of Contents dialog with the default settings in a Blank Document based on the Normal template (Normal.dot in Word 2003 and earlier; Normal.dotm in Word 2007 and above). Most of the settings affect the appearance of the TOC rather than the content (this will be discussed later). Only the “Show levels” box affects the content.

To access the Table of Contents dialog:

  • Word 2003 and earlier: On the Insert menu, click Reference, then Index and Tables....

  • Word 2007 and above: On the References tab, in the Table of Contents group, click Table of Contents, then Insert Table of Contents... or Custom Table of Contents....

The Table of Contents tab of the Index and Tables dialog

Figure 2. The Table of Contents tab of the Index and Tables dialog

Only rarely will you want to insert Word’s default TOC, without making any changes. To change which headings are included, you need to click the Options… button to open the Table of Contents Options dialog. There are two basic parts of this dialog: three check boxes and a list of styles. By default, the boxes for “Styles” and “Outline levels” are checked, and the box for “Table entry fields” is not.

If you scroll through the styles list, you will see a number beside certain styles. This number represents the level at which this style will appear in the TOC. Which styles are listed will depend on which styles are “available” (or “in use”) in your document, but you will see at least a number 1 by Heading 1, 2 by Heading 2, and 3 by Heading 3 (if you have selected more levels in the Table of Contents dialog, you will see these numbered as well (4 for Heading 4 and so on). In Word 2003 and earlier, if the Title and Subtitle styles are available in your document, they will be numbered 1 and 2, respectively.

The Styles list in Table of Contents Options showing heading styles and levels

Figure 3. The Styles list showing heading styles and levels

What many users don’t realize is that all of these numbers can be changed. You can delete the numbers that are there (if you don’t want the built-in heading styles to appear in your TOC), and you can put whatever number you want beside any style in the list. If you have used custom heading styles, you can of course type numbers beside these styles in the Table of Contents Options dialog, but if you selected the appropriate outline level in the Paragraph dialog when you created the style, these numbers will already be inserted automatically.

Having the “Styles” box checked ensures that every style with a number beside it will appear at that level in the TOC. Later we will see how these numbers can be manipulated to play tricks with the TOC.

Having the “Outline levels” box checked also ensures that any paragraph to which you have assigned an outline level (regardless of what style it is) will be included in the TOC at that level. If you have not assigned outline levels to specific paragraphs in styles that don’t have a built-in outline level, it doesn’t matter whether this box is checked or not, but if you have, this box will control whether those paragraphs are included in the TOC or not.

Important Concept: You can have as many TOCs as you want in your document, and the content of each can be different. For example, it is common in textbooks to have a “Contents in Brief” TOC that includes just the top level or two and another, more detailed TOC that includes subheads at lower levels. You can customize this by changing the number of levels you include and also the styles you select for inclusion.

TOC entry for part of a paragraph

In structured documents, sometimes a heading is “run in”—that is, the first part of the paragraph is the heading, and the rest of the paragraph is just ordinary body text. The heading part is all you want in your TOC. There are several ways to accomplish this, as described in my article “Creating Run-in Sideheads,” but the best way, if you have a recent version of Word, is to use a “style separator.” This more-or-less invisible character separates part of a paragraph in a heading style from the rest of the paragraph in a body text style. Only the part that has the heading style will appear in the TOC. To use the style separator you must prepare your content in two separate paragraphs.

  1. In the first paragraph, type the text for your heading—what you want to appear in the TOC—and apply the desired heading style to it.

  2. In the second paragraph, apply the style you are using for body text (Normal, Body Text, or some other non-heading style).

  3. Click anywhere in the first paragraph and press Alt+Ctrl+Enter. The style separator will appear at the end of the paragraph (replacing the paragraph mark), and the following paragraph will come up to join it.

If you have nonprinting characters displayed, after step 2 you will see a pilcrow (paragraph mark or ¶) at the end of each paragraph. After step 3, you will see the style separator at the end of the heading part. It looks like a pilcrow with a dotted line around it.

TOC entries that don’t appear in the document

The third check box, “Table entry fields,” refers to TC fields. TC fields were once the only way to build a TOC (just as an index is still built on XE fields). Now it is usually unnecessary to deal with them, but there are times when you can use TC fields to generate TOC entries that you could not achieve any other way.

A typical situation is one where you want to include text in the TOC that does not actually appear anywhere in the document itself or that is somewhat different from what appears in the document. For example, a client of mine had compiled an anthology of travel columns that he hoped to publish as a book. As a marketing strategy, he wanted the TOC to include not only the title of each article but also a brief blurb about each to give readers an idea of what to expect (see Figure 4). He did not, however, want these blurbs to appear in the articles themselves.

Figure 4. TOC with descriptive blurbs

This was accomplished using TC fields, as shown in Figure 5.

Figure 5. TC field in the document

In another example, a book’s chapters had no titles, and each began only with the chapter number as a large Arabic numeral. This would have resulted in a TOC that had just a chapter number followed by nothing, so I used a TC field to have the TOC instead say “Chapter One,” “Chapter Two,” and so on. Figure 6 shows these examples.

Figure 6a. Chapter number as it appears on the printed page

Figure 6b. TC field used to generate the TOC

Figure 6c. The result in the TOC

A TC field can be inserted in several ways:

  • Any version of Word: To insert the field manually, press Ctrl+F9 to insert field braces and then type the content between them.

  • Word 2003 and earlier: On the Insert menu, select Field... In the Insert Field dialog, select TC and enter the desired text.

  • Word 2007 and above: On the Insert tab, in the Text group, click Quick Parts and select Field... In the Insert Field dialog, select TC and enter the desired text.

  • Any version of Word: Select text in the document and press Alt+Shift+O to open the Mark Table of Contents Entry dialog (see Figure 7). Type the desired text in the “Entry” box and click Mark.

Mark Table of Contents Entry dialog

Figure 7. Mark Table of Contents Entry dialog

Any one of these methods is pretty labor-intensive, and it will certainly make you appreciate how easy it is to create TOCs based on styles and outline levels, but using TC fields can be a lifesaver whenever you want to include something in the TOC that doesn’t appear in the document.

Note that each TC field can have a switch that indicates which TOC level it represents (the default is 1). In the example in Figures 4 and 5, the blurbs were at Level 3.

Note also that a TC field can have a “table identifier.” If you want certain entries to appear in a specific TOC and others in a different one, you can create TC fields with different identifiers; these entries will then appear only in the table of contents whose TOC field has a matching identifier. For more on TC fields, see Word’s Help topic “Field codes: TC (Table of Contents Entry) field.”

A TOC for part of a document

We’ve already seen that a document can contain more than one TOC and that these TOCs can contain different heading levels. But what if you want your document headings divvied up by location rather than level? That is, suppose you want a TOC for each chapter in addition to one for the entire book? Although this is easy enough to accomplish, it cannot be done through the TOC dialog: you have to edit the TOC field by hand to add the \b (bookmark) switch.

Insert a bookmark

The general principle here is that you have to have some way to tell Word what part of the document you want each TOC to cover. To do that, you select the text you want included in the TOC (an entire chapter, for example) and insert a bookmark.

  • Word 2003 and earlier: On the Insert menu, click Bookmark and type in a name for your bookmark.

  • Word 2007 and above: On the Insert tab, in the Links group, click Bookmark and type in a name for your bookmark.

The bookmark name can be any text you like, but it can’t contain spaces. So, for example, you can’t use “Chapter 1,” but you can use “Chapter1” or “Chapter_1.”

Insert a TOC field

After you have created the bookmark, you insert a TOC field at the desired place (at the beginning of the chapter, say).

Helpful Hint: Give some thought to this. If you have used Heading 1 for your chapter titles, then of course you don’t want the chapter title included in your chapter TOC, so you will want to omit Level 1 from your TOC. Perhaps you’ll include just Levels 2 and 3. So in the Table of Contents Options dialog you’ll delete the 1 from beside Heading 1.

But also think about formatting; unless you want the entire TOC to be indented, you don’t want to use the TOC 2 style (which by default has a 0.17″ indent) for Level 2. To get around this, type 1 by Heading 2 and 2 by Heading 3 so that the next-higher TOC style will be used for each heading style.

Edit the TOC field

After you have inserted the TOC (which at this point will contain many more entries than you want), you will have to edit it by hand. So press Alt+F9 to toggle the display from field results to field code. If you have not changed any of the default options except the levels as described above, the field you have inserted will look like this:

{ TOC \h \z \u \t "Heading 2,1,Heading 3,2" }

If you want this TOC to cover your first chapter, which you have bookmarked as “Chapter1,” then you will type “\b Chapter1” into the field so it looks like this:

{ TOC \b Chapter1 \h \z \u \t "Heading 2,1,Heading 3,2" }

Press Alt+F9 again to toggle back to the field results, then F9 to update the field, which should now show only the headings from Chapter 1.

Repeat the process for each additional chapter TOC: insert a bookmark, insert a TOC, and then edit the TOC to add the \b switch and the bookmark name. As a shortcut, you can copy the field code that includes the bookmark for Chapter 1 and, after bookmarking Chapter 2, paste the copied field at the beginning of the chapter and edit it to change the bookmark name.

Controlling how the TOC looks

Once you have mastered the art of getting the desired content into your TOC, you’ll want to fine-tune the way it looks. Some settings can be changed in the basic TOC dialog. These include whether or not to include page numbers, what kind of leader (if any) to use with the page numbers, how many levels to include, and (in Word 2002 and above) whether or not to hyperlink each entire entry (as opposed to just the page numbers).

You can also choose among a variety of preset formats, as shown in Figure 8. Maybe you’ll find one of these that you really like, but they’re not that great (there’s not one that you can’t easily replicate), and using them can cause confusing problems if you try to modify the TOC styles. So I recommend sticking with the “From template” option.

The Table of Contents tab of the Index and Tables dialog showing available formats

Figure 8. The Table of Contents tab of the Index and Tables dialog showing available formats

TOC entries use a set of styles ranging from TOC 1 up to TOC 9. As you might expect, TOC 1 is used for Level 1 entries, TOC 2 for Level 2 entries, and so on.

By default, the TOC styles are very bland. They are based on the Normal style, which means that, unless you have modified Normal, this is what you'll get:

  • Word 2003 and earlier: All entries will be 12-point Times New Roman, single-spaced, with no Spacing Before or After. Each TOC style below TOC 1 is progressively indented. That is, TOC 1 is flush left; TOC 2 has a 0.17″ left indent, TOC 3 has a 0.33″ left indent, and so on.

  • Word 2007 and 2010: All entries will be 11-point Calibri with 1.15 line spacing and 5 points Spacing After. Each TOC style below TOC 1 is progressively indented. That is, TOC 1 is flush left; TOC 2 has a 0.15″ left indent, TOC 3 has a 0.31″ left indent, and so on.

  • Word 2013 and above: All entries will be 11-point Calibri with 1.08 line spacing and 5 points Spacing After. Each TOC style below TOC 1 is progressively indented. That is, TOC 1 is flush left; TOC 2 has a 0.15″ left indent, TOC 3 has a 0.31″ left indent, and so on.

Finally, when you generate the TOC, Word dynamically adds a right tab stop at (or close to) the right margin. If you’re using the default Blank Document, which has 1.25″ left and right margins, resulting in a 6″ text width, the tab stop will be at 5.99″ (in Word 2007 and above, which have 1" left and right margins, the tab stop will be at 6.49"). This tab stop does not adjust automatically; if you change the margins, you will have to manually change the tab stop in all the TOC styles, so it is advisable to change margins (if you plan to) before inserting the TOC (think about this especially if you plan to have the TOC in more than one column: create the columns before you insert the TOC).

In some cases, this plain-vanilla TOC is adequate; in most cases, however, you’ll want to embellish it somewhat. You do this by modifying the TOC styles.

Modifying TOC styles
Indents and tab stops
Effect of direct formatting
Omitting page numbers
Adding numbering to unnumbered headings
Adding chapter numbering

Modifying TOC styles

All versions of Word make it dangerously easy to modify TOC styles (intentionally or accidentally) by automatic updating, and recent versions of Word (2002 and above) make it unreasonably difficult to modify them any other way.

Automatic updating

All TOC styles in all versions of Word by default have “Update automatically” enabled. This means that if you make a change in the formatting of one TOC entry, this change will be applied to the style itself and propagated to all other entries in that style. So if you select one TOC 1 entry and make it 14-point Arial Bold with 12 points Spacing Before, a hanging indent, and “Keep with next” enabled, this formatting will be applied to all the Level 1 entries in the TOC and to the style as well. This works for changes you apply using keyboard shortcuts, toolbar buttons, the ruler, and formatting dialogs (such as the Font, Paragraph, Tabs, and Bullets and Numbering dialogs), though it seems to work more reliably for paragraph formatting than for font formatting. There are, however, situations where you may want to be able to access the Modify Style dialog to make changes directly. This is especially important if you are applying outline numbering.

The Modify Style dialog

Succeeding versions have made access to the Modify Style dialog successively more difficult, with some easing in more recent versions. Here's the rundown:

  • Word 2000 and earlier: On the Format menu, select Style. In the Style dialog, click Modify...

  • Word 2002 and 2003: On the Format menu, select Styles and Formatting, which opens the task pane of the same name. By default, the task pane does not display any TOC styles, even when you have the deceptively named “All styles” view selected. If you have removed the \h switch from your TOC (so that only the page numbers, not entire entries, are hyperlinked), then you will see the TOC style in the “Formatting of selected text” box; otherwise, you’ll see Hyperlink (the applied character style) for all TOC levels. As explained in fellow MVP Shauna Kelly’s article on modifying styles, you can add the TOC styles to the list by selecting “Custom” at the bottom of the task pane and checking the TOC styles in the “Format Settings” dialog. Once the TOC styles are visible in the task pane, you can right-click on any listed style and choose Modify…

  • Word 2007 and above: display the Styles pane by clicking the dialog launcher in the Styles group on the Home tab, then click on the Manage Styles button, select the desired style in the Manage Styles dialog, and click Modify… Alternatively, click on Options… in the Styles pane and select “All styles”; the TOC styles will then be listed in the Styles pane.

  • Word 2007 and above: Press Ctrl+Shift+S to open the Apply Styles dialog. Select the desired TOC style and click Modify...

The Table of Contents dialog

If you have had experience with TOCs and know how you want to modify the TOC styles while you are still in the process of creating the TOC, you can click the Modify… button in the TOC dialog (see Figure 2) to open a Style dialog that includes only the TOC styles. You can select one of these and click Modify… to open the Modify Style dialog.

A frustrating glitch

There is one change that apparently can’t be made through the Modify Style dialog (no matter how you access it): if you want to remove the period leader before the page number (or change the leader character), you cannot use Format | Tabs in the Modify Style dialog as you would expect. For one thing, the dialog will not display any tab stops! Presumably this is because the right-aligned tab stop for the page number is set dynamically based on your margin width, but even after the TOC has been inserted and the tab stop has been set, it doesn't show up in the Tabs dialog when it is accessed through Modify Style. [Another factor may be the general inability of the TOC field to handle leader characters: as detailed in the section titled “A really useless switch” in my article on TOC switches, there is a switch in the TOC field that is supposed to determine the leader character for the whole TOC. It not only doesn’t work but, even if it did, assumes that you want the same leader for all levels.]

You might try to access the Tabs dialog indirectly (by double-clicking on the tab stop, for example). This will display the tab stop setting, but if you change the leader and click OK, you will find that the change is applied only to the single entry at the insertion point. If you then update the style, the change will be applied to the rest of the entries at that level, but when you update the TOC, it will be applied to all the entries. Other approaches can result in the tab stop being entirely removed from other levels. There seem to be myriad ways to get this wrong!

The only method I have found that works is to change the tab stop first—but not through the Tabs dialog. Instead, drag the tab stop marker to the left a little. You will see this change immediately propagated to the rest of the entries at that level as the style automatically updates. Double-click on the tab stop to open the Tabs dialog and remove the leader. Then drag the tab stop back where it belongs.

While this will appear to have worked, as soon as you update the TOC, you'll see that the leader has also been removed from the entries at other levels. Again, the only apparent way to fix this is to repeat the process (drag the tab stop, restore the leader, drag the tab stop back) for each TOC level. This is so much trouble that you may well conclude that you can be satisfied to either have leaders for all levels or to omit page numbers for a single level (as described below).

Indents and tab stops

One of the most common ways of modifying TOC styles is by adding indents. If your entries are long enough to wrap to a second line (especially if they are numbered), you may want to add a hanging indent to the TOC style. For entries that wrap to a second line, it is even more important to add a right indent to keep the entry from overrunning the page numbers. The ruler in Figure 9 below shows that a right indent has been added to the TOC style to make entries wrap well short of the page number column.

OC entries with right indent

Figure 9. TOC entries with right indent

If you have used line breaks in your headings to wrap the text at a specified point and want to preserve these same breaks in the TOC entries, you will need to edit the TOC field to add the \x switch, which “preserves newline characters within table entries.” Without this switch, a line break is rendered as a single space, so be sure you don’t have a space before the line break or you’ll end up with two spaces between words in your TOC entry.

If most of your TOC entries are fairly long, or if the text line is fairly short, so that there is not much distance between the end of the entry and the page number, you may want to omit the period leaders for a cleaner look.

If you do need to use leaders, the TOC will present a much more attractive appearance if the leaders all end in the same place, somewhat short of the longest page number (see Figure 10).

TOC with truncated leadersTOC with truncated leaders

Figure 10. TOC with truncated leaders

Unfortunately, Word does not offer any easy way to do this, but there are two possible approaches:

  1. When editing is complete and the TOC will not change again, update the TOC one last time, verify that it is correct, and then unlink it (Ctrl+Shift+F9). Then modify the TOC styles to add an additional tab stop, with a period leader, to the left of the page numbers. Remove the leader from the tab stop at the right margin (the one where the page numbers are). You will have to add an additional tab character to the end of each TOC entry to make this work. This is pretty labor-intensive and somewhat risky (since the TOC can no longer be updated). You could probably get by with merely locking the TOC field (Ctrl+F11), but it’s still not a very satisfactory solution.

  2. Another approach that is perhaps equally unsatisfactory relies on adding the tab characters to the headings themselves. Using this approach, you change the formatting of the TOC style to add a tab stop as in (1), but the success of the method depends on your being able to add a tab character to the end of each heading, which will work only for left-aligned (not centered) headings. In addition, you will need to edit the TOC field to add the \w switch, which preserves tab characters in the TOC entries.

Effect of direct formatting

I have said that by default Word’s TOC styles are very plain. If you haven’t changed them in any way and you see text that is different, then this is coming from your headings. TOC entries do not reflect any formatting that is part of a heading style, but they can pick up any font formatting that is applied directly. So, for example, if your Heading 1 style is defined as 16-point Arial Bold and your Heading 1 paragraph is 16-point Arial Bold, then the TOC entry for that paragraph will still be 12-point Times New Roman or 11-point Calibri. But if you change the formatting of part of the heading, making one of the words italic, for example, then that change will be reflected in the TOC entry.

Usually this is what you want. For example, if your heading includes words italicized for emphasis or because they are a book title, you will probably want them to be italicized in the TOC as well. Where users often get into trouble, however, is with UPPERCASE and All Caps formatting.

  • If you want your Heading 1 paragraphs to be in all caps, you should add All Caps formatting to the Heading 1 style instead of typing the headings with Caps Lock on. When you do the latter, then the caps are direct formatting (UPPERCASE rather than All Caps), and the headings will be capitalized in the TOC as well, which may not be what you want (and if it is, you should format TOC 1 as All Caps).

  • If you have already applied All Caps formatting to a heading style, you may not realize when you are typing a heading that you haven’t capitalized some of the words that should be capitalized. When you see the TOC entry, which is in Caps & lowercase, you often have to go back and correct the typing of the heading itself.

    Important Note: Not all direct formatting is reflected in the TOC. Paragraph formatting is always ignored. This means that if your Heading 1 is defined as 12 points Spacing Before and 3 points Spacing After and you modify one Heading 1 paragraph to have 24 points Spacing Before, this will not affect the TOC. Only direct font formatting is picked up, and not even all of that; here's a rundown:

    • Font formatting that is picked up by the TOC: the font itself (font name), italics, bold, superscript/subscript, strikethrough/double strikethrough, small caps/all caps, hidden, raised/lowered, expanded/condensed, scaled.

    • Font formatting that is NOT picked up by the TOC: font size, font color, underline.

      Another important note: The above applies to TOCs in which the entire entry is hyperlinked (that is, the TOC field code includes the \h switch). In these TOCs, the Hyperlink character style (which by default is blue and underlined) is applied to the entry but suppressed. Apparently this results in suppression of underline and all colors. If you remove the \h switch (the entry will not be hyperlinked, but the page number still will be), font color and underline applied as direct formatting will be displayed in the TOC.

    Interesting Anomaly: My colleague Charles Kenyon has pointed out an interesting anomaly in hyperlinked TOCs. If a heading paragraph includes a MacroButton field, the prompt, though displayed normally in the heading itself, will appear in the TOC with the Hyperlink character style applied. The MacroButton will also be active in the TOC.

Omitting page numbers

Occasionally you’ll want to omit page numbers from all levels of a TOC; as shown above, that is easily accomplished in the TOC dialog, by clearing the “Show page numbers” check box. But what if you want to omit page numbers for just certain levels? For that you will again have to edit the TOC field by hand.

How to edit a field

To edit any field, you must display the field code. Shift+F9 will display the code for a selected field, but Alt+F9 will toggle all the fields in your document, and I find this easier to remember. The field code is displayed as text between two field delimiters that look like braces (curly brackets) but can’t be entered from the keyboard (to create a field you have to press Ctrl+F9 to insert these braces).

You can edit the text within the field code just as you would any other text—adding or deleting material as needed. When you have finished, press Alt+F9 to toggle the display back to the field results and (Very Important!) press F9 to update the field (until you do this, it won’t appear to have changed).

Omitting page numbers for two or more levels

The field switch used to omit page numbers is the \n switch. Suppose you want to have page numbers for just Level 1 and omit them for Levels 2 and 3. If you have accepted the default TOC settings, the field code you will see when you press Alt+F9 is:

{ TOC \o "1-3" \h \z \u }

To this field you must add the \n switch followed by the numbers of the levels you want to omit page numbers from:

{ TOC \o "1-3" \n 2-3 \h \z \u }

Omitting page numbers for a single level

A much more common requirement, however, is to omit page numbers for just Level 1 (especially if the TOC 1 style is centered) and keep them for Levels 2 and 3, as shown in Figure 11. You might think that the appropriate switch would be “\n 1,” but in fact this won’t work. The secret is that the \n switch requires a range of inclusive levels even when there’s only one, so the correct field code is:

{ TOC \o "1-3" \n 1-1 \h \z \u }

A TOC with centered, unnumbered TOC 1 entries

Figure 11. A TOC with centered, unnumbered TOC 1 entries

Important Caveat: In some versions of Word, if you center any of the TOC styles, Word removes the right tab and leader from all the styles, with the result that the page number follows the heading text (TOC entry) immediately, separated only by a single space rather than a period leader. Word does this by inserting a \p switch specifying a space (instead of the default tab and leader) as the separator. To correct this you will have to edit the field to delete the \p switch. In Word 2003, it appears to be impossible to center a TOC style unless you have already removed numbering from that level, so this problem presumably does not arise.

Omitting page numbers for noncontiguous levels

Suppose you have want to have centered part titles without page numbers (TOC 1), chapter titles with page numbers (TOC 2), and some other text (subheadings or a blurb like that in Figure 4) without page numbers (TOC 3). In other words, you want to omit page numbers from TOC 1 and TOC 3 and include them for TOC 2. You can’t have more than one \n switch, and there’s no way to include 1–3 without including 2, so you might think this can’t be done—and it can’t, at least not that way. You just need to be devious!

The trick is to swap styles. You need to use TOC 2 for Heading 1 and TOC 1 for Heading 2, and omit page numbers for TOC 2 and 3. In the Table of Contents Options dialog, type 2 beside Heading 1 and 1 beside Heading 2. Clear the check box for “Outline levels” (because you haven’t changed the outline levels of these styles). Insert the TOC, then edit the field code to add the \n 2-3 switch. This will give you the following:

{ TOC \o "3-3" \n 2-3 \h \z \t "Heading 1,2,Heading 2,1" }

Now swap the formatting of TOC 1 and TOC 2; that is, make TOC 2 centered and TOC 1 left-aligned, to match the heading levels to which they are assigned. You’ll get something that looks like Figure 12.

A TOC with unnumbered Heading 1 and Heading 3 entries

Figure 12. A TOC with unnumbered Heading 1 and Heading 3 entries

Adding numbering to unnumbered headings

Many highly structured documents are created with outline-numbered headings. When you create a TOC based on these headings, the TOC entries are also numbered. Figure 13 shows the result if you use one of Word’s built-in outline numbering formats (without any customization) and generate a TOC based on the outline-numbered headings. For the type of document for which this type of numbering is suitable, presumably this type of TOC is also suitable.

Outline-numbered headings

Outline-numbered headings in the TOC

Figure 13. Outline-numbered headings and TOC

Often, however, you want something more creative. For example, if you are numbering chapters (which may be the only numbered headings in your document), you may want the chapter number to be on a separate line from the title, as shown by the examples in Figure 14.

Example of chapter number on separate line

Example of chapter number on separate line

Example of chapter number on separate line

Figure 14. Examples of chapter number on separate line

There are several ways to accomplish this. For example, you can specify “Nothing” as the character to follow the paragraph number, then manually insert a line break after the number. But if you want more space between the chapter number and title than between lines in the title (if it wraps to a second line), then you’ll have to enter multiple line breaks, fiddle with the font size, or accomplish this with some other workaround. Moreover, if you want different margins or paragraph alignment for the number and title, you will probably find this impossible (or at least very difficult) to accomplish in a single paragraph.

A better way is usually to make the chapter number and chapter title separate paragraphs and styles entirely. You’ll probably want to use Heading 1 for either the number or the title. Which one you use it for depends on whether or not you need to use the number in captions, page numbers, or other headings.

Note: In the discussion that follows, “Heading 1” has been used to refer to one of Word’s built-in heading styles. If you are using Heading 1 for a part title or some other heading at a higher level than the chapter number/title, then your chapter number or title will use Heading 2, which you should substitute in these instructions.

If the chapter number must be included in caption numbers (for example, if the figures in Chapter 1 are numbered Figure 1‑1, Figure 1‑2, etc.), then you will have to use Heading 1 for the chapter number. The same is true if you are restarting page numbering in each chapter and including the chapter number in the page number. And of course, if you’re using outline numbering, as in the example in Figure 13, you will have to use Heading 1 for the chapter number. In such cases, you will define a Chapter Title style to use for the title.

If you don’t have to worry about captions, page numbers, or subordinate headings, define a Chapter Number style for the number. You can still use auto numbering—anything from a simple numeral to a fancy “Chapter One”—just be sure to set “Follow number with” to “Nothing.” In this case, you will use Heading 1 (or some other built-in heading) for the chapter title.

Regardless of which style you have used Heading 1 for, you will use the chapter title style in your TOC. If you’ve used Heading 1 for the chapter title, it will be included automatically. If you’ve used Chapter Title, then you must remove the 1 from beside Heading 1 in the Table of Contents Options and add a 1 beside Chapter Title.

Here’s where the fun starts! You must now add numbering to the TOC style (assumed to be TOC 1). See the section on modifying TOC styles for instructions on accessing the Modify Style dialog. In that dialog, select Format | Numbering. In the Bullets and Numbering dialog, select the Numbering tab, select the first numbering format, and click Customize. Although you can use this numbering style out of the box, it will look nicer if the numbers are right-aligned, so set the “Number position” to right. You may also want to remove the period, increase the indent, or customize some of the rest of the formatting to your taste. This will give you a TOC that looks like Figure 15.

Important Caveat: The numbering instructions above are for Word 2003 and earlier. In Word 2007 and above, paragraph numbering cannot be modified through the Modify Style dialog; you must use the Define New Multilevel List dialog instead; see “Numbering” below for more information.

TOC with numbered TOC styles

TOC with numbered TOC styles

Figure 15. TOCs with numbered TOC styles

You may be wondering why (or how) the titles of the front matter sections (“Preface,” “Acknowledgments”) in the examples in Figure 15 are not numbered. This is easily accomplished. For the titles of your front matter sections, use a different style from the one used for chapter titles. It can look just like the chapter title style, but it should have an outline level of 2 (if you’re not using Heading 2 for anything else, it’s a good choice since it automatically has an outline level of 2). Then format the TOC 2 style to look just like TOC 1, but without numbering (that is, give it the same indent and other formatting). The front matter titles will then use TOC 2 and look just like the TOC 1 chapter title entries, but without numbering.

Adding chapter numbering

If you restart numbering in each chapter or division of a work, then you probably add the chapter number to the page number, so that Chapter 1 begins with page 1-1, Chapter 2 with 2-1, and so on. Assuming you have added these numbers using the "Include chapter number" feature as described in this article, then the chapter numbers will be reflected in the table of contents, though this is not really very helpful since every chapter starts with page 1.

Often, however, you will have a requirement to "number" the chapters with letters. This is often done for appendixes (Appendix A, Appendix B, and so on). So long as you are using a normal alphabetic sequence, you can do this with ordinary numbering, as described in "How to number headings and figures in Appendixes."

But what if you want to use "random" letters (not in alphabetical order)? For example, suppose you have a glossary at the end, and you want all the page numbers to begin with G, and the endnote pages should begin with N and the index pages with I. If all you want is for the letters to appear on the pages, you can just type them into the header or footer before the PAGE field, but if you want the letters to appear in the TOC as well, this is a very special case, but it can be handled by using the \s switch in your TOC.

Credit is due to Word MVP Stefan Blom for realizing the potential of this switch, which is intended to pick up numbering applied to headings using a SEQ field. The method is rather finicking, and again, unless these "chapters" contain subdivisions that would be listed in the TOC, there is little point in including them (since all the starting pages would be 1). If you are determined to do it, however, here's how:

  1. In order to restart numbering in these sections, you will already have separated them with section breaks. Unlink the header or footer (wherever the page number will be) of each of these sections from the previous one.

  2. In the header/footer, type the desired letter and separator (usually a hyphen, but see Note 1 below) before the page number, so that you get G-1 or N-1 or I-1 or whatever. (See Note 2 below for an alternative method.)

  3. In the document body at the beginning of each section, press Ctrl+F9 to create a field. It will appear as curved braces containing two spaces, with the insertion point between the spaces.

  4. In this field, type:
        SEQ chapter \* ALPHABETIC \r x
    where "x" represents the numerical position of the desired letter in the alphabet: 7 for G, 9 for I, 14 for N, and so on. Note that the \* alphabetic switch is case-sensitive; if you don't capitalize it, you will get a, b, c instead of A, B, C.

  5. Press F9 to update the field, and you should see the desired letter (if you've miscounted, try again!).

  6. You will need to format this field as either Hidden (Ctrl+Shift+H) or Font Color: White so that it doesn't print. One easy way to include it is to put it at the beginning of the heading that will appear in the TOC and format it as Hidden. You cannot put it at the end of the heading or it will apply to the following section instead.

  7. To include the letters in the table of contents, you will need to edit the TOC field. Press Alt+F9 to display the TOC field code and add to it:
        \s chapter
    Then Alt+F9 to toggle the field display and F9 to update the field.

Important Note: Unfortunately, when you add the \s switch to the TOC field, it affects the entire contents of the TOC. This means that any sections that don't contain SEQ fields will be displayed with a zero and a hyphen (0-1, 0-2, etc.). What this means in practical terms is that you will have to have two separate TOCs, one for the ordinary contents of your document and a subsequent one for the sections numbered with SEQ fields.

There are two ways to accomplish this:

  • Bookmark each section of the document (the one without SEQ fields and the one with SEQ fields) and create TOCs using the \b switch as described in "A TOC for part of a document" above.

  • Use different heading styles for the sections that use SEQ fields. For example, if the main part of your document uses Headings 1–3, then use Headings 4 and up for the headings in the sections that use SEQ fields. Include levels 1–3 in the first TOC and only level 4 (or 4 and 5 or whatever) in the second one.

Note 1: By default, Word uses a hyphen between the "chapter number" and the page number in the TOC. If you want to separate the letter and number with a different character (or none), you will need to add the \d switch. For example, to produce "A:1" instead of "A-1," use this switch:
    \d ":"
Omitting a separator entirely (to produce "A1") is a little more complicated because Word ignores a \d "" switch and uses a hyphen anyway. You can, however, insert a "No-Width Non Break" character from the Special Characters tab of the Symbol dialog, which will produce the desired result.

Note 2: Although most users will probably find it simpler and more straightforward to just type the desired letter in the header or footer, there is another method that makes it unnecessary to unlink the headers/footers of the sections that contain SEQ fields. In place of the letter, insert this field:
    { SEQ chapter \c \* ALPHABETIC }
This will repeat whatever letter is generated by the SEQ field at the beginning of that section. You will still need to type the desired separator character.

Saving your work

A table of contents can be viewed as having three components:

  1. The TOC entries, derived from the text of headings in the document

  2. The TOC field, which determines the content of the TOC

  3. The TOC styles, which determine the formatting of the TOC

Naturally, the TOC entries will vary from one document to another, based on the headings contained in that document, but there is no reason you can’t save the rest of the work you’ve done to customize your TOC. This will allow you to easily create an identical TOC in another document. As you gain more experience in creating TOCs, you will be more likely to have created something worth saving for reuse.

You can save your TOC field as an AutoText entry. If you insert it into a blank document, it will give an error message until you add some headings in the styles the TOC field is expecting, but once you have added headings, the field will function just the same as it did in the original document. It will include the same number of levels, omit page numbers from the same levels (if any), be hyperlinked or not, as you chose, and so on.

The TOC styles can be saved in a template. If you are working on a document based on a specific template other than Normal.dot, you may want to go to the Modify Style dialog and check the “Add to template” box to save your style customizations to that template. Or you can create a new template by saving the document as a template. You can either delete all the content (the style definitions will remain) or delete everything but the TOC, which will preserve the TOC field as well.

You can also use the Organizer to copy styles from one document or template to another. Moreover, you can copy and paste an entire TOC from one document to another, though it may not work correctly if the target document does not contain the styles the TOC is looking for.

To access the Organizer:

  • Word 2003 and earlier: On the Tools menu, click Templates and Add-ins. In the Templates and Add-ins dialog, click Organizer... and select the Styles tab.

  • Word 2007 and above:

    • If you have the Developer tab displayed, you can click Document Template in the Templates group to open the Templates and Add-ins dialog. Click Organizer... and select the Styles tab.

    • Otherwise, on the View tab, in the Macros group, click the top half of the Macros split button to open the Macros dialog. Click Organizer... and select the Styles tab.

Note that the TOC field and the TOC styles are separate, so you can theoretically combine content and formatting in a variety of ways. But note also that styles and content can conflict. As we have seen, it is possible to have a TOC style that is centered. It is also possible to omit numbering for one or more levels of a TOC. When a style is centered, it must omit numbering. If you try to combine a set of TOC styles that includes centered entries with a TOC field that doesn’t allow for omitting numbering at the relevant level, you’ll be in trouble.

Special considerations for Word 2007 and above

Word 2007 and above provide a gallery of prebuilt TOCs (References | Table of Contents | Table of Contents). For the purposes of most of the techniques in this article, you will want to ignore those and use Insert Table of Contents to get to a Table of Contents dialog that looks very similar to the one in Figure 2. From there you can follow most of the instructions above. Editing the TOC field is also the same in Word 2007 and above. There are, however, a few differences and possible pitfalls:

  • The Add Text button

  • Adding numbering to TOC entries

  • Saving TOC fields as AutoText

Add Text

Word's Help file claims that you can use the Add Text button to add selected text to the TOC at the desired level. You might think that this would accomplish something similar to a TC field, but it does not. What it does, at minimum, is apply a given outline level, but not just to the selected text but rather to the entire paragraph it's in (even if it's at the beginning of the paragraph). Even worse, what it does in many cases is actually apply the heading style for that level—Heading 1 for Level 1, Heading 2 for Level 2, or Heading 3 for Level 3. This may be what you want, but, if it is, it's just as easy to apply the headings from the Quick Styles gallery or Styles pane.

Additionally, you might think that using "Do Not Show in Table of Contents" on this menu would remove a heading from the TOC without removing its heading formatting (something you often want to do for the Table of Contents heading itself). Alas! no, it doesn't work that way; instead, the heading style is removed and the paragraph reverts to Normal.

Note: The headings of the TOCs in the gallery use a style called "TOC Heading" for the "Contents" or "Table of Contents" heading. This style is based on Heading 1 and looks identical, but it has an outline level of Body Text, so it doesn't appear in the TOC. You can also use this style, but first you will have to make it visible. In the Styles window, click the Manage Styles button. On the Edit tab of the Manage Styles dialog, set the order to Alphabetical and find TOC Heading. Then switch to the Recommend tab and click the Show button. You will now see this style in the Styles window and can apply it to your heading.

Numbering

Numbering also works a little differently in Word 2007 and above. It is relatively easy to apply numbering to TOC styles using the Numbering button in the Paragraph group on the Home tab, but, unless you have previously created a number format with the desired indents, you'll just get the out-of-the-box numbering, and the Adjust List Indents command will not be on the shortcut menu. It does, however, appear that you can use the ruler to adjust the indents; even though these are in conflict with those defined for the number format, they do seem to survive an update of either the style or the TOC. Alternatively, you can add Adjust List Indents to the Quick Access Toolbar (QAT). The numbering is unstable in other ways, however, so you may want to use the Define New Multilevel List to select your numbering and indents and link Level 1 to your TOC 1 style.

AutoText

Word 2007 and above do still have AutoText (as part of the Building Blocks), and you can certainly still save your TOC field as an AutoText entry if you wish: select it, press Alt+F3, choose a name for your entry, and select "AutoText" as the gallery to save it in. A better alternative, however, is to save it in the Table of Contents gallery. Another way to do this is to select the TOC and then click Save Selection to Table of Contents Gallery on the Table of Contents menu, which opens the exact same dialog, but with "Table of Contents" already selected. When you do this, your TOC will appear in the gallery that appears when you click Table of Contents on the References tab.

Get creative!

Once you understand how TOC fields work, you can get more creative about both content and formatting. Rarely is it impossible to create a TOC that does exactly what you want it to do and looks just the way you want it to look.

This article copyright © 2006, 2008, 2011, 2014, 2023 by Suzanne S. Barnhill.