The AUCTeX-RefTeX Interface
RefTeX contains code to interface with AUCTeX. When this interface is turned on, both packages will interact closely. Instead of using RefTeX’s commands directly, you can then also use them indirectly as part of the AUCTeX environment[1]. The interface is turned on with
(setq reftex-plug-into-AUCTeX t)If you need finer control about which parts of the interface are used and which not, read the docstring of the variable reftex-plug-into-AUCTeX or customize it with M-x customize-variable RET reftex-plug-into-AUCTeX RET.
The following list describes the individual parts of the interface.
AUCTeX calls
reftex-labelto insert labels
When a new section is created with C-c C-s, or a new environment is inserted with C-c C-e, AUCTeX normally prompts for a label to go with it. With the interface,reftex-labelis called instead. For example, if you type C-c C-e equation RET, AUCTeX and RefTeX will insertlatex\begin{equation} \label{eq:1} \end{equation}without further prompts.
Similarly, when you type C-c C-s section RET, RefTeX will offer its default label which is derived from the section title.
AUCTeX tells RefTeX about new sections
When creating a new section with C-c C-s, RefTeX will not have to rescan the buffer in order to see it.RefTeX supplies macro arguments
When you insert a macro interactively with C-c RET, AUCTeX normally prompts for macro arguments. Internally, it uses the functionsTeX-arg-label,TeX-arg-cite, andTeX-arg-indexto prompt for arguments which are labels, citation keys and index entries. The interface takes over these functions[2] and supplies the macro arguments with RefTeX’s mechanisms. For example, when you type C-c RET ref RET, RefTeX will supply its label selection process (see Referencing Labels).RefTeX tells AUCTeX about new labels, citation and index keys
RefTeX will add all newly created labels to AUCTeX’s completion list.