Creating Run-in Sideheads

Home Tutorials My MVP FAQs Useful Links

 

How can I include just part of a paragraph in my table of contents?

Word’s Help file, under “Create a table of contents,” is very helpful in explaining how to create a table of contents based on styles (built-in or custom), outline levels, and TC fields. In addition Word MVP Shauna Kelly’s article “How to create a table of contents in Microsoft Word” gives step-by-step instructions. Styles and outline levels are so easy to use that most users never get around to figuring out TC fields, and so sometimes they run into trouble.

As long as the heading you want included in the TOC is a complete paragraph, there is no problem, but what if you have a “run-in sidehead”? That is, suppose you have a document in the following form:

How are you going to get the Heading 3 into the TOC without including all the text that follows it? There are three ways.

TC fields

The oldest and often still best solution is to use a TC field. Word’s Help (under “Field codes: TC (Table of Contents Entry) field”) is pretty good on this subject, too. You insert a field in the paragraph (immediately preceding or following the heading portion is a reasonable place, but anywhere that is bound to be on the same page with the heading will do), specifying the text you want to appear in the TOC and the appropriate level. In the case of the example heading, that field would look like this:

{ TC "But now you want a Heading 3 that is part of a text paragraph" \l 3 }

You can construct the field by hand (by pressing Ctrl+F9 to insert the field delimiters—those things that look like braces but can’t be typed from the keyboard—and typing the text between them), by using Insert | Field (in Word 2007, this is Insert | Text | Quick Parts | Field), or—most easily—by pressing Alt+Shift+O. If you select the heading text before using this keyboard shortcut, the text will already be inserted in the Mark Table of Contents Entry dialog, and you need only change the level to 3, then press Enter to mark the text and Enter again to close the dialog. The required field is automatically inserted following the text. The field that Word will insert will look like this:

{ TC "But now you want a Heading 3 that is part of a text paragraph" \f C \l "3" }

The “\f C” switch tells Word you want this entry in your main table of contents. If you have only one, this switch is unnecessary, but if you want to have more than one, you can use different “type identifiers” (usually letters from A to Z) to direct the entries to different TOCs. [I have no idea why Word puts the level number in quotes; the Help article does not show this, and it is not necessary.]

When you insert a table of contents in your document using Insert | Index and Tables (Insert | Reference | Index and Tables in Word 2002 and 2003; References | Table of Contents | Table of Contents in Word 2007), be sure to check the box for “Table entry fields” in the Options dialog (along with “Styles” if you’re picking up built-in heading styles for other levels). This inserts the \f switch that is required in the TOC field to tell Word to use TC fields.

All of the above is well documented in Word’s Help, in the “Create a table of contents from entries you mark yourself” section of the “Create a table of contents” article.

Hidden paragraph mark

Although TC fields are really quite easy to use once you get the hang of them, if you have no experience using fields, you may be looking for another way. There is a workaround that many users have relied on through many versions of Word and that works so well that Microsoft has imitated it (see next section).

Using this method you type your heading and following text as separate paragraphs:

But now you want a Heading 3 that is part of a text paragraph.

Ut wisi enim ad minim veniam, etc.

Format the first paragraph as Heading 3 (or whatever style you’re using for this heading level) and the second paragraph as Body Text (or whatever text you’re using for the text paragraphs).

If you don’t have nonprinting characters displayed, press the Show/Hide ¶ button () on the Standard toolbar to display them. You should see your paragraphs like this:

But now you want a Heading 3 that is part of a text paragraph.

Ut wisi enim ad minim veniam, etc.¶

Select just the paragraph mark (¶) at the end of the first paragraph (your heading) and format it as Hidden (Ctrl+Shift+H or go to Format | Font and check the box for “Hidden”). You will not immediately see any change, but when you press the Show/Hide ¶ button again, your two paragraphs will sweetly join.

Three caveats:

  1. If your Body Text style is justified, your heading style must also be justified, or else the first line of your paragraph will not be justified.

  2. You must hide nonprinting characters (or at least Hidden text) before generating your TOC, or the page numbers will very likely be wrong.

  3. This method may not work with numbered headings: hiding the paragraph mark may hide the numbering as well (it does work in Word 2003, but I can’t guarantee it in earlier versions).

Style separator

If you have Word 2002 or above, you can use a new feature in that version that works very similarly to the Hidden paragraph mark but is transparent to the user (it doesn’t display two separate paragraphs even when Hidden text is displayed).

To use this feature, compose your paragraph, heading and all, in your Body Text style. Then select just the portion you want to be your heading and apply the appropriate heading style. Word “paints” the heading style over the underlying paragraph style, in effect using a character style that mimics the heading’s font formatting (but not its paragraph formatting, incidentally, so if you need Space Before, you’ll need to add it to the Body Text style). A “style separator” is said to be inserted between the heading and body text portions of the paragraph, but the user cannot view this, so you have to take Microsoft’s word that it is there.1

Don’t use this feature if you must share documents with users of earlier versions of Word, as it may not be fully backward-compatible. For more information on this feature, see the Microsoft Knowledge Base article “WD2002: How to Create Table of Contents by Marking Text.”

If you want to use heading numbering with your run-in sideheads, you will need to apply SP‑1 to Word 2002 to assure that this feature works correctly. For more on this, see “WD2002: Heading Numbers Do Not Appear in Table of Contents.”

__________________

1You can insert the style separator yourself if you like. Find the command (InsertStyleSeparator in the All Commands category) on the Commands tab of Tools | Customize and drag it to a menu or toolbar. As far as I can see, there is little to be gained by this: you still have to apply the heading style to the portion of the paragraph before the style separator.

This article copyright © 2002, 2004, 2008 by Suzanne S. Barnhill.