Office Settings & Configuration

Configure Word Table of Contents Styles with TOC Field Codes

Steven ParkerSteven Parker Nov 25, 2026 868 views

Question details

Configure which custom styles appear at each level of a Word table of contents and investigate unexpected paragraph formatting.

Configure Word Table of Contents Styles with TOC Field Codes
Product
Microsoft Word
Device & OS
Windows 10
Scenario
A document uses custom title and header styles that need to be included at specific table of contents levels.
Observed behavior
Word does not retain the selected custom styles in the Table of Contents dialog, and ordinary paragraphs appear with heading formatting after the table is updated.
Before you start

Identify the exact names of the paragraph styles to include and the TOC level each should use. Click a sample paragraph and check its style in Home > Styles.

Solution 1Recommended

Map styles to TOC levels with the Word TOC field code

Use the TOC field's \t switch when the Table of Contents Options dialog does not retain your style selections.

1
Show the field code

Click the existing table of contents and press Alt+F9 to display field codes in the document.

2
Edit the style mapping

In the existing TOC field, replace the \o switch with a \t mapping. For example, use { TOC \t "Heading 1,1" \h } to include Heading 1 at TOC level 1. For custom styles, use their exact names, such as { TOC \t "Custom Title,1,Custom Header,2" \h }.

3
Update the table

Click inside the TOC field and press F9. If prompted, choose Update entire table, then press Alt+F9 to show the table instead of the field code.

4
Check paragraph styles

If ordinary paragraphs still appear as headings, click an affected paragraph and check Home > Styles. Apply the intended body-text style if it has an incorrect heading or custom style.

Map styles to TOC levels with the Word TOC field code
Use the existing field braces: Edit the code inside the existing Word field; ordinary typed braces do not create a field. Depending on your regional settings, Word may use a different list separator in the \t mapping.
Free Microsoft Office alternative

Work with styled documents in WPS Writer

WPS Office is a free, lightweight alternative with a familiar interface for working with Word documents. Open compatible files in WPS Writer to continue editing and ease your migration from Microsoft Office; it does not repair Word's TOC settings.

Use paragraph styles and table of contents tools in WPS WriterOpen and edit Microsoft Word DOC and DOCX filesNavigate a familiar Office-style interfaceUse a free, lightweight office suite
QA img-9

Frequently Asked Questions

How do I include more than one custom style in the TOC?

Press Alt+F9 and add each style name and level to the \t switch, for example: \t "Custom Title,1,Custom Header,2". Click the field and press F9 to update it.

Why are ordinary paragraphs appearing in my table of contents?

They may have a style included in the TOC mapping. Click an affected paragraph and check Home > Styles, then apply the appropriate body-text style if needed.

How can I show the table again after editing its field code?

Press Alt+F9 to toggle field codes back to their results. If the table has not refreshed, click it and press F9.

What is the difference between the \o and \t switches?

The \o switch includes built-in heading levels in a specified range, while \t maps named styles to TOC levels. Remove \o if you want the field to use only the styles specified by your \t mapping.