4.1 Creating Citations
In order to create a citation, press . 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 for regular expressions. For example ‘’ 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 ‘’ command. Sometimes this may be a good search key.
RefTeX prefers to use BibTeX database files specified with a 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 . If you do not use BibTeX, but the document contains an explicit 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 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 .
- Show a summary of available commands.
- Prefix argument.
- Moving around
- Go to next article.
- Go to previous article.
- Access to full database entries
- Show the database entry corresponding to the article at point, in another window. See also the key.
- 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
- Insert a citation referencing the article at point into the buffer from which the selection process was started.
- Clicking with mouse button 2 on a citation will accept it like <RET> would. See also variable , Options - Misc.
- Mark the current entry. When one or several entries are marked, pressing or accepts all marked entries. Also, <RET> behaves like the key.
- Unmark a marked entry.
- Accept all (marked) entries in the selection buffer and create a single macro referring to them.
- Accept all (marked) entries in the selection buffer and create a separate macro for each of it.
- Create a new BibTeX database file which contains all marked entries in the selection buffer. If no entries are marked, all entries are selected.
- Create a new BibTeX database file which contains all unmarked entries in the selection buffer. If no entries are marked, all entries are selected.
- 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 .
- Exit the selection process without inserting a citation into the buffer.
- Updating the buffer
- Start over with a new regular expression. The full database will be rescanned with the new expression (see also ).
- 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 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)
Like for any other macro you want to insert in AUCTeX, you should use (or ; for more information about autocompletion in AUCTeX see the quick start or Completion section of the manual). This works also for all other citation macros provided by , , ect... (, , , , etc...)
For the particular case of bibliography commands, you may want to take advantage of the great package RefTeX. AUCTeX has a basic support for bibliographic commands also without RefTeX, but this package provides a far superior completion.
In order to automatically start RefTeX when you open a LaTeX file add the following code to your init file
In this way, you can still insert a command with , but you can also use the key-binding . RefTeX overtakes the task to provide completion of bibliographic entries, but you can continue using the usual AUCTeX-way to insert macros.
answered Feb 22 '16 at 20:24