Field codes: Index field

The Index field builds and inserts an index (index: A list of the words and phrases that are discussed in a printed document, along with the page numbers they appear on.) by collecting index entries (index entry: A field code that marks specific text for inclusion in an index. When you mark text as an index entry, Microsoft Word inserts an XE (Index Entry) field formatted as hidden text.) specified by XE (Index Entry) fields. You can insert the Index field by clicking Insert Index in the Index group on the References tab.

Syntax

When you view the Index field code in your document, the syntax looks like this:

{ INDEX [Switches ] }

 Note   A field code tells the field what to show. Field results are what is shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.

Switches

\b Bookmark

Builds an index for the portion of the document marked by the specified bookmark (bookmark: A location or selection of text in a file that you name for reference purposes. Bookmarks identify a location within your file that you can later refer or link to.). The field { INDEX \b Select } builds an index for the portion of the document marked by the bookmark "Select."

\c Columns

Creates an index with more than one column on a page. The field { index \c 2 } creates a two-column index. You can specify up to four columns.

\d "Separators"

Used with the \s switch, specifies the characters (up to five) that separate sequence numbers and page numbers. The field { INDEX \s chapter \d ":" } displays page numbers in the format "2:14." A hyphen (-) is used if you omit the \d switch. Enclose the characters in quotation marks.

\e "Separators"

Specifies the characters (up to five) that separate an index entry and its page number. The { INDEX \e "; " } field displays a result such as "Inserting text; 3" in the index. A comma and space (, ) are used if you omit the \e switch. Enclose the characters in quotation marks.

\f "Identifier"

Creates an index using only the specified entry type. The index generated by { INDEX \f "a" } includes only entries marked with XE fields such as { XE "Selecting Text" \f "a" }. The default entry type is "I".

\g "Separators"

Specifies the characters (up to five) that separate a range of pages. Enclose the characters in quotation marks. The default is an en dash (–). The field { INDEX \g " to " } displays page ranges as "Finding text, 3 to 4".

\h "Heading"

Inserts text formatted with the Index Heading style (style: A combination of formatting characteristics, such as font, font size, and indentation, that you name and store as a set. When you apply a style, all of the formatting instructions in that style are applied at one time.) between alphabetic groups in the index. Enclose the text in quotation marks. The field { INDEX \h "—A—" } displays the appropriate letter before each alphabetic group in the index. To insert a blank line between groups, use empty quotation marks: \h "".

\k "Separators"

Specifies the characters that separate an index entry and its cross reference. The { INDEX \k ": " } field displays a result such as "Inserting text: See Editing" in the index. A period and space (. ) are used if you omit the \k switch. Enclose the characters in quotation marks.

\l "Separators"

Specifies the characters that separate multiple-page references. The default characters are a comma and a space (, ). You can use up to five characters, which must be enclosed in quotation marks. The field { INDEX \l " or " } displays entries such as "Inserting text, 23 or 45 or 66" in the index.

\p "Range"

Compiles an index for the specified letters. The field { INDEX \p a-m } generates an index for only the letters A through M. To include entries that begin with characters other than letters, use an exclamation point (!). The index generated by { INDEX \p !--t } includes any special characters (special character: A character or symbol that doesn't appear on the keyboard but can be displayed on the screen and printed: for example, the copyright symbol.), as well as the letters A through T.

\r

Runs subentries into the same line as the main entry. Colons (:) separate main entries from subentries; semicolons (;) separate subentries. The field { INDEX \r } displays entries such as "Text: inserting 5, 9; selecting 2; deleting 15".

\s

When followed by a sequence name, includes the sequence number with the page number. Use the \d switch to specify a separator character (separator characters: Characters you choose to indicate where you want text to separate when you convert a table to text, or where you want new rows or columns to begin when you convert text to a table.) other than the default, which is a hyphen (-).

\y

Enables the use of yomi text for index entries.

\z

Defines the language ID that Microsoft Word uses to generate the index.

Example

The field { INDEX \s chapter \d "." } builds an index for a master document (master document: A "container" for a set of separate files (or subdocuments). You can use a master document to set up and manage a multipart document, such as a book with several chapters.). Each subdocument is a chapter; the chapter titles include a SEQ field that numbers the chapters. The \d switch separates the chapter number and page number with a period (.). An index generated from this field looks similar to the following:

Aristotle, 1.2
Earth, 2.6
Jupiter, 2.7
Mars, 2.6

 
 
Applies to:
Word 2013, Word 2010