Software

Master Word's table of contents feature with styles

How many ways can you build a table of contents in Word? TechRepublic columnist Jeff Davis presents reader tips and more in this sequel to his crash course.


TechRepublic members responded with vigor to "A crash course in building a table of contents in Word." Many readers who had been generating tables of contents manually, expressed sheer joy at finally getting how Word's TOC works. Other readers sent in TOC tips of their own, and nearly everyone wanted more. This week, I'll share some more TOC tips and a crash course in how styles affect the TOC.

A word about the Word version covered (2000)
After reading the crash course, TechRepublic members Dean A. and Jax rightfully busted my chops for failing to mention what version of Word I was using to illustrate the techniques. Jax, a Word 97 user, wrote that he had trouble finding some of the menu paths I mentioned. Dean points out that my instruction to display the Index And Tables dialog, "go to Insert | Index And Tables," doesn't work in Word XP, where the correct instruction starts with "go to Insert | Reference."

For the record, unless I'm referring specifically to another version, I'll use Word 2000 when I capture screen shots or describe a sequence of instructions.

Best practice for placing the TOC
TechRepublic member Interested Participant wrote: "It is good that you have opened the eyes of many to the use of Styles and of the TOC. They save so much time and effort. I wish more people would use them both.

"However, I suggest the use of section breaks on either side of the TOC, instead of page breaks. With section breaks, one can have different styles of page numbers (i, ii, iii, etc.), and each section can have different first page. This works much better for large documents, where the TOC may be pages long, yet should not be included in the body of the document's page numbering."

I like this idea so much, I'm making it my standard operating procedure. My typical approach to creating a long document has been to create placeholders for the title page and table of contents page. I type TITLE PAGE, press [Ctrl][Enter] to issue a hard page break, type TOC, do another hard page break, and then start the body of the document. However, if you don't want those pages counted in the number of pages, you're going to have to create a section break anyway. It makes good sense to take Interested Participant's advice and use section page breaks on either side of the TOC page.

Troubleshooting the TOC
When too much text is hitting the TOC, don't panic. Here’s a troubleshooting tip to help you resolve a common problem: Check for manual line breaks (soft returns).

TechRepublic member MicroBrat wrote: "I copied your [crash course] article into Word and tried to set up a TOC as I read it. I ran into problems trying to change the style to Heading 1 because the heading was linked to the whole paragraph. I copied those sections, then selected Paste Special | Unformatted Text. Then I was able to change the Style. This might have been the hard way to do it, but it worked."

It was easy to replicate MicroBrat's dilemma. Because I work with my hidden characters visible, I saw right away that the heading was linked to the whole paragraph because what was copied and pasted into the Word document was a manual line break, or a so-called soft return. (You enter a manual line break in all versions of Word by pressing [Shift][Enter].)

MicroBrat's solution is probably the best way to copy-and-paste a pure copy of almost any text from the Web into a Word document. (If you don’t want to go through the Edit menu every time you need to paste unformatted text, read "Use this Word macro to paste unformatted text quickly and easily," by TechRepublic’s Bill Detwiler.)

Here's the lesson for the TOC troubleshooter: If the first paragraph of a chapter or section is showing up in the TOC along with the chapter or section title, check for a manual line break at the end of the title. It's possible to format the title and the first paragraph so that they appear different, even though they're part of the same paragraph. Put a hard line break between the title and the first paragraph. Your title should be fine. Then apply a different paragraph-level style—one without a TOC component—to the first paragraph.

A matter of style
Several TechRepublic members wrote to say they appreciated learning about the connection between styles and the TOC. However, they believe that many of their users simply don’t understand paragraph-level styles. So even after learning how to apply styles in the first crash course, those users still would have trouble generating their own TOC. Based on that feedback, here is a quick explanation of what a style is, and how it works in Microsoft Word.

To start, let’s talk about character-level formatting attributes. Beginning Word users quickly learn how to apply attributes such as bold, underline, and italics. Adding or removing character-level formatting will change the appearance of your text, but it doesn’t change the way your paragraphs appear. Some people refer to bold, underline, and italics as character-level styles, which can be confusing for users trying to grasp the concept of a paragraph-level style.

For the purposes of this lesson, let’s define a style as a named set of formatting attributes that affect how a paragraph appears in a Word document. When you apply a style to a paragraph, Word formats that paragraph using the attributes associated with the style. Of course, you can include bold, underline, and italics as part of a paragraph-level style definition. However, the real benefit of using styles is they store attributes such as font, margins, indents, and vertical line spacing—attributes that affect how an entire paragraph appears.

For example, Figure A shows a sample line of text formatted with the Bodycopy style defined in TechRepublic’s template for contributing writers. (The definition of the style comes from a screen shot of the Style dialog.) Here’s a breakdown of the attributes stored in that style definition:
  • Normal + Font: Arial tells us that the Bodycopy style was based on the Normal style, which is part of all Word documents. Font: Arial means the person who defined the style selected Arial as the font.
  • Indent: First 0.13" tells Word to indent the first line of the paragraph by 0.13 inches.
  • Line spacing at least 12 pt is a paragraph-level formatting attribute that defines the vertical line spacing within the paragraph.

Figure A
The Bodycopy style’s definition includes Indent: First 0.13, which tells Word to indent the first line of the paragraph. That attribute is reflected on the ruler.


So how do you get your feet wet defining your own styles? In Word 2000, go to Format | Style. At this point, you can either create a new style definition or modify an existing one.

To create a new style, click the New button, type a name for the style, and then click the Format button. To modify an existing style, click on the style name in the Styles list, click the Modify button, and then click the Format button. In either case, clicking the Format button displays the pop-up menu of options shown in Figure B. You can visit each of those options in turn, selecting various formatting options to be stored in the named style.

Figure B
When you create or modify a style definition, these are the general categories of attributes at your disposal. Selecting any of these options summons a dialog with various formatting options.


Note: To make sure your custom style is applied to the table of contents, select the Paragraph option, and click on the Outline Level drop-down menu and choose any option other than Body Text, such as Level 1, Level 2, or Level 3.

After you’re satisfied with your style selections, click OK until you reach the Style dialog again, and then click Apply.

Triggering new styles automatically
Perhaps the easiest way to apply an existing style to a paragraph is to click in or select the paragraph, and then select the appropriate style name from the Style drop-down list on the Formatting toolbar. However, you can also apply some styles automatically, just by pressing [Enter].

The New Style and Modify Style dialog boxes also have an option labeled Style For Following Paragraph. That option bewilders many beginning Word users. However, it’s one of the most useful features for formatting complicated documents. Here’s how it works.

Suppose that, in the Style For Following Paragraph drop-down list, you select the same style as the one you’re currently defining or modifying. Then you apply that style to a new paragraph in your Word document. When you press [Enter] to end that paragraph, that same style will be carried forward to the new paragraph.

If you select a different style in the Style For Following Paragraph, something very different happens when you press [Enter]. Instead of carrying the old style forward, Word will format the new paragraph using the style you specified as the Style For Following Paragraph.

Using named styles to format paragraphs is a powerful timesaving tool. Once you figure out how to create and apply your own styles, you’ll never manually format a paragraph again.

Enter feedback here
To comment on this tip, or to share your own tips for generating a table of contents, please post a comment or write to Jeff.

 

Editor's Picks