Function: reftex-view-crossref
reftex-view-crossref is an autoloaded, interactive and byte-compiled
function defined in reftex-dcr.el.gz.
Signature
(reftex-view-crossref &optional ARG AUTO-HOW FAIL-QUIETLY)
Documentation
View cross reference of macro at point.
Point must be on the KEY argument. When at a \ref macro, show
corresponding \label definition, also in external
documents (xr). When on a label, show a locations where KEY is
referenced. Subsequent calls find additional locations. When on
a \cite, show the associated \bibitem macro or the BibTeX
database entry. When on a \bibitem, show a \cite macro
which uses this KEY. When on an \index, show other locations
marked by the same index entry.
To define additional cross referencing items, use the option
reftex-view-crossref-extra. See also reftex-view-crossref-from-bibtex.
With one or two C-u (universal-argument) prefixes, enforce rescanning of the document.
With argument 2, select the window showing the cross reference.
AUTO-HOW is only for the automatic crossref display and is handed through
to the functions reftex-view-cr-cite and reftex-view-cr-ref.
Probably introduced at or before Emacs version 20.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/reftex-dcr.el.gz
;;;###autoload
(defun reftex-view-crossref (&optional arg auto-how fail-quietly)
"View cross reference of macro at point.
Point must be on the KEY argument. When at a `\\ref' macro, show
corresponding `\\label' definition, also in external
documents (`xr'). When on a label, show a locations where KEY is
referenced. Subsequent calls find additional locations. When on
a `\\cite', show the associated `\\bibitem' macro or the BibTeX
database entry. When on a `\\bibitem', show a `\\cite' macro
which uses this KEY. When on an `\\index', show other locations
marked by the same index entry.
To define additional cross referencing items, use the option
`reftex-view-crossref-extra'. See also `reftex-view-crossref-from-bibtex'.
With one or two \\[universal-argument] prefixes, enforce rescanning of the document.
With argument 2, select the window showing the cross reference.
AUTO-HOW is only for the automatic crossref display and is handed through
to the functions `reftex-view-cr-cite' and `reftex-view-cr-ref'."
(interactive "P")
;; See where we are.
(let* ((macro (car (reftex-what-macro-safe 1)))
(key (reftex-this-word "^{}%\n\r, \t"))
dw)
(if (or (null macro) (reftex-in-comment))
(or fail-quietly
(error "Not on a crossref macro argument"))
(setq reftex-call-back-to-this-buffer (current-buffer))
(cond
((string-match "\\`\\\\cite\\|cite\\([s*]\\|texts?\\)?\\'\\|bibentry" macro)
;; A citation macro: search for bibitems or BibTeX entries.
;; Match also commands from biblatex ending with `s'
;; (\parencites) or `*' (\parencite*) and `texts?'
;; (\footcitetext and \footcitetexts).
(setq dw (reftex-view-cr-cite arg key auto-how)))
((string-match "\\`\\\\ref\\|ref\\(range\\|s\\)?\\*?\\'" macro)
;; A reference macro: search for labels.
;; Match also commands from cleveref ending with `s' (\namecrefs).
(setq dw (reftex-view-cr-ref arg key auto-how)))
(auto-how nil) ;; No further action for automatic display (speed)
((or (equal macro "\\label")
(member macro reftex-macros-with-labels))
;; A label macro: search for reference macros
(reftex-access-scan-info arg)
(setq dw (reftex-view-regexp-match
(format reftex-find-reference-format (regexp-quote key))
4 nil nil)))
((equal macro "\\bibitem")
;; A bibitem macro: search for citations
(reftex-access-scan-info arg)
(setq dw (reftex-view-regexp-match
(format reftex-find-citation-regexp-format (regexp-quote key))
4 nil nil)))
((member macro reftex-macros-with-index)
(reftex-access-scan-info arg)
(setq dw (reftex-view-regexp-match
(format reftex-find-index-entry-regexp-format
(regexp-quote key))
3 nil nil)))
(t
(reftex-access-scan-info arg)
(catch 'exit
(let ((list reftex-view-crossref-extra)
entry mre action group)
(while (setq entry (pop list))
(setq mre (car entry)
action (nth 1 entry)
group (nth 2 entry))
(when (string-match mre macro)
(setq dw (reftex-view-regexp-match
(format action key) group nil nil))
(throw 'exit t))))
(error "Not on a crossref macro argument"))))
(if (and (eq arg 2) (windowp dw)) (select-window dw)))))