Hack 22 Make More Flexible Captions![]() ![]() allows you to use a heading style only for the chapter number. This hack shows you how to expand your options.If you ask Word to include the chapter number in a caption, you must specify the heading level. But what if you use a style other than one of the built-in heading styles to number your chapters? By using two kinds of fields, you can have your captions use any style you like as the base for the chapter number. The following example shows you how to create a figure caption that gets its chapter number from a custom paragraph style named "ChapterLabel."Put your cursor where you want to place the caption. Next, type the word "Figure," followed by a space. Select Insert field pointing to the ChapterLabel paragraph style, as shown in Figure 3-36.
Figure 3-36. Creating a caption using a STYLEREF field![]() you've turned on the option to make field codes always visible (Tools look like Figure 3-37. If you don't see the field code, select the text you just inserted, then right-click and choose Toggle Field Codes. Figure 3-37. A STYLEREF field, one of the building blocks for a caption![]() Insert "Figure" as the identifier, as shown in Figure 3-38. Figure 3-38. Adding a SEQ field to a caption to increment the numbering![]() Figure 3-39. The figure shows two captions: the first shows the field results and the second shows the field codes. Figure 3-39. The field results (top) and the field codes used to produce the results (bottom)![]() caption text.
built-in captions feature also uses a combination of STYLEREF and SEQ fields, as shown in Figure 3-40. In this case, the captions are set to get the chapter number from the Heading 1 style. Figure 3-40. Word's caption feature also uses a combination of STYLEREF and SEQ fields![]() 3.10.1 Automating the CaptionsObviously, a macro would help you insert captions much faster. The following example comes from the macros used to insert the captions for this book: Sub InsertFigureCaption( )If the paragraph already contains text when you run this macro, it prefaces the text with a caption label. If no text exists, it inserts some dummy text for you to replace later. |