4.1 Creating Citations

In order to create a citation, press C-c [. RefTeX then prompts for a regular expression which will be used to search through the database and present the list of matches to choose from in a selection process similar to that for selecting labels (see Referencing Labels).

The regular expression uses an extended syntax: ‘&&’ defines a logic and for regular expressions. For example ‘Einstein&&Bose’ will match all articles which mention Bose-Einstein condensation, or which are co-authored by Bose and Einstein. When entering the regular expression, you can complete on known citation keys. RefTeX also offers a default when prompting for a regular expression. This default is the word before the cursor or the word before the current ‘\cite’ command. Sometimes this may be a good search key.

RefTeX prefers to use BibTeX database files specified with a \bibliography macro to collect its information. Just like BibTeX, it will search for the specified files in the current directory and along the path given in the environment variable BIBINPUTS. If you do not use BibTeX, but the document contains an explicit thebibliography environment, RefTeX will collect its information from there. Note that in this case the information presented in the selection buffer will just be a copy of relevant \bibitem entries, not the structured listing available with BibTeX database files.

In the selection buffer, the following keys provide special commands. A summary of this information is always available from the selection process by pressing ?.

General
?

Show a summary of available commands.

0-9,-

Prefix argument.

Moving around
n

Go to next article.

p

Go to previous article.

Access to full database entries
SPC

Show the database entry corresponding to the article at point, in another window. See also the f key.

f

Toggle follow mode. When follow mode is active, the other window will always display the full database entry of the current article. This is equivalent to pressing SPC after each cursor motion. With BibTeX entries, follow mode can be rather slow.

Selecting entries and creating the citation
RET

Insert a citation referencing the article at point into the buffer from which the selection process was started.

mouse-2

Clicking with mouse button 2 on a citation will accept it like RET would. See also variable reftex-highlight-selection, Miscellaneous.

m

Mark the current entry. When one or several entries are marked, pressing a or A accepts all marked entries. Also, RET behaves like the a key.

u

Unmark a marked entry.

a

Accept all (marked) entries in the selection buffer and create a single \cite macro referring to them.

A

Accept all (marked) entries in the selection buffer and create a separate \cite macro for each of it.

e

Create a new BibTeX database file which contains all marked entries in the selection buffer. If no entries are marked, all entries are selected.

E

Create a new BibTeX database file which contains all unmarked entries in the selection buffer. If no entries are marked, all entries are selected.

TAB

Enter a citation key with completion. This may also be a key which does not yet exist.

.

Show insertion point in another window. This is the point from where you called reftex-citation.

Exiting
q

Exit the selection process without inserting a citation into the buffer.

Updating the buffer
g

Start over with a new regular expression. The full database will be rescanned with the new expression (see also r).

r

Refine the current selection with another regular expression. This will not rescan the entire database, but just the already selected entries.

In order to define additional commands for this selection process, the keymap reftex-select-bib-mode-map may be used.

Note that if you do not use Emacs to edit the BibTeX database files, RefTeX will ask if the related buffers should be updated once it detects that the files were changed externally. If you do not want to be bothered by such queries, you can activate Auto Revert mode for these buffers by adding the following expression to your init file:

(add-hook 'bibtex-mode-hook 'turn-on-auto-revert-mode)