The TOC (Table of Contents) field builds a table of contents. The TOC field collects entries for a table of contents using heading styles, other specified styles, outline levels, captions, or entries specified by TC (Table of Contents Entry) fields. Word inserts the TOC field when, you click Table of Contents in the Table of Contents group on the References tab.
Note: If the table of contents created by the TOC field affects the pagination of the document, you may have to update the field again to reflect the correct page numbers.
Syntax
When you view the TOC field in your document, the syntax looks like this:
{ TOC [Switches ] }
Note: A field code tells the field what to show. Field results are what’s shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.
Switches that determine what's included in the table of contents
\o "Levels"
Builds a table of contents from paragraphs formatted with styles that include outline levels (most commonly, heading styles). For example, { TOC \o "1-3" } lists only paragraphs formatted with styles that include outline levels 1 through 3. If no range of outline levels is specified, all outline levels used in the document are listed. Enclose the range numbers in quotation marks.
\t "Style,Level,Style,Level,..."
Builds a table of contents from paragraphs formatted with styles other than the built-in 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.
Note: Syntax shown here uses a comma (,) between the Style and Level parameters. A semicolon (;) is also valid, depending on which character is specified as the list separator in your operating system's regional and language settings. Because of language-specific dependencies, we recommend not using the \t switch in templates or documents that are intended for users across multiple language configurations.
You can use both the \o switch and the \t switch to build a table of contents from built-in styles and custom styles.
\u
Builds a table of contents from paragraphs whose formatting includes outline levels applied directly, in paragraph settings.
\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 (References > Insert Caption). SEQIdentifier, which corresponds to the caption label, must match the identifier in the SEQ field. For example, { TOC \c "tables" } lists all numbered tables.
\a Identifier
Lists items captioned with the Caption command (References > Insert Caption) 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.
\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 }.
\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.
\b BookmarkName
Collects entries only from the portion of the document marked by the specified bookmark.
Switches that format the page number
\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 character that separates the sequence numbers and page numbers. Enclose the character 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."
\p "Separator"
Specifies the character that separates 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. Just one character is allowed; it must be enclosed in quotation marks.
\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.
Switches that format table entries
\w
Preserves tab entries within table entries.
\x
Preserves manual line breaks within table entries.
\z
Hides tab leader and page numbers in Web layout view.
\h Hyperlinks
Inserts TOC entries as hyperlinks.
Examples
Field |
Resulting contents |
{ TOC } |
All headings formatted with the built-in heading styles. |
{ TOC \b Part1 \o "1-3" } |
All headings formatted with the built-in styles Heading 1, Heading 2, and Heading 3, in the portion of the document marked with the bookmark "Part1." |
{ TOC \c "Tables" } |
Tables that you captioned by using the Insert Caption button in the Captions group on the References tab. |
{ TOC \f m } |
Entries marked with TC fields that contain the "\f m" switch. For example, the entry marked by { TC "Map: Expeditions of Champlain" \f m } is listed, but the entry marked by { TC "The Port Royal Colony" \l 3 } isn't. |