Updated documentation at several points in the file.
(reftex-label-alist-builtin): New default environment subfigure. (reftex-find-duplicate-labels): Temporary buffer is now "*Duplicate Labels*" instead of "*Help*". (reftex-bibtex-selection-callback): Renamed variable found-list. (reftex-found-list): Added defvar for this variable. (TeX-master): Added defvar for this variable. (reftex-reset-mode): Kill temporary buffers associated with RefTeX.
This commit is contained in:
@@ -143,7 +143,7 @@
|
||||
;; documentation string. Look it up for more information!
|
||||
;;
|
||||
;; ;; Configuration Variables and User Options for RefTeX ------------------
|
||||
;; ;; Support for \label and \ref ------------------------------------------
|
||||
;; ;; Support for \label and \ref --------------------------------------
|
||||
;; (setq reftex-label-alist nil)
|
||||
;; (setq reftex-default-label-alist-entries '(Sideways LaTeX))
|
||||
;; (setq reftex-use-text-after-label-as-context nil)
|
||||
@@ -327,21 +327,26 @@
|
||||
;;
|
||||
;; AUCTeX can support RefTeX via style files. A style file may contain
|
||||
;; calls to reftex-add-to-label-alist which defines additions to
|
||||
;; reftex-label-alist. The argument taken by this function must have exactly
|
||||
;; the same format as reftex-label-alist. E.g. a good entry in a style file
|
||||
;; for the amsmath package would be
|
||||
;; reftex-label-alist. The argument taken by this function must have
|
||||
;; the same format as reftex-label-alist. E.g. the amsmath.el style file
|
||||
;; of AUCTeX contains the following:
|
||||
;;
|
||||
;; (and (fboundp 'reftex-add-to-label-alist)
|
||||
;; (reftex-add-to-label-alist '(AMSTeX)))
|
||||
;; (TeX-add-style-hook "amsmath"
|
||||
;; (function
|
||||
;; (lambda ()
|
||||
;; (if (featurep 'reftex)
|
||||
;; (reftex-add-to-label-alist '(AMSTeX))))))
|
||||
;;
|
||||
;; while a package defining a proposition environment with \newtheorem
|
||||
;; might use
|
||||
;; while a package `myprop' defining a proposition environment with
|
||||
;; \newtheorem might use
|
||||
;;
|
||||
;; (and
|
||||
;; (fboundp 'reftex-add-to-label-alist)
|
||||
;; (reftex-add-to-label-alist
|
||||
;; '(("proposition" ?p "prop:" "~\\ref{%s}" t
|
||||
;; ("Proposition" "Prop.")))))
|
||||
;; (TeX-add-style-hook "myprop"
|
||||
;; (function
|
||||
;; (lambda ()
|
||||
;; (if (featurep 'reftex)
|
||||
;; (reftex-add-to-label-alist
|
||||
;; '(("proposition" ?p "prop:" "~\\ref{%s}" t
|
||||
;; ("Proposition" "Prop."))))))))
|
||||
;;
|
||||
;; Bib-cite.el
|
||||
;; -----------
|
||||
@@ -474,6 +479,7 @@
|
||||
;; Finally thanks to Uwe Bolick <bolick@physik.tu-berlin.de> who first
|
||||
;; got me (some years ago) into supporting LaTeX labels and references
|
||||
;; with an Editor (which was MicroEmacs at the time).
|
||||
;;
|
||||
|
||||
;;; Code:
|
||||
|
||||
@@ -639,12 +645,16 @@ This list describes the default label environments RefTeX should always use in
|
||||
addition to the specifications in reftex-label-alist. It is probably a
|
||||
mistake to remove the LaTeX symbol from this list.
|
||||
|
||||
Here are the current options:
|
||||
|
||||
The options include:
|
||||
LaTeX The standard LaTeX environments
|
||||
Sideways The sidewaysfigure and sidewaystable environments
|
||||
AMSTeX The math environments in the AMS_LaTeX amsmath package
|
||||
AAS The deluxetable environment from the American Astronomical Society"
|
||||
AAS The deluxetable environment from the American Astronomical Society
|
||||
|
||||
For the full list of options, see the constant reftex-label-alist-builtin.
|
||||
Better still, try
|
||||
|
||||
M-x customize-variable RET reftex-default-label-alist-entries RET."
|
||||
:group 'reftex-defining-label-environments
|
||||
:set 'reftex-set-dirty
|
||||
:type '(list :indent 4
|
||||
@@ -1085,13 +1095,15 @@ mode reset is done on the next occasion."
|
||||
;;; of labels for each master file - this can save a lot of memory.
|
||||
;;; reftex-master-index-list is an alist which connects the true file name
|
||||
;;; of each master file with the symbols holding the information on that
|
||||
;;; document. Each buffer has local variables which point to these symbols.
|
||||
;;; document. Each buffer has local variables which point to these symbols.
|
||||
|
||||
;; List of variables which handle the multifile stuff.
|
||||
;; This list is used to tie, untie, and reset these symbols.
|
||||
(defconst reftex-multifile-symbols
|
||||
'(reftex-label-numbers-symbol reftex-list-of-labels-symbol
|
||||
reftex-bibfile-list-symbol))
|
||||
|
||||
;; Silence warnings about TeX-master, which is defined in AUCTeX
|
||||
(defvar TeX-master)
|
||||
|
||||
;; Alist connecting master file names with the corresponding lisp symbols
|
||||
@@ -1168,8 +1180,8 @@ mode reset is done on the next occasion."
|
||||
(set symbol nil))))
|
||||
|
||||
(defun reftex-TeX-master-file ()
|
||||
;; Return the name of the master file associated with the current buffer.
|
||||
;; When AUCTeX is loaded, we will use it's more sophisticated method.
|
||||
;; Return the name of the master file associated with the current buffer.
|
||||
;; When AUCTeX is loaded, we will use it's more sophisticated method.
|
||||
;; We also support the default TeX and LaTeX modes by checking for a
|
||||
;; variable tex-main-file.
|
||||
|
||||
@@ -2354,7 +2366,7 @@ Changing this is only fully operational after the next buffer scan.")
|
||||
(list nil)))
|
||||
(t nil))))
|
||||
(reftex-uniquify (symbol-value reftex-list-of-labels-symbol)))))
|
||||
(setq dlist (reftex-uniquify dlist))
|
||||
(setq dlist (reftex-uniquify dlist))
|
||||
(if (null dlist) (error "No duplicate labels in document"))
|
||||
(switch-to-buffer-other-window "*Duplicate Labels*")
|
||||
(make-local-variable 'TeX-master)
|
||||
@@ -2688,6 +2700,9 @@ MENU: SPC=view RET=goto [q]uit [Q]uit+kill [r]escan [f]ollow-mode on/off
|
||||
;;;
|
||||
;;; BibTeX citations.
|
||||
|
||||
;; Variables and constants
|
||||
|
||||
;; Define variable to silence compiler warnings
|
||||
(defvar reftex-found-list)
|
||||
|
||||
;; Internal variable, but used from different functions
|
||||
@@ -3173,15 +3188,15 @@ bibliography statement (e.g. if it was changed)."
|
||||
(goto-char pos)))
|
||||
|
||||
(let* (key entry cnt rtn ins-string re-list re
|
||||
;; scan bibtex files
|
||||
(lazy-lock-minimum-size 1)
|
||||
;; scan bibtex files
|
||||
(lazy-lock-minimum-size 1)
|
||||
(reftex-found-list (reftex-extract-bib-entries
|
||||
(reftex-get-bibfile-list)))
|
||||
(found-list-r nil)
|
||||
(accept-keys
|
||||
(if (and (listp reftex-cite-format1)
|
||||
(listp (car reftex-cite-format1)))
|
||||
(mapcar 'car reftex-cite-format1)
|
||||
(mapcar 'car reftex-cite-format1)
|
||||
'(?\C-m))))
|
||||
(if (not reftex-found-list)
|
||||
(error "Sorry, no matches found"))
|
||||
@@ -3192,7 +3207,7 @@ bibliography statement (e.g. if it was changed)."
|
||||
;; offer selection
|
||||
(save-window-excursion
|
||||
(switch-to-buffer-other-window "*RefTeX Select*")
|
||||
(erase-buffer)
|
||||
(erase-buffer)
|
||||
(mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x))))
|
||||
reftex-found-list)
|
||||
(if (= 0 (buffer-size))
|
||||
@@ -3236,18 +3251,18 @@ bibliography statement (e.g. if it was changed)."
|
||||
'(lambda (x)
|
||||
(if (string-match re
|
||||
(cdr (assoc "&entry" x)))
|
||||
x
|
||||
x
|
||||
""))
|
||||
found-list))))
|
||||
reftex-found-list))))
|
||||
(if found-list-r
|
||||
(setq reftex-found-list found-list-r)
|
||||
(ding))
|
||||
(erase-buffer)
|
||||
(erase-buffer)
|
||||
(mapcar '(lambda (x) (insert (cdr (assoc "&formatted" x))))
|
||||
reftex-found-list)
|
||||
(goto-char 1))
|
||||
((or (member key accept-keys)
|
||||
(equal key ?\C-m)
|
||||
(equal key ?\C-m)
|
||||
(equal key 'return))
|
||||
(setq entry (nth cnt reftex-found-list))
|
||||
(throw 'exit t))
|
||||
@@ -3322,10 +3337,8 @@ bibliography statement (e.g. if it was changed)."
|
||||
;; this is slow and not recommended for follow mode
|
||||
(defun reftex-bibtex-selection-callback (cnt)
|
||||
;; Callback function to be called from the BibTeX selection, in
|
||||
;; order to display context. This function is relatively slow and not
|
||||
;; recommended for follow mode, just for individual lookups.
|
||||
;; order to display context. This function is relatively slow and not
|
||||
;; the calling function binds found-list with let.
|
||||
;; recommended for follow mode, just for individual lookups.
|
||||
(let ((win (selected-window))
|
||||
(key (reftex-get-bib-field "&key" (nth cnt reftex-found-list)))
|
||||
(bibfile-list (save-excursion
|
||||
@@ -3872,6 +3885,11 @@ With argument, actually select the window showing the cross reference."
|
||||
(Sideways
|
||||
"Sidewaysfigure and sidewaystable"
|
||||
("sidewaysfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")
|
||||
("sidewaystable" ?t nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{"))
|
||||
|
||||
(Subfigure
|
||||
"Subfigure environment and macro"
|
||||
("subfigure" ?f nil nil "\\\\caption\\(\\[[^]]*\\]\\)?{")
|
||||
("\\subfigure" ?f nil nil "\\\\subfigure[[{]"))
|
||||
|
||||
(AMSTeX
|
||||
@@ -3896,9 +3914,18 @@ variables. It is called when RefTeX is first used, and after changes to
|
||||
This function will compile the information in reftex-label-alist and similar
|
||||
variables. It is called when RefTeX is first used, and after changes to
|
||||
these variables via reftex-add-to-label-alist."
|
||||
(interactive)
|
||||
(interactive)
|
||||
|
||||
;; Record that we have done this
|
||||
(setq reftex-tables-dirty nil)
|
||||
|
||||
;; Kill temporary buffers associated with RefTeX - just in case they
|
||||
;; were not cleaned up properly
|
||||
(let ((buffer-list '("*reftex-master.tex*" "*RefTeX Help*" "*RefTeX Select*"
|
||||
"*Duplicate Labels*" "*toc*" "*RefTeX-scratch*")))
|
||||
(while buffer-list
|
||||
(if (get-buffer (car buffer-list))
|
||||
(kill-buffer (car buffer-list)))
|
||||
(setq buffer-list (cdr buffer-list))))
|
||||
|
||||
;; To update buffer-local variables
|
||||
@@ -4052,9 +4079,9 @@ This enforces rescanning the buffer on next use."
|
||||
reftex-mode-menu reftex-mode-map
|
||||
"Menu used in RefTeX mode"
|
||||
'("Ref"
|
||||
["Table of Contents" reftex-toc t]
|
||||
"----"
|
||||
["\\label" reftex-label t]
|
||||
["Table of Contents" reftex-toc t]
|
||||
"----"
|
||||
["\\label" reftex-label t]
|
||||
["\\ref" reftex-reference t]
|
||||
["\\cite" reftex-citation t]
|
||||
["View crossref" reftex-view-crossref t]
|
||||
|
||||
Reference in New Issue
Block a user