Previous: Consistency Checks, Up: The Index Phrases File

#### 5.2.3 Global Indexing

Once the index phrases have been collected and organized, you are set for global indexing. I recommend to do this only on an otherwise finished document. Global indexing starts from the phrases buffer. There are several commands which start indexing: `C-c C-x` acts on the current phrase line, `C-c C-r` on all lines in the current region and `C-c C-a` on all phrase lines in the buffer. It is probably good to do indexing in small chunks since your concentration may not last long enough to do everything in one go.

RefTeX will start at the first phrase line and search the phrase globally in the whole document. At each match it will stop, compute the replacement string and offer you the following choices1:

`y`
  Replace this match with the proposed string.
`n`
  Skip this match.
`!`
  Replace this and all further matches in this file.
`q`
  Skip this match, start with next file.
`Q`
  Skip this match, start with next phrase.
`o`
  Select a different indexing macro for this match.
`1-9`
  Select one of multiple index keys (those separated with ‘`||`’).
`e`
  Edit the replacement text.
`C-r`
  Recursive edit. Use `C-M-c` to return to the indexing process.
`s`
  Save this buffer and ask again about the current match.
`S`
  Save all document buffers and ask again about the current match.
`C-g`
  Abort the indexing process.

The ‘`Find and Index in Document`’ menu in the phrases buffer also lists a few options for the indexing process. The options have associated customization variables to set the defaults (see Options (Index Support)). Here is a short explanation of what the options do:

Match Whole Words
  When searching for index phrases, make sure whole words are matched. This should probably always be on.
Case Sensitive Search
  Search case sensitively for phrases. I recommend to have this setting off, in order to match the capitalized words at the beginning of a sentence, and even typos. You can always say no at a match you do not like.
Wrap Long Lines
  Inserting index macros increases the line length. Turn this option on to allow RefTeX to wrap long lines.
Skip Indexed Matches
  When this is on, RefTeX will at each match try to figure out if this match is already indexed. A match is considered indexed if it is either the argument of an index macro, or if an index macro is directly (without whitespace separation) before or after the match. Index macros are those configured in `reftex-index-macros`. Intended for re-indexing a documents after changes have been made.

Even though indexing should be the last thing you do to a document, you are bound to make changes afterwards. Indexing then has to be applied to the changed regions. The command `reftex-index-phrases-apply-to-region` is designed for this purpose. When called from a LaTeX document with active region, it will apply `reftex-index-all-phrases` to the current region.

#### Footnotes

[1] Windows users: Restrict yourself to the described keys during indexing. Pressing <Help> at the indexing prompt can apparently hang Emacs.