Function: reftex-citation

reftex-citation is an autoloaded, interactive and byte-compiled function defined in reftex-cite.el.gz.

Signature

(reftex-citation &optional NO-INSERT FORMAT-KEY)

Documentation

Make a citation using BibTeX database files.

After prompting for a regular expression, scans the buffers with bibtex entries (taken from the \bibliography command) and offers the matching entries for selection. The selected entry is formatted according to reftex-cite-format and inserted into the buffer.

If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.

FORMAT-KEY can be used to pre-select a citation format.

When called with a C-u (universal-argument) 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 known citation keys is possible.
= is a good regular expression to match all entries in all files.

Probably introduced at or before Emacs version 20.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/reftex-cite.el.gz
;;; Make a citation

;; NB this is a global autoload - see reftex.el.
;;;###autoload
(defun reftex-citation (&optional no-insert format-key)
  "Make a citation using BibTeX database files.
After prompting for a regular expression, scans the buffers with
bibtex entries (taken from the \\bibliography command) and offers the
matching entries for selection.  The selected entry is formatted according
to `reftex-cite-format' and inserted into the buffer.

If NO-INSERT is non-nil, nothing is inserted, only the selected key returned.

FORMAT-KEY can be used to pre-select a citation format.

When called with a \\[universal-argument] 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 known citation keys is possible.
`=' is a good regular expression to match all entries in all files."
  (interactive)

  ;; check for recursive edit
  (reftex-check-recursive-edit)

  ;; This function may also be called outside reftex-mode.
  ;; Thus look for the scanning info only if in reftex-mode.

  (when reftex-mode
    (reftex-access-scan-info nil))

  ;; Call reftex-do-citation, but protected
  (unwind-protect
      (reftex-do-citation current-prefix-arg no-insert format-key)
    (reftex-kill-temporary-buffers)))