Applies ToWord for Microsoft 365 Word for Microsoft 365 for Mac Word 2024 for Mac Word 2021 Word 2021 for Mac Word 2019 Word 2019 for Mac Word 2016

The Index field builds and inserts an index by collecting index entries 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. 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 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, 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 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. 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.2Earth, 2.6Jupiter, 2.7Mars, 2.6

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.