18.6 Index Support

User Option: reftex-support-index

Non-nil means, index entries are parsed as well. Index support is resource intensive and the internal structure holding the parsed information can become quite big. Therefore it can be turned off. When this is nil and you execute a command which requires index support, you will be asked for confirmation to turn it on and rescan the document.

User Option: reftex-index-special-chars

List of special characters in index entries, given as strings. These correspond to the MakeIndex keywords (level encap actual quote escape).

User Option: reftex-index-macros

List of macros which define index entries. The structure of each entry is

(macro index-tag key prefix exclude repeat)

macro is the macro. Arguments should be denoted by empty braces, as for example in ‘\index[]{*}’. Use square brackets to denote optional arguments. The star marks where the index key is.

index-tag is a short name of the index. ‘idx’ and ‘glo’ are reserved for the default index and the glossary. Other indices can be defined as well. If this is an integer, the Nth argument of the macro holds the index tag.

key is a character which is used to identify the macro for input with reftex-index. ‘?i’, ‘?I’, and ‘?g’ are reserved for default index and glossary.

prefix can be a prefix which is added to the key part of the index entry. If you have a macro \newcommand{\molec}[1]{#1\index{Molecules!#1}, this prefix should be ‘Molecules!’.

exclude can be a function. If this function exists and returns a non-nil value, the index entry at point is ignored. This was implemented to support the (deprecated) ‘^’ and ‘_’ shortcuts in the LaTeX2e index package.

repeat, if non-nil, means the index macro does not typeset the entry in the text, so that the text has to be repeated outside the index macro. Needed for reftex-index-selection-or-word and for indexing from the phrase buffer.

The final entry may also be a symbol. It must have an association in the variable reftex-index-macros-builtin to specify the main indexing package you are using. Valid values are currently

default         The LaTeX default; unnecessary to specify this one
multind         The multind.sty package
index           The index.sty package
index-shortcut  The index.sty packages with the ^ and _ shortcuts.
                Should not be used; only for old documents

Note that AUCTeX sets these things internally for RefTeX as well, so with a sufficiently new version of AUCTeX, you should not set the package here.

User Option: reftex-index-default-macro

The default index macro for reftex-index-selection-or-word. This is a list with (macro-key default-tag).

macro-key is a character identifying an index macro; see reftex-index-macros.

default-tag is the tag to be used if the macro requires a tag argument. When this is nil and a tag is needed, RefTeX will ask for it. When this is the empty string and the TAG argument of the index macro is optional, the TAG argument will be omitted.

User Option: reftex-index-default-tag

Default index tag. When working with multiple indexes, RefTeX queries for an index tag when creating index entries or displaying a specific index. This variable controls the default offered for these queries. The default can be selected with RET during selection or completion. Valid values of this variable are:

nil        Do not provide a default index
"tag"      The default index tag given as a string, e.g., "idx"
last       The last used index tag will be offered as default
User Option: reftex-index-math-format

Format of index entries when copied from inside math mode. When reftex-index-selection-or-word is executed inside TeX math mode, the index key copied from the buffer is processed with this format string through the format function. This can be used to add the math delimiters (e.g., ‘$’) to the string. Requires the texmathp.el library which is part of AUCTeX.

User Option: reftex-index-phrase-file-extension

File extension for the index phrase file. This extension will be added to the base name of the master file.

User Option: reftex-index-phrases-logical-and-regexp

Regexp matching the ‘and’ operator for index arguments in phrases file. When several index arguments in a phrase line are separated by this operator, each part will generate an index macro. So each match of the search phrase will produce several different index entries. Make sure this does no match things which are not separators. This logical ‘and’ has higher priority than the logical ‘or’ specified in reftex-index-phrases-logical-or-regexp.

User Option: reftex-index-phrases-logical-or-regexp

Regexp matching the ‘or’ operator for index arguments in phrases file. When several index arguments in a phrase line are separated by this operator, the user will be asked to select one of them at each match of the search phrase. The first index arg will be the default. A number key 19 must be pressed to switch to another. Make sure this does no match things which are not separators. The logical ‘and’ specified in reftex-index-phrases-logical-or-regexp has higher priority than this logical ‘or’.

User Option: reftex-index-phrases-search-whole-words

Non-nil means phrases search will look for whole words, not subwords. This works by requiring word boundaries at the beginning and end of the search string. When the search phrase already has a non-word-char at one of these points, no word boundary is required there.

User Option: reftex-index-phrases-case-fold-search

Non-nil means, searching for index phrases will ignore case.

User Option: reftex-index-verify-function

A function which is called at each match during global indexing. If the function returns nil, the current match is skipped.

User Option: reftex-index-phrases-skip-indexed-matches

Non-nil means, skip matches which appear to be indexed already. When doing global indexing from the phrases buffer, searches for some phrases may match at places where that phrase was already indexed. In particular when indexing an already processed document again, this will even be the norm. When this variable is non-nil, RefTeX checks if the match is an index macro argument, or if an index macro is directly before or after the phrase. If that is the case, that match will be ignored.

User Option: reftex-index-phrases-wrap-long-lines

Non-nil means, when indexing from the phrases buffer, wrap lines. Inserting indexing commands in a line makes the line longer, often so long that it does not fit onto the screen. When this variable is non-nil, newlines will be added as necessary before and/or after the indexing command to keep lines short. However, the matched text phrase and its index command will always end up on a single line.

User Option: reftex-index-phrases-sort-prefers-entry

Non-nil means when sorting phrase lines, the explicit index entry is used. Phrase lines in the phrases buffer contain a search phrase, and sorting is normally based on these. Some phrase lines also have an explicit index argument specified. When this variable is non-nil, the index argument will be used for sorting.

User Option: reftex-index-phrases-sort-in-blocks

Non-nil means, empty and comment lines separate phrase buffer into blocks. Sorting will then preserve blocks, so that lines are re-arranged only within blocks.

User Option: reftex-index-phrases-mode-map

Keymap for the Index Phrases buffer.

User Option: reftex-index-phrases-mode-hook

Normal hook which is run when a buffer is put into reftex-index-phrases-mode.

User Option: reftex-index-section-letters

The letters which denote sections in the index. Usually these are all capital letters. Don’t use any downcase letters. Order is not significant, the index will be sorted by whatever the sort function thinks is correct. In addition to these letters, RefTeX will create a group ‘!’ which contains all entries sorted below the lowest specified letter. In the *Index* buffer, pressing any of these capital letters or ! will jump to that section.

User Option: reftex-index-include-context

Non-nil means, display the index definition context in the *Index* buffer. This flag may also be toggled from the *Index* buffer with the c key.

User Option: reftex-index-follow-mode

Non-nil means, point in *Index* buffer will cause other window to follow. The other window will show the corresponding part of the document. This flag can be toggled from within the *Index* buffer with the f key.

Keymap: reftex-index-mode-map

The keymap which is active in the *Index* buffer (see Index Support).