Cross-references are one of Word’s most useful features, but users are often dissatisfied with the way they are formatted. This article will discuss how to force Word to use your preferred formatting. First, however, it will explain what a cross-reference is and how to insert one. If you already know all that, you can jump immediately to the section that interests you.
What is a cross-reference?
You probably know in general what a cross-reference is. Whenever you write, “see page 15” or “in Chapter 5” or “in the Further Developments section,” you are using a cross-reference.
If you insert such cross-references as ordinary text, you will have to update them manually if pagination changes or Chapter 5 becomes Chapter 6 or you change the heading “Further Developments” to “Later Developments.” Word, however, provides a way to insert a cross-reference so that it can be updated semi-automatically when the target changes.
How to insert a cross-reference?
In all versions of Word, you insert a cross-reference using the Cross-reference dialog. How you get there depends on the version:
As you can see in Figure 1, the dialog offers two dropdowns: “Reference type” and “Insert reference to.” The reference types offered include Numbered item, Heading, Bookmark, Footnote, Endnote, Equation, Figure, and Table, plus any other caption labels you have defined (“My New Caption” in Figure 1). What this means is that you can easily insert a cross-reference to any paragraph formatted with one of Word’s built-in heading styles, any paragraph that has been numbered using Word’s Numbering feature, or any footnote, endnote, or caption. This is possible because Word creates built-in “bookmarks” for these items. You can also insert a cross-reference to any other text (or the number of the page on which that text appears) if you first insert a bookmark around or in that text using Insert | Bookmark (Insert | Links | Bookmark in Word 2007 and above). You then select Bookmark as the reference type.
When you select a specific reference type, the box below will be populated with a list of the available choices. You will be asked to specify “For which heading” or “For which numbered item” or “For which bookmark,” choosing from among those listed.
Each reference type offers different options for “Insert reference to.” In most cases, these include the bookmarked text itself and the number of the page on which it appears, along with the paragraph number if the paragraph is numbered. If you select each of the reference types in turn and inspect the “Insert reference to” dropdown, you will see the various options.
The Cross-reference dialog also includes a check box for “Insert as hyperlink.” If you check this box, your cross-reference will be hyperlinked to the referenced item, and anyone who is reading your document electronically (as opposed to printout on paper) will be able to click (or Ctrl+click) on it and go to the referenced item. There is no reason not to choose this option since the cross-reference will not be formatted as a hyperlink (blue and underlined).
At this point it will be useful to introduce some Important Concepts about cross-references.
A cross-reference is a field.
Word’s Help defines field as “A set of codes that instructs Microsoft Word to insert text, graphics, page numbers, and other material into a document automatically. For example, the DATE field inserts the current date.” The field inserted by the Cross-reference dialog may be a REF field or a PAGEREF field (if “Page number” has been selected under “Insert reference to”) or a NOTEREF field (if the cross-reference is to the number of a footnote or endnote).
Fields have two appearances.
What you normally see in a document is the result of a field. For example, if you insert a DATE field, you see the current date. If you insert a PAGE field, you see the page number. This result, however, is achieved by a field code. You can see this field code by “toggling” the display. There are several ways to do this:
Fields can be modified with switches.
When you view a field code, you will often see text after the name of the field. For example, in a DATE field, you might see something like \@ "MMMM d, yyyy". In many Word fields you will also see \* MERGEFORMAT. The text that follows backslashes in a field is a “switch.” Word’s Help doesn’t define a field switch, but perhaps it will help to think of it as analogous to a railroad switch, which directs a train to one track or another. The field switch tells Word something about how to present the value that results from the field. The “date-time picture” switch quoted above tells Word to present the date as, say, “September 18, 2009” instead of 9/18/09 or 18 September 2009 or any other date format (see my article on date fields for more).
If you checked the box for “Insert as hyperlink” in the Cross-reference dialog, you will see the \h switch in your REF or PAGEREF or NOTEREF field code.
Fields can be edited by the user.
Many of the dialogs that make it easy to insert fields in Word (not just the Cross-reference dialog but also others that insert index entry fields, date fields, page numbers, and so on, as well as the Insert | Field dialog itself) often have dropdown lists or check boxes that allow you to choose certain formatting options, but sometimes the only way to achieve the effect you want is to edit the field directly by displaying the field code and typing in text manually. This includes adding switches to control the appearance of the field (for examples, see my article on TOC switches).
Fields can be formatted.
You can apply formatting to fields. Sometimes that formatting is wiped out when you update the field. Below I will describe some ways to ensure that fields retain the formatting you prefer.
Fields can be found with Find and formatted with Replace.
Some of the techniques described below rely on searching for fields using Word’s Find dialog. You can search for any field by using the code ^d or ^19 followed by a space and the field name. For this to work, however, you must have field codes displayed (use Alt+F9 to toggle the display).
Formatting NOTEREF fields
If you insert a cross-reference such as “see footnote 22,” you ordinarily want the number to be formatted like the surrounding text. But sometimes you use a cross-reference to a footnote or endnote number to stand in for a footnote/endnote reference mark. For example, you have inserted footnote 22, and now you want to refer to that same footnote again. The footnote reference mark is (by default) superscript, and so you want the cross-reference to be superscript as well.
Fortunately, this is one of the easiest formatting tasks. When you insert the cross-reference, instead of choosing “Footnote number” or “Endnote number,” select “Footnote number (formatted)” or “Endnote number (formatted).” This will add the \f switch to the NOTEREF field.
If you belatedly discover that you have omitted to make the correct choice, you can manually edit the NOTEREF field in either of two ways. You can press Alt+F9 to display the field code and manually type in the \f switch, then Alt+F9 to toggle back (and F9 to update the field). Or you can right-click on the field, choose Edit Field, and check the box for “Insert reference mark.”
Change the case of a cross-reference
Suppose you have inserted a cross-reference to Figure 1 or Chapter 5, but the style you are following requires your cross-reference to say “figure 1” or “chapter 5.” You can achieve this by using a format (\*) switch. Word’s Help describes these switches for capitalization formats, number formats, and character formats in the Help topic “Format (\*) field switch.” What we want here are the capitalization switches, which Help lists as follows, with a description of what each one capitalizes:
Again, there are two ways to add one of these switches to your REF field. You can display the field code and manually type in the switch. Or you can right-click, choose Edit Field, and choose an option from the Format dropdown (where they are listed as Uppercase, Lowercase, First capital, and Title case).
Change the font formatting of a cross-reference
There are two format switches that can be added to fields that affect font formatting. The \* MERGEFORMAT switch is applied to field results (the text displayed by the field), and the \* Charformat switch is applied to the field itself.
There are various reasons why you might want to apply direct font formatting to a REF field. For example, the Caption style by default is formatted as bold. But if you think that is ugly, you may have modified the style to be not bold, but perhaps you have applied bold formatting to just the caption number, so that you have something like this:
If you cross-reference the figure number, you will get “See Figure 1.” You can remove the bold formatting, but every time the field is updated, the bold will return. Fortunately, you can override this behavior with one of the format switches.
The \* MERGEFORMAT switch (not recommended)
The \* MERGEFORMAT switch is added by default to many fields that you insert in Word (unless you enter them yourself manually by pressing Ctrl+F9 and typing the field syntax). The switch is represented in some field dialogs by a check box labeled “Preserve formatting during updates.” This means that you can apply, say, bold formatting to a DATE field, and, even if the date changes, the text in the document will remain bold.
As it happens, the \* MERGEFORMAT switch is not included by default in cross-references, but there are times when it might be useful, and there are times when it appears automatically. When you apply formatting to any other field, the field result displays the formatting and retains it through updates. If you apply formatting to a REF field, however, Word automatically adds a \* MERGEFORMAT switch to the field. This may or may not be what you want (if you don’t want it, note that the Undo list will include “Automatic Change,” which you can Undo).
The advantage to using this switch is that it allows you to apply formatting to just a portion of the field. For example, suppose you have a heading reading “This is a heading.” In your cross-reference, you want to italicize “heading” so that it reads “This is a heading.” If you add \* MERGEFORMAT, Word will preserve this formatting through updates.
The catch is that Word applies the formatting very literally. You have italicized the fourth word of the heading. If the heading changes to, say, “This is a different heading,” then your cross-reference will read “This is a different heading.”
On the other hand, suppose you have cross-referenced an entire figure caption, including the label and number along with the caption text. You want the figure label and number to be bold and the caption text italic. You can apply this formatting to the cross-reference text, add a \* MERGEFORMAT switch, and hope for the best. Provided the caption does not become longer, you will be home free. For example, if the caption is “Figure 1. This is a figure,” then your cross-reference will say, “Figure 1. This is a figure.” If the figure number changes, you’re still okay. But if you add the word different, you will get “Figure 1. This is a different figure.”
To achieve the desired result unbreakably, you would need to insert two cross-references, one to “Only label and number” and one to “Only caption text” and format them individually (and for that you might as well use the \* Charformat switch.
As you can see, there are good and sufficient reasons why \* MERGEFORMAT is not recommended for REF fields. Another of these is that, if a user-defined bookmark is inadvertently deleted, the REF field will display “Error! Reference source not found,” and this error message will be formatted as bold. Even if you correct the error by restoring the bookmark, the updated field will remain bold. A better solution for formatting, then, is the \* Charformat switch.
The \* Charformat switch (recommended)
Word’s Help describes this switch as follows:
Although it suffices to format just the first letter of the field code, it works just as well to apply the desired formatting to the entire field (which is what we will later do with the Replace dialog).
Since the behavior of the \* MERGEFORMAT switch is so quirky and the behavior of the \* Charformat switch so reliable (albeit limited), it is hard to see why Word seems so bent on adding the \* MERGEFORMAT switch instead. If for any reason you find that \* MERGEFORMAT is not giving the results you want, you will be well advised to try using a \* Charformat switch instead.
Formatting hyperlinked cross-references
We said above that hyperlinked cross-references do not display the Hyperlink character style (blue and underlined). Even if you manually apply the Hyperlink style, the cross-reference will still not be blue and underlined (Word can be very stubborn sometimes). You can, however, apply blue font color and underlining as direct font formatting and add the \* MERGEFORMAT or \* Charformat switch, and the cross-reference will remain blue and underlined even after being updated.
A better approach than direct formatting, however, is to apply a character style. If you don’t know how to create a character style, see the instructions in my article on the StyleRef field. Note that this doesn’t have to be blue and underlined; you can use any formatting you choose to signal to readers that the marked words are a hyperlink. For example, one user wanted to distinguish them with a pale yellow highlight; this can be achieved with a character style that applies yellow shading to the text. The advantage to a style in this latter case is that text shading cannot be applied using Find and Replace (though you can apply a Highlight that way).
Changing the formatting of multiple cross-references
Now we come to the nitty-gritty of this article. Suppose you have already inserted dozens (perhaps hundreds) of cross-references that are not formatted the way you want them, and you want to change them. Fortunately, this is possible using Find and Replace.
Applying formatting to all REF fields
As mentioned above, fields can be found and formatted using Word’s Replace dialog. The code for an opening field brace is ^d or (if you are using wildcards) ^19. So if you search for ^19 REF, Word will find every REF field in the document. If you type that string in the “Find what” box, you can then leave the “Replace with” box empty and simply apply formatting. To do this:
Applying formatting only to hyperlinked cross-references
The procedure above will format all cross-references. But perhaps you have some that are hyperlinked and some that are not, and you want to format only the hyperlinked ones. This is also easy to do, because the hyperlinking is indicated in the REF field by the \h switch.
To format only hyperlinked REF fields, use the steps listed above with two modifications:
The wildcard * stands for “0 or More Characters,” so this string will find a REF field with any amount of text between the REF identifier and the \h switch. If you find that Word is selecting more text than a single field, you may want to use Find Next instead of Replace All so that you can verify the placement before clicking Replace.
Applying formatting and adding a format switch
As you’ve seen, applying formatting is pretty easy. But if you want to apply the formatting and preserve it from updates, you will want to insert the \* Charformat switch as part of your Replace operation. This, too, can be done. It is relatively simple for hyperlinked REF fields and only a little more complex for ones that are not hyperlinked.
The instructions below will use the same steps outlined above, with just a few changes. You will need the following advance preparation:
This article copyright © 2009, 2011, 2014, 2016 by Suzanne S. Barnhill. I am indebted to Word MVPs Lene Fredborg, Jay Freedman, Graham Mayor, and Tony Jollans, who contributed helpful suggestions.