17 Commands

Here is a summary of RefTeX’s commands which can be executed from LaTeX files. Command which are executed from the special buffers are not described here. All commands are available from the Ref menu. See Default Key Bindings.

Command: reftex-toc

Show the table of contents for the current document. When called with one or two C-u prefixes, rescan the document first.

Command: reftex-label

Insert a unique label. With one or two C-u prefixes, enforce document rescan first.

Command: reftex-reference

Start a selection process to select a label, and insert a reference to it. With one or two C-u prefixes, enforce document rescan first.

Command: reftex-citation

Make a citation using BibTeX database files. After prompting for a regular expression, scans the buffers with BibTeX entries (taken from the \bibliography command or a thebibliography environment) and offers the matching entries for selection. The selected entry is formatted according to reftex-cite-format and inserted into the buffer.
When called with a C-u prefix, prompt for optional arguments in cite macros. When called with a numeric prefix, make that many citations. When called with point inside the braces of a \cite command, it will add another key, ignoring the value of reftex-cite-format.
The regular expression uses an expanded syntax: ‘&&’ is interpreted as and. Thus, ‘aaaa&&bbb’ matches entries which contain both ‘aaaa’ and ‘bbb’. While entering the regexp, completion on knows citation keys is possible. ‘=’ is a good regular expression to match all entries in all files.

Command: reftex-index

Query for an index macro and insert it along with its arguments. The index macros available are those defined in reftex-index-macro or by a call to reftex-add-index-macros, typically from an AUCTeX style file. RefTeX provides completion for the index tag and the index key, and will prompt for other arguments.

Command: reftex-index-selection-or-word

Put current selection or the word near point into the default index macro. This uses the information in reftex-index-default-macro to make an index entry. The phrase indexed is the current selection or the word near point. When called with one C-u prefix, let the user have a chance to edit the index entry. When called with 2 C-u as prefix, also ask for the index macro and other stuff. When called inside TeX math mode as determined by the texmathp.el library which is part of AUCTeX, the string is first processed with the reftex-index-math-format, which see.

Command: reftex-index-phrase-selection-or-word

Add current selection or the word at point to the phrases buffer. When you are in transient-mark-mode and the region is active, the selection will be used; otherwise the word at point. You get a chance to edit the entry in the phrases buffer; to save the buffer and return to the LaTeX document, finish with C-c C-c.

Command: reftex-index-visit-phrases-buffer

Switch to the phrases buffer, initialize if empty.

Command: reftex-index-phrases-apply-to-region

Index all index phrases in the current region. This works exactly like global indexing from the index phrases buffer, but operation is restricted to the current region.

Command: reftex-display-index

Display a buffer with an index compiled from the current document. When the document has multiple indices, first prompts for the correct one. When index support is turned off, offer to turn it on. With one or two C-u prefixes, rescan document first. With prefix 2, restrict index to current document section. With prefix 3, restrict index to active region.

Command: reftex-view-crossref

View cross reference of macro at point. Point must be on the key argument. Works with the macros \label, \ref, \cite, \bibitem, \index and many derivatives of these. Where it makes sense, subsequent calls show additional locations. See also the variable reftex-view-crossref-extra and the command reftex-view-crossref-from-bibtex. With one or two C-u prefixes, enforce rescanning of the document. With argument 2, select the window showing the cross reference.

Command: reftex-view-crossref-from-bibtex

View location in a LaTeX document which cites the BibTeX entry at point. Since BibTeX files can be used by many LaTeX documents, this function prompts upon first use for a buffer in RefTeX mode. To reset this link to a document, call the function with a prefix arg. Calling this function several times find successive citation locations.

Command: reftex-create-tags-file

Create TAGS file by running etags on the current document. The TAGS file is also immediately visited with visit-tags-table.

Command: reftex-grep-document

Run grep query through all files related to this document. With prefix arg, force to rescan document. No active TAGS table is required.

Command: reftex-search-document

Regexp search through all files of the current document. Starts always in the master file. Stops when a match is found. No active TAGS table is required.

Command: reftex-query-replace-document

Run a query-replace-regexp of from with to over the entire document. With prefix arg, replace only word-delimited matches. No active TAGS table is required.

Command: reftex-isearch-minor-mode

Toggle a minor mode which enables incremental search to work globally on the entire multifile document. Files will be searched in the sequence they appear in the document.

Command: reftex-goto-label

Prompt for a label (with completion) and jump to the location of this label. Optional prefix argument other-window goes to the label in another window.

Command: reftex-change-label

Query replace from with to in all \label and \ref commands. Works on the entire multifile document. No active TAGS table is required.

Command: reftex-renumber-simple-labels

Renumber all simple labels in the document to make them sequentially. Simple labels are the ones created by RefTeX, consisting only of the prefix and a number. After the command completes, all these labels will have sequential numbers throughout the document. Any references to the labels will be changed as well. For this, RefTeX looks at the arguments of any macros which either start or end with the string ‘ref’. This command should be used with care, in particular in multifile documents. You should not use it if another document refers to this one with the xr package.

Command: reftex-find-duplicate-labels

Produce a list of all duplicate labels in the document.

Command: reftex-create-bibtex-file

Create a new BibTeX database file with all entries referenced in document. The command prompts for a filename and writes the collected entries to that file. Only entries referenced in the current document with any \cite-like macros are used. The sequence in the new file is the same as it was in the old database.

Entries referenced from other entries must appear after all referencing entries.

You can define strings to be used as header or footer for the created files in the variables reftex-create-bibtex-header or reftex-create-bibtex-footer respectively.

Command: reftex-customize

Run the customize browser on the RefTeX group.

Command: reftex-show-commentary

Show the commentary section from reftex.el.

Command: reftex-info

Run info on the top RefTeX node.

Command: reftex-parse-document

Parse the entire document in order to update the parsing information.

Command: reftex-reset-mode

Enforce rebuilding of several internal lists and variables. Also removes the parse file associated with the current document.