Commits

steveb  committed f818bc8

reftex.el-3.38

  • Participants
  • Parent commits 8d278a6

Comments (0)

Files changed (3)

 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.05
-AUTHOR_VERSION = 3.34
+VERSION = 1.06
+AUTHOR_VERSION = 3.38
 MAINTAINER = Carsten Dominik <dominik@strw.LeidenUniv.nl>
 PACKAGE = reftex
 PKG_TYPE = regular
 ;;; reftex.el --- Minor mode for doing \label, \ref and \cite in LaTeX
 ;; Copyright (c) 1997, 1998 Free Software Foundation, Inc.
 
-;; Version:    3.34 
+;; Version:    3.38 
 ;; Author:     Carsten Dominik <dominik@strw.LeidenUniv.nl>
 ;; Keywords:   tex
 
 ;; access to any part of a document.
 ;;
 ;;
+;; INSTALLATION
+;; ------------
+;;
+;; If you got reftex.el with an Emacs distribution, it is already
+;; installed.  If not, follow the instructions in the INSTALL file of
+;; the distribution.
+;;
 ;; To turn RefTeX Mode on and off in a particular buffer, use
 ;; `M-x reftex-mode'.
 ;;
 ;; DOCUMENTATION
 ;; -------------
 ;;
+;; See below for a short summary of how to use RefTeX.
+;;
 ;; There is an extensive texinfo document describing RefTeX in detail.
 ;; When you are getting reftex.el with the Emacs distribution, the
 ;; info files should already be installed.  To view this
 ;; documentation, use `M-x reftex-info RET'.
 ;;
-;; The documentation is also available at
+;; The documentation in various formats is also available at
 ;;
 ;;     http://www.strw.leidenuniv.nl/~dominik/Tools/
 ;;
 ;;     RefTeX distinguishes labels for different environments.  It knows
 ;;     about all standard environments (and many others), and can be
 ;;     configured to recognize any additional labeled environments you
-;;     have defined yourself (variable REFTEX-LABEL-ALIST().
+;;     have defined yourself (variable REFTEX-LABEL-ALIST).
 ;;
 ;;        * Creating Labels
 ;;          Type `C-c (' (`reftex-label') to insert a label at point.
 ;;     When no other message occupies the echo area and point is idle on
 ;;     the argument of a `\ref' or `\cite' macro, the echo area will
 ;;     display information about the citation/cross reference.
-;;     With point on or anywhere before such a macro, press `C-c &'
+;;     With point on the argument of such a macro, press `C-c &'
 ;;     (`reftex-view-crossref'), or click with `S-mouse-2' on the macro
 ;;     argument.  This will display the corresponding label definition or
 ;;     BibTeX database entry in another window.
 ;;     or press the `r' key in the label selection buffer or the table of
 ;;     contents buffer.
 ;;
-;;  7. Speed Issues
-;;     Useful settings to make RefTeX faster for large (multifile)
-;;     documents include:
+;;  7. Useful Settings
+;;     To make RefTeX faster for large documents include, and to integrate 
+;;     it with AUCTeX, try these:
+;;
 ;;          (setq reftex-enable-partial-scans t)
 ;;          (setq reftex-save-parse-info t)
 ;;          (setq reftex-use-multiple-selection-buffers t)
+;;          (setq reftex-plug-into-AUCTeX t)
 ;;
 ;;---------------------------------------------------------------------------
 ;;
 ;; The newest version of RefTeX can be found at
 ;;
 ;;    http://www.strw.leidenuniv.nl/~dominik/Tools/
-;;    ftp://strw.leidenuniv.nl/pub/dominik/
+;;    ftp://ftp.strw.leidenuniv.nl/pub/dominik/
 ;;
 ;; At that site you can also get version 3.22 of RefTeX which is still
 ;; compatible with Emacs 19.  The file you are reading now as well as the
 ;;    Karl Eichwalder, Peter Galbraith, Dieter Kraft, Adrian Lanz,
 ;;    Rory Molinari, Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani,
 ;;    Robin Socha, Richard Stanton, Allan Strand, Jan Vroonhof,
-;;    Christoph Wedler.
+;;    Christoph Wedler, Alan Williams.
 ;;
 ;; Finally thanks to Uwe Bolick who first got me (some years ago) into
 ;; supporting LaTeX labels and references with an Editor (which was
 ;; MicroEmacs at the time).
 ;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;; HISTORY
-;; =======
-;;
-;; Here are the more important changes made to RefTeX since initial release.
-;; Minor bug fixes are not mentioned.
-;;
-;; Version 1.00
-;;    - released on 7 Jan 1997.
-;; Version 1.04
-;;    - Macros as wrappers, AMSTeX support, delayed context parsing for
-;;      new labels.
-;; Version 1.05
-;;    - XEmacs port.
-;; Version 1.07
-;;    - RefTeX gets its own menu.
-;; Version 1.09
-;;    - Support for `tex-main-file', an analogue for `TeX-master'.
-;;    - MS-DOS support.
-;; Version 2.00
-;;    - Labels can be derived from context (default for sections).
-;;    - Configuration of label insertion and label referencing revised.
-;;    - Crossref fields in BibTeX database entries.
-;;    - `reftex-toc' introduced (thanks to Stephen Eglen).
-;; Version 2.03
-;;    - Figure*, table*, Sidewaysfigure/table added to default environments.
-;;    - `reftex-bibfile-ignore-list' introduced (thanks to Rory Molinari).
-;;    - New functions `reftex-arg-label', `reftex-arg-ref', `reftex-arg-cite'.
-;;    - Emacs/XEmacs compatibility reworked.  XEmacs 19.15 now is required.
-;;    - `reftex-add-to-label-alist' (to be called from AUCTeX style files).
-;;    - Finding context with a hook function.
-;;    - Sorting BibTeX entries (new variable: `reftex-sort-bibtex-matches').
-;; Version 2.05
-;;    - Support for `custom.el'.
-;;    - New function `reftex-grep-document' (thanks to Stephen Eglen).
-;; Version 2.07
-;;    - New functions `reftex-search-document', `reftex-query-replace-document'
-;; Version 2.11
-;;    - Submitted for inclusion to Emacs and XEmacs.
-;; Version 2.14
-;;    - Variable `reftex-plug-into-AUCTeX' simplifies cooperation with AUCTeX.
-;; Version 2.17
-;;    - Label prefix expands % escapes with current file name and other stuff.
-;;    - Citation format now with % escapes.  This is not backward compatible!
-;;    - TEXINPUTS variable recognized when looking for input files.
-;;    - Context can be the nth argument of a macro.
-;;    - Searching in the select buffer is now possible (C-s and C-r).
-;;    - Display and derive-label can use two different context methods.
-;;    - AMSmath xalignat and xxalignat added.
-;; Version 3.00
-;;    - RefTeX should work better for very large projects:
-;;       - The new parser works without creating a master buffer.
-;;       - Rescanning can be limited to a part of a multifile document.
-;;       - Information from the parser can be stored in a file.
-;;    - RefTeX can deal with macros having a naked label as an argument.
-;;    - Macros may have white space and newlines between arguments.
-;;    - Multiple identical section headings no longer confuse `reftex-toc'.
-;;    - RefTeX should work correctly in combination with buffer-altering
-;;      packages like outline, folding, x-symbol, iso-cvt, isotex, etc.
-;;    - All labeled environments discussed in `The LaTeX Companion' by
-;;      Goossens, Mittelbach & Samarin, Addison-Wesley 1994) are part of
-;;      RefTeX's defaults.
-;; Version 3.03
-;;    - Support for the LaTeX package `xr', for inter-document references.
-;;    - A few (minor) Mule-related changes.
-;;    - Fixed bug which could cause HUGE .rel files.
-;;    - Search for input and .bib files with recursive path definitions.
-;; Version 3.12
-;;    - There are 3 new keymaps for customization: `reftex-toc-map',
-;;      `reftex-select-label-map', `reftex-select-bib-map'.
-;;    - Refontification uses more standard font-lock stuff.
-;;    - When no BibTeX database files are specified, citations can also
-;;      use \bibitem entries from a `thebibliography' environment.
-;; Version 3.14
-;;    - Selection buffers can be kept between selections: this is faster.
-;;      See new variable `reftex-use-multiple-selection-buffers'.
-;;    - Prefix interpretation of reftex-view-crossref changed.
-;;    - Support for the `varioref' package (`v' key in selection buffer).
-;; Version 3.16
-;;    - New hooks `reftex-format-label-function', `reftex-format-ref-function',
-;;      `reftex-format-cite-function'.
-;;    - TeXInfo documentation completed.
-;;    - New variable `reftex-default-bibliography'.
-;; Version 3.17
-;;    - Additional bindings in selection and *toc* buffers.  `g' redefined. 
-;;    - New command `reftex-save-all-document-buffers'.
-;;    - Magic word matching made more intelligent.
-;;    - Selection process can switch to completion (with TAB).
-;;    - \appendix is now recognized and influences section numbering.
-;;    - File commentary shortened considerably (use Info documentation).
-;;    - New option `reftex-no-include-regexps' to skip some include files.
-;;    - New option `reftex-revisit-to-follow'.
-;; Version 3.18
-;;    - The selection now uses a recursive edit, much like minibuffer input.
-;;      This removes all restrictions during selection.  E.g. you can now
-;;      switch buffers at will, use the mouse etc.
-;;    - New option `reftex-highlight-selection'.
-;;    - Mouse-2 can be used to select in selection and *toc* buffers.
-;;    - Fixed some problems regarding the interaction with VIPER mode.
-;;    - Follow-mode is now only used after point motion.
-;;    - RefTeX now finally does not fontify temporary files anymore!
-;; Version 3.21
-;;    - New options for all faces used by RefTeX.  They're in the
-;;      customization group `reftex-fontification-configurations'.
-;; Version 3.22
-;;    - `reftex-mouse-view-crossref' is now bound by default at `S-mouse-2'
-;;    - THIS VERSION IS RECOMMENDED FOR X/EMACS 19.
-;; Version 3.23
-;;    - Parse files MASTER.rel made compatible between Emacs and XEmacs.
-;;    - `kill-emacs-hook' and `kill-buffer-hook' now write the parse file.
-;;    - The cursor inside a \ref or \cite macro now triggers automatic
-;;      display of crossref information in the echo area.  See variable
-;;      `reftex-auto-view-crossref'.
-;;    - AUCTeX interface updates:
-;;      - AUCTeX 9.9c and later notifies RefTeX about new sections.
-;;      - RefTeX notifies ACUTeX about new labels.
-;;      - TeX-arg-ref no longer used (introduction was unnecessaary).
-;;      - `reftex-arg-label' and `reftex-arg-cite' fixed up.
-;;      - Settings added to RefTeX via style files remain local.
-;; Version 3.24
-;;    - New option `reftex-revisit-to-echo'.
-;;    - Interface with X-Symbol (>=2.6) is now complete and stable.
-;;    - Adapted to new outline, which uses overlays.
-;; Version 3.25
-;;    - Echoing of citation info caches the info for displayed entries.
-;;      New option `reftex-cache-cite-echo'.
-;;    - `M-x reftex-reset-mode' now also removes the file with parsing info.
-;;    - Default of `reftex-revisit-to-follow' changed to nil.
-;; Version 3.26
-;;    - [X]Emacs 19 support dropped.  Use 3.22 for them.
-;;    - New hooks `reftex-translate-to-ascii-function',
-;;      `reftex-string-to-label-function'.
-;; Version 3.27
-;;    - Macros can define "neutral" labels, just like \label{} itself.
-;;    - New option `reftex-allow-detached-macro-args', default nil!
-;; Version 3.28
-;;    - Auto view crossref for XEmacs uses post-command-hook to restart the
-;;      timer, since itimer restart is not reliable.
-;;    - Option `reftex-bibfile-ignore-list' renamed to `-regexps'.
-;;    - Expansion of recursive tex and bib path rewritten.
-;; Version 3.30
-;;    - In `reftex-citation', the regexp can be completed on known cite keys.
-;;    - New keys `a' and `A' in bib selecton process to cite all entries.
-;;    - New command `reftex-renumber-simple-labels' to renumber `eq:13' etc.
-;; Version 3.33
-;;    - Multiple Selection Buffers are now hidded (names start with a space).
-;;    - Fixed bug with file search when TEXINPUTS was empty.
-;; Version 3.34
-;;    - Additional flag in `reftex-derive-label-parameters' to make only
-;;      lowercase labels (default t).
-;;    - All .rel files have a final newline to avoid queries.
-;;    - Single byte representations of accented European letters (ISO-8859-1)
-;;      are legal in labels.  However, general Mule characters are not.
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;
 ;;;;;;
 
   :group 'reftex-making-and-inserting-labels
   :type 'symbol)
 
-(defcustom reftex-translate-to-ascii-function nil
+(defcustom reftex-translate-to-ascii-function 'reftex-latin1-to-ascii
   "Filter function which will process a context string before it is used
-to derive a label from it.  A useful application would be to convert ISO or
-Mule characters into something legal in labels.  By default, RefTeX just
-removes these characters.  X-Symbol (>=2.6) sets this variable to
-`x-symbol-translate-to-ascii'."
+to derive a label from it.  The intended application is to convert ISO or
+Mule characters into something legal in labels.  The default function
+removes the accents from Latin-1 characters.  X-Symbol (>=2.6) sets this
+variable to the much more general `x-symbol-translate-to-ascii'."
   :group 'reftex-making-and-inserting-labels
   :type 'symbol)
 
                          (string :tag ""))
 		(option (boolean :tag "Downcase words          "))))
 
-;; The following rexexp is defined negative and excludes all Mule characters.
-;; A positive way to do it and to allow Mule characters at the same time
-;; vwould be this: "[][\000-\037 !\"#$%&'()*,/<=>?@\\^`{|}~\177]"  
-(defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.\300-\377]"
-  "Regexp matching characters not legal in labels.
-For historic reasons, this character class comes *with* the [] brackets.
-The default value allows the characters \300-\377 because these are the
-european letters in ISO 8859-1."
+(defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]"
+  "Regexp matching characters not legal in labels."
   :group 'reftex-making-and-inserting-labels
-  :type '(regexp :tag "Character class"))
+  :type '(regexp :tag "Regular Expression"))
 
 (defcustom reftex-abbrev-parameters '(4 2 "^aeiou" "aeiou")
   "Parameters for abbreviation of words.
   :type '(repeat (regexp)))
 
 (defcustom reftex-default-bibliography nil
-  "*List of BibTeX database file which should be used if none are specified.
+  "*List of BibTeX database files which should be used if none are specified.
 When `reftex-citation' is called from a document which has neither a
 `\bibliography{..}' statement nor a `thebibliography' environment,
 RefTeX will scan these files instead.  Intended for using
 
 (defcustom reftex-auto-view-crossref t
   "*Non-nil means, initially turn automatic viewing of crossref info on.
-Automatic viewing of crossref info uses the echo area.  Whenever point is in
-the argument of a \\ref or \\cite macro, and no other message is being
-displayed, the echo area will display information about that cross reference.
+Automatic viewing of crossref info normally uses the echo area.
+Whenever point is on the argument of a \\ref or \\cite macro, and no
+other message is being displayed, the echo area will display
+information about that cross reference.  You can also set the variable
+to the symbol `window'.  In this case a small temporary window is
+used for the display.
 This feature can be turned on and of from the menu 
 (Ref->Options->Crossref Viewing)."
   :group 'reftex-viewing-cross-references-and-citations
-  :type 'boolean)
+  :type '(choice (const :tag "off" nil)
+		 (const :tag "in Echo Area" t)
+		 (const :tag "in Other Window" window)))
 
 (defcustom reftex-idle-time 1.2
   "*Time (secs) Emacs has to be idle before automatic crossref display is done."
   "Face name for file boundaries in selection buffer."
   :group 'reftex-fontification-configurations
   :type 'symbol)
-(defcustom reftex-label-face 'font-lock-reference-face
+(defcustom reftex-label-face 'font-lock-constant-face
   "Face name for labels in selection buffer."
   :group 'reftex-fontification-configurations
   :type 'symbol)
 ;;; Define the formal stuff for a minor mode named RefTeX.
 ;;;
 
-(defconst reftex-version "RefTeX version 3.34"
+(defconst reftex-version "RefTeX version 3.38"
   "Version string for RefTeX.")
 
 (defvar reftex-mode nil
 (defvar LaTeX-label-function)
 (defvar tex-main-file)
 (defvar outline-minor-mode)
+(defvar font-lock-mode)
 (defvar font-lock-fontify-region-function)
 (defvar font-lock-syntactic-keywords)
 
           (buffer-file-name)))))
     (cond
      ((null master)
-      (error "Need a filename for this buffer.  Please save it first."))
+      (error "Need a filename for this buffer,  please save it first"))
+     ((or (file-exists-p (concat master ".tex"))
+          (reftex-get-buffer-visiting (concat master ".tex")))
+      ;; Ahh, an extra .tex was missing...
+      (setq master (concat master ".tex")))
      ((or (file-exists-p master)
           (reftex-get-buffer-visiting master))
       ;; We either see the file, or have a buffer on it.  OK.
       )
-     ((or (file-exists-p (concat master ".tex"))
-          (reftex-get-buffer-visiting (concat master ".tex")))
-      ;; Ahh, an extra .tex was missing...
-      (setq master (concat master ".tex")))
      (t
       ;; Use buffer file name.
       (buffer-file-name)))
 IGNORE-WORDS List of words which should be removed from the string."
 
   (let* ((words0 (split-string string (or split-re "[ \t\n\r]")))
+	 (reftex-label-illegal-re (or illegal-re "\000"))
          words word)
 
     ;; Remove words from the ignore list or with funny characters
       (if downcase (setq word (downcase word)))
       (cond
        ((member (downcase word) ignore-words))
-       ((string-match (or illegal-re "\000") word)
+       ((string-match reftex-label-illegal-re word)
         (when illegal
-          (while (string-match illegal-re word)
+          (while (string-match reftex-label-illegal-re word)
             (setq word (replace-match "" nil nil word)))
           (push word words)))
        (t
         (setq string (replace-match "" nil nil string)))
     string))
 
+(defun reftex-latin1-to-ascii (string)
+  ;; Translate the upper 127 chars in the ISO1 charset to ASCII equivalents
+  (let ((tab "@@@@@@@@@@@@@@@@@@'@@@@@@@@@@@@@ icLxY|S\"ca<--R-o|23'uq..1o>423?AAAAAAACEEEEIIIIDNOOOOOXOUUUUYP3aaaaaaaceeeeiiiidnooooo:ouuuuypy") c)
+    (loop for i from 0 to (1- (length string)) do
+	  (setq c (aref string i))
+	  (cond ((and (> c 127) (< c 256))                 ; 8 bit Latin-1
+		 (aset string i (aref tab (- c 128))))
+		((and (> c 2175) (< c 2304))               ; Mule Latin-1,
+		 (aset string i (aref tab (- c 2176))))))  ; Std. Emacs only
+    string))
+
 (defun reftex-replace-prefix-escapes (prefix)
   ;; Replace %escapes in a label prefix
   (save-match-data
 
 	  ;; remove ~ if we do already have a space
 	  (when (and (= ?~ (string-to-char form))
-		     (= ?\  (preceding-char)))
+		     (member (preceding-char) '(?\ ?\t ?\n)))
 	    (setq form (substring form 1)))
 	  ;; do we need to switch from \ref to \vref?
 	  (when (string= varioref "\\vref")
 	(setq reftex-latex-syntax-table (syntax-table))
         (reftex-highlight 0 (match-beginning 3) (match-end 3))
         (reftex-show-entry (match-beginning 3) (match-end 3))
-        (recenter (/ (window-height) 2)))
+        (recenter '(4)))
       (select-window this-window))))
 
 (defun reftex-pop-to-label (label file-list &optional mark-to-kill highlight)
 	  (when (re-search-forward re nil t)
 	    (switch-to-buffer-other-window buf)
 	    (goto-char (match-beginning 0))
-	    (recenter (/ (window-height) 2))
+	    (recenter '(4))
 	    (if highlight
 		(reftex-highlight 0 (match-beginning 3) (match-end 3)))
 	    (throw 'exit (selected-window)))))
 	  (switch-to-buffer-other-window
 	   (marker-buffer reftex-toc-return-marker))
 	  (goto-char (marker-position reftex-toc-return-marker))
-	  (recenter (/ (window-height) 2)))
+	  (recenter '(4)))
       (select-window this-window))))
 (defun reftex-toc-quit ()
   "Hide the *toc* window and do not move point."
   (if reftex-enable-partial-scans
       (let ((file (nth 3 (get-text-property (point) 'toc))))
         (if (not file)
-            (error "Don't know which file to rescan.  Try `R'.")
+            (error "Don't know which file to rescan.  Try `R'")
           (switch-to-buffer-other-window
            (reftex-get-file-buffer-force file))
           (setq current-prefix-arg '(4))
   ;; If MARK-TO-KILL is non-nil, mark new buffer to kill.
   ;; If HIGHLIGHT is non-nil, highlight the match.
   ;; If ITEM in non-nil, search for bibitem instead of database entry.
-  ;; If ECHO is non-nil, just display short info in echo area.
+  ;; If RETURN is non-nil, just return the entry.
 
   (let* ((re
 	  (if item 
           (goto-char (match-beginning 0))
 	  (when return
 	    ;; Just return the relevant entry
-	    (setq return
-	      (if item
-		  (buffer-substring 
-		   (goto-char (match-end 0))
-		   (if (re-search-forward
-			"\\\\bibitem\\|\\\\end{thebibliography}" nil t)
-		       (match-beginning 0)
-		     (point)))
-		(buffer-substring (point)
-				  (condition-case nil
-				      (progn (forward-list 1) (point))
-				    (error (point))))))
+	    (if item (goto-char (match-end 0)))
+	    (setq return (buffer-substring 
+			  (point) (reftex-end-of-bib-entry item)))
 	    (set-window-configuration window-conf)
 	    (throw 'exit return))
           (recenter 0)
 	  (error "No \\bibitem with citation key %s" key)
 	(error "No BibTeX entry with citation key %s" key)))))
 
+(defun reftex-end-of-bib-entry (item)
+  (save-excursion 
+    (condition-case nil
+	(if item 
+	    (progn (end-of-line)
+		   (re-search-forward
+		    "\\\\bibitem\\|\\end{thebibliography}")
+		   (1- (match-beginning 0)))
+	  (progn (forward-list 1) (point)))
+      (error (min (point-max) (+ 300 (point)))))))
+
 ;; Parse bibtex buffers
 
 (defun reftex-extract-bib-entries (buffers)
 	(delete-char 1))
 
       ;; Tell AUCTeX
-      (when (and (fboundp 'LaTeX-add-bibitems) reftex-plug-into-AUCTeX)
+      (when (and reftex-mode 
+		 (fboundp 'LaTeX-add-bibitems)
+		 reftex-plug-into-AUCTeX)
 	(apply 'LaTeX-add-bibitems (mapcar 'car selected-entries)))
       
       ;; Produce the cite-view strings
-      (when (and reftex-cache-cite-echo cite-view)
+      (when (and reftex-mode reftex-cache-cite-echo cite-view)
 	(mapcar (lambda (entry) 
 		  (reftex-make-cite-echo-string entry docstruct-symbol))
 		selected-entries))
 	    (princ prompt)
 	    (set-marker reftex-recursive-edit-marker (point))
 	    ;; XEmacs does not run post-command-hook here
-	    (and (featurep 'xemacsp) (run-hooks 'post-command-hook))
+	    (and (featurep 'xemacs) (run-hooks 'post-command-hook))
 	    (recursive-edit))
 
 	(set-marker reftex-recursive-edit-marker nil)
 	 (reftex-highlight 1 b e))
     (if (or (not (pos-visible-in-window-p b))
 	    (not (pos-visible-in-window-p e)))
-	(recenter (/ (window-height) 2)))
+	(recenter '(4)))
     (unless (current-message)
       (princ prompt))))
 
 	  (switch-to-buffer-other-window
 	   (marker-buffer reftex-select-return-marker))
 	  (goto-char (marker-position reftex-select-return-marker))
-	  (recenter (/ (window-height) 2)))
+	  (recenter '(4)))
       (select-window this-window))))
 (defun reftex-select-callback ()
   "Show full context in another window."
 ;;;
 ;;; View cross references
 
-(defun reftex-view-crossref (&optional arg stay-put echo)
+(defun reftex-view-crossref (&optional arg how)
   "View cross reference of \\ref or \\cite macro at point.
 If the macro at point is a \\ref, show the corresponding label definition.
 If it is a \\cite, show the BibTeX database entry or the \\bibitem.
-If there is no such macro at point, search forward to find one.
-When you call this function several times in direct succession, point will
-move to view subsequent cross references further down in the buffer.
-To cope with the plethora of variations in packages, this function
-assumes any macro either starting with or ending in `ref' or `cite' to
-contain cross references.
+To cope with the plethora of variations in packages, this
+function assumes any macro either starting with or ending in `ref' or
+`cite' to contain cross references.
 When the LaTeX package `xr' is being used, this command will also view
 crossreferences in external documents.  However, this works correctly only
 when the \\externaldocument macros are used with the optional label prefix
 argument.
 With one or two C-u prefixes, enforce rescanning of the document.
-With argument t or 1, select the window showing the cross reference.
-When STAY-PUT is non-nil, do not move.
-When ECHO is non-nil, use the echo area to display the cross reference."
+With argument 2, select the window showing the cross reference.
+When HOW is 'echo, call the corresponding echo function.
+When HOW is 'tmp-window, make the pop-up window as small as possible and
+arrange for its removal before the next command."
 
   (interactive "P")
 
   ;; See where we are.
-  (let* ((re "\\\\\\([a-z]*\\(cite\\|ref\\)\\|\\(cite\\|ref\\)[a-z]*\\)\\**\\(\\[[^{}]*\\]\\)?{")
-         (macro (car (reftex-what-macro 1)))
-         (this-word (reftex-this-word "*a-zA-Z\\\\"))
-         (my-window (selected-window))
-         pop-window cmd args point)
+  (let* ((macro (car (reftex-what-macro 1)))
+         (key (reftex-this-word "^{}%\n\r,")))
 
     (setq reftex-call-back-to-this-buffer (current-buffer))
 
-    (catch 'exit
-      (if (and macro
-	       (string-match "\\`\\\\cite\\|\\`\\\\ref\\|cite\\'\\|ref\\'"
-			     macro))
-	  (and (setq macro (match-string 0 macro))
-	       (string-match "\\`\\\\" macro)
-	       (setq macro (substring macro 1)))
-	(setq macro nil))
-
-      ;; Exit here if we have no macro and are not allowed to move.
-      (if (and stay-put (not macro)) (throw 'exit nil))
-
-      (if (and macro 
-	       (eq last-command this-command)
-	       (eq last-command 'reftex-view-crossref))
-	  (if (string= macro "cite")
-	      (progn
-		(skip-chars-forward "^},%")
-		(while (and (eq (following-char) ?%)
-			    (or (beginning-of-line 2) t)
-			    (skip-chars-forward " \t\n\r")))
-		(skip-chars-forward ",")
-		(if (eq (following-char) ?})
-		    (setq macro nil)))
-	    (setq macro nil)))
-
-      (if (and (not macro)
-	       (or (not (string-match "\\`\\\\" this-word))
-		   (eq (following-char) ?\\)
-		   (search-backward "\\" nil t)
-		   t))
-	  (if (interactive-p)
-	      ;; Only move far if this function was called directly
-	      (and (re-search-forward re nil t)
-		   (setq macro (or (match-string 2) (match-string 3))))
-	    ;; The macro needs to be at point
-	    (and (looking-at re)
-		 (setq macro (or (match-string 2) (match-string 3)))
-		 (goto-char (match-end 0)))))
-	     
-
-      (unless macro
+    (if (and macro
+	     (string-match "\\`\\\\cite\\|\\`\\\\ref\\|cite\\'\\|ref\\'"
+			   macro))
+	(and (setq macro (match-string 0 macro))
+	     (string-match "\\`\\\\" macro)
+	     (setq macro (substring macro 1)))
+      (setq macro nil))
+
+    (if (or (null macro) (reftex-in-comment))
 	(error "No cross reference to display"))
 
-      ;; Ensure access to scanning info
-      (reftex-access-scan-info (or arg current-prefix-arg))
-
-      (cond
-       ((reftex-in-comment)
-	(throw 'exit nil))
-       ((string= macro "cite")
-	(cond
-	 ((assq 'bib (symbol-value reftex-docstruct-symbol))
-	  (setq cmd 'reftex-pop-to-bibtex-entry
-		args (list
-		      (reftex-this-word "^{},%\n\r")
-		      (reftex-get-bibfile-list) nil t nil)))
-	 ((assq 'thebib (symbol-value reftex-docstruct-symbol))
-	  (setq cmd 'reftex-pop-to-bibtex-entry
-		args (list 
-		      (reftex-this-word "^{},%\n\r")
-		      (list (cdr (assq 'thebib 
-				       (symbol-value reftex-docstruct-symbol))))
-		      nil t t)))
-	 (reftex-default-bibliography
-	  (setq cmd 'reftex-pop-to-bibtex-entry
-		args (list
-		      (reftex-this-word "^{},%\n\r")
-		      reftex-default-bibliography nil t nil)))
-	 (echo)
-	 (t (error "Cannot display crossref\n")))
-	(when echo
-	  (reftex-echo-cite args)
-	  (throw 'exit nil)))
-       ((string= macro "ref")
-	(let* ((label (reftex-this-word "^{}%\n\r"))
-	       (xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol)))
-	       (xr-re (nth 2 xr-data))
-	       (entry (assoc label (symbol-value reftex-docstruct-symbol))))
-
-	  (if (and (not entry) (stringp label) xr-re (string-match xr-re label))
-	      ;; Label is defined in external document
-	      (save-excursion
-		(save-match-data
-		  (set-buffer 
-		   (or (reftex-get-file-buffer-force
-			(cdr (assoc (match-string 1 label) (nth 1
-								xr-data))))
-		       (error "Problem with external label %s" label))))
-		(setq label (substring label (match-end 1)))
-		(reftex-access-scan-info)
-		(setq entry 
-		      (assoc label (symbol-value reftex-docstruct-symbol)))))
-	  (when echo
-	    (reftex-echo-ref label entry (symbol-value reftex-docstruct-symbol))
-	    (throw 'exit t))
-	  (if entry
-	      (setq cmd 'reftex-pop-to-label
-		    args (list label (list (nth 3 entry)) nil t))
-	    (error "Label %s not known - reparse document might help" label))))
-       (t (error "This should not happen (reftex-view-crossref)")))
-      (setq point (point))
-      (apply cmd args)
-      (setq pop-window (selected-window))
+    (if (eq how 'tmp-window)
+	;; Remember the window configuration
+	(put 'reftex-auto-view-crossref 'last-window-conf 
+	     (current-window-configuration)))
+    (cond
+     ((string= macro "cite")
+      (reftex-view-cr-cite arg key how))
+     ((string= macro "ref")
+      (reftex-view-cr-ref arg key how))
+     (t 
+      (error "Cannot display crossref\n")))))
+     
+(defun reftex-view-cr-cite (arg key how)
+  ;; View crossreference of a ref cite.  HOW can have the values 
+  ;; nil:         Show in another window.
+  ;; echo:        Show one-line info in echo area.
+  ;; tmp-window:  Show in small window and arrange for window to disappear.
+
+  ;; Ensure access to scanning info
+  (reftex-access-scan-info (or arg current-prefix-arg))
+
+  (let (files size item (pos (point)) (win (selected-window)) pop-win)
+    ;; Find the citation mode and the file list
+    (cond
+     ((assq 'bib (symbol-value reftex-docstruct-symbol))
+      (setq item nil
+	    files (reftex-get-bibfile-list)))
+     ((assq 'thebib (symbol-value reftex-docstruct-symbol))
+      (setq item t
+	    files (list (cdr (assq 'thebib 
+				   (symbol-value reftex-docstruct-symbol))))))
+     (reftex-default-bibliography
+      (setq item nil
+	    files reftex-default-bibliography))
+     (how)  ;; don't throw for special display
+     (t (error "Cannot display crossref")))
+
+    (if (eq how 'echo)
+	;; Display in Echo area
+	(reftex-echo-cite key files item)
+      ;; Display in a window
+      (if (not (eq how 'tmp-window))
+	  ;; Normal display
+	  (reftex-pop-to-bibtex-entry key files nil t item)
+	;; A temporary window
+	(condition-case nil
+	    (reftex-pop-to-bibtex-entry key files nil t item)
+	  (error (goto-char pos)
+		 (message "cite: no such citation key %s" key)
+		 (error "")))
+	;; Resize the window
+	(setq size (max 1 (count-lines (point)
+				       (reftex-end-of-bib-entry item))))
+	(let ((window-min-height 2))
+	  (shrink-window (1- (- (window-height) size)))
+	  (recenter 0))
+	;; Arrange restoration
+	(add-hook 'pre-command-hook 'reftex-restore-window-conf))
+
+	;; Normal display in other window
       (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
-      (select-window my-window)
-      (goto-char point)
-      (when (or (equal arg t) (equal arg 1))
-	(select-window pop-window)))))
+      (setq pop-win (selected-window))
+      (select-window win)
+      (goto-char pos)
+      (when (equal arg 2)
+	(select-window pop-win)))))
+
+(defun reftex-view-cr-ref (arg label how)
+  ;; View crossreference of a ref macro.  HOW can have the values 
+  ;; nil:         Show in another window.
+  ;; echo:        Show one-line info in echo area.
+  ;; tmp-window:  Show in small window and arrange for window to disappear.
+
+  ;; Ensure access to scanning info
+  (reftex-access-scan-info (or arg current-prefix-arg))
+  
+  (let* ((xr-data (assoc 'xr (symbol-value reftex-docstruct-symbol)))
+	 (xr-re (nth 2 xr-data))
+	 (entry (assoc label (symbol-value reftex-docstruct-symbol)))
+	 (win (selected-window)) pop-win (pos (point)))
+    
+    (if (and (not entry) (stringp label) xr-re (string-match xr-re label))
+	;; Label is defined in external document
+	(save-excursion
+	  (save-match-data
+	    (set-buffer 
+	     (or (reftex-get-file-buffer-force
+		  (cdr (assoc (match-string 1 label) (nth 1
+							  xr-data))))
+		 (error "Problem with external label %s" label))))
+	  (setq label (substring label (match-end 1)))
+	  (reftex-access-scan-info)
+	  (setq entry 
+		(assoc label (symbol-value reftex-docstruct-symbol)))))
+    (if (eq how 'echo)
+	(reftex-echo-ref label entry (symbol-value reftex-docstruct-symbol))
+      (unless entry
+	(message "Label %s not known - reparse document might help" label))
+
+      (reftex-pop-to-label label (list (nth 3 entry)) nil t)
+      (add-hook 'pre-command-hook 'reftex-highlight-shall-die)
+
+      (when (eq how 'tmp-window)
+	;; Resize window and arrange restauration
+	(shrink-window (1- (- (window-height) 9)))
+	(recenter '(4))
+	(add-hook 'pre-command-hook 'reftex-restore-window-conf))
+      (setq pop-win (selected-window))
+      (select-window win)
+      (goto-char pos)
+      (when (equal arg 2)
+	(select-window pop-win)))))
 
 (defun reftex-mouse-view-crossref (ev)
   "View cross reference of \\ref or \\cite macro where you click.
   "The timer used for auto-view-crossref.")
 
 (defun reftex-view-crossref-when-idle ()
-  ;; Display info about crossref at point in echo area.
+  ;; Display info about crossref at point in echo area or a window.
   ;; This function was desigend to work with an idle timer.
   ;; We try to get out of here as quickly as possible if the call is useless.
   (and reftex-mode
        ;; Quick precheck if this might be a relevant spot
+       ;; FIXME: failes with backslash in comment
        (save-excursion  
 	 (search-backward "\\" nil t)
 	 (looking-at "\\\\[a-zA-Z]*\\(cite\\|ref\\)"))
-       ;; Make sure message area is free
-       (not (current-message))
+       ;; Make sure message area is free if we need it.
+       (or (eq reftex-auto-view-crossref 'window) (not (current-message)))
+       ;; Make sure we are not already displaying this one
+       (not (memq last-command '(reftex-view-crossref
+				 reftex-mouse-view-crossref)))
        (condition-case nil
 	   (let ((current-prefix-arg nil))
-	     (reftex-view-crossref -1 t t))
-	   (error nil))))
+	     (cond
+	      ((eq reftex-auto-view-crossref t)
+	       (reftex-view-crossref -1 'echo))
+	      ((eq reftex-auto-view-crossref 'window)
+	       (reftex-view-crossref -1 'tmp-window))
+	      (t nil)))
+	 (error nil))))
+
+(defun reftex-restore-window-conf ()
+  (set-window-configuration (get 'reftex-auto-view-crossref 'last-window-conf))
+  (put 'reftex-auto-view-crossref 'last-window-conf nil)
+  (remove-hook 'pre-command-hook 'reftex-restore-window-conf))
 		  
 (defun reftex-echo-ref (label entry docstruct)
   ;; Display crossref info in echo area.
 	  (set-buffer buf)
 	  (run-hooks 'reftex-display-copied-context-hook)))))))
 
-(defun reftex-echo-cite (args)
+(defun reftex-echo-cite (key files item)
   ;; Display citation info in echo area.
-  (let* ((key (car args))
-	 (cache (assq 'bibview-cache (symbol-value reftex-docstruct-symbol)))
+  (let* ((cache (assq 'bibview-cache (symbol-value reftex-docstruct-symbol)))
 	 (cache-entry (assoc key (cdr cache)))
-	 (item (nth 4 args))
-	 (files (nth 1 args))
-	 entry string buf)
+	 entry string buf (all-files files))
 
     (if (and reftex-cache-cite-echo cache-entry)
 	;; We can just use the cache
 
       ;; Need to look in the database
       (unless reftex-revisit-to-echo
-	(setq files (reftex-visited-files (nth 1 args))))
+	(setq files (reftex-visited-files files)))
 
       (setq entry 
 	    (condition-case nil
 		(save-excursion
 		  (reftex-pop-to-bibtex-entry key files nil nil item t))
 	      (error
-	       (if (and files (= (length (nth 1 args)) (length files)))
+	       (if (and files (= (length all-files) (length files)))
 		   (message "cite: no such database entry: %s" key)
 		 (message (substitute-command-keys 
 			   (format reftex-no-info-message "cite"))))
 	       nil)))
       (when entry
-	(setq entry (if item (reftex-parse-bibitem entry)
-		     (reftex-parse-bibtex-entry entry)))
-	(setq string (reftex-make-cite-echo-string 
-		      entry reftex-docstruct-symbol))))
+	(if item
+	    (setq string (reftex-nicify-text entry))
+	  (setq string (reftex-make-cite-echo-string
+			(reftex-parse-bibtex-entry entry)
+			reftex-docstruct-symbol)))))
     (unless (or (null string) (equal string ""))
       (message "cite: %s" string))
     (when (setq buf (get-buffer " *Echo Area*"))
   ;; If the optional BOUND is an integer, bound backwards directed searches to
   ;; this point.  If it is nil, limit to nearest \section - like statement.
 
+  (unless reftex-section-regexp (reftex-compile-variables))
   (catch 'exit
     (save-excursion
       (if (null which) (throw 'exit nil))
   ;; Find FILE in MASTER-DIR or on reftex-tex-path.
   ;; FILE may be given with or without the .tex extension.
   (let ((rec-values '(nil t)) path file1 old-path)
-    (unless (and (file-name-absolute-p file) (not (file-exists-p file)))
+    (if (file-name-absolute-p file)
+	(if (file-regular-p (concat file ".tex"))
+	    (setq file1 (concat file ".tex"))
+	  (if (file-regular-p file) (setq file1 file)))
       (while (and (null file1) rec-values)
-	(setq path (reftex-access-search-path 
+	(setq path (reftex-access-search-path
 		    "tex" (pop rec-values) master-dir file))
 	(if (or (null old-path)
 		(not (eq old-path path)))
 (defun reftex-find-bib-file (file master-dir &optional die)
   ;; Find FILE in MASTER-DIR or on reftex-bib-path
   (let ((rec-values '(nil t)) path file1 old-path)
-    (unless (and (file-name-absolute-p file) (not (file-exists-p file)))
+    (if (file-name-absolute-p file)
+	(if (file-regular-p file) (setq file1 file))
       (while (and (null file1) rec-values)
 	(setq path (reftex-access-search-path 
 		    "bib" (pop rec-values) master-dir file))
   ;; DEF-DIR is the default directory for expanding relative path elements.
   (catch 'exit
     (when (file-name-absolute-p file)
-      (if (and (file-exists-p file) (not (file-directory-p file)))
+      (if (file-regular-p file)
 	  (throw 'exit file)
 	(throw 'exit nil)))
     (let* ((thepath path) file1 dir )
 	(when (string= (substring dir -2) "//")
 	  (setq dir (substring dir 0 -1)))
 	(setq file1 (expand-file-name file (expand-file-name dir def-dir)))
-	(if (and (file-exists-p file1) (not (file-directory-p file1)))
+	(if (file-regular-p file1)
 	    (throw 'exit file1)))
       ;; No such file
       nil)))
 	(cond
 	 ((and (boundp 'enable-multibyte-characters)
 	       enable-multibyte-characters
+	       (fboundp 'string-width)
 	       (fboundp 'truncate-string-to-width))
 	  (if (<= (string-width string) ncols)
 	      string
 (defun reftex-grep-document (grep-cmd)
   "Run grep query through all files related to this document.
 With prefix arg, force to rescan document.
-This works also without an active TAGS table."
+No active TAGS table is required."
 
   (interactive
    (list (read-from-minibuffer "Run grep on document (like this): "
   "Regexp search through all files of the current TeX document.
 Starts always in the master file.  Stops when a match is found.
 To continue searching for next match, use command \\[tags-loop-continue].
-This works also without an active TAGS table."
+No active TAGS table is required."
   (interactive)
   (let ((default (reftex-this-word)))
     (unless regexp
 Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 If you exit (\\[keyboard-quit] or ESC), you can resume the query replace
 with the command \\[tags-loop-continue].
-This works also without an active TAGS table."
+No active TAGS table is required."
   (interactive)
   (let ((default (reftex-this-word)))
     (unless from
 Works on the entire multifile document.
 If you exit (\\[keyboard-quit] or ESC), you can resume the query replace
 with the command \\[tags-loop-continue].
-This works also without an active TAGS table."
+No active TAGS table is required."
   (interactive)
   (let ((default (reftex-this-word "-a-zA-Z0-9_*.:")))
     (unless from
      ["Not" (setq reftex-sort-bibtex-matches nil)
       :style radio :selected (eq reftex-sort-bibtex-matches nil)])
     ("Crossref Viewing"
-     ["Automatic Info in Echo Area" reftex-toggle-auto-view-crossref
+     ["Automatic Info" reftex-toggle-auto-view-crossref
       :style toggle :selected reftex-auto-view-crossref-timer]
+     ["...in Echo Area" (setq reftex-auto-view-crossref t)
+      :style radio :selected (eq reftex-auto-view-crossref t)]
+     ["...in Other Window" (setq reftex-auto-view-crossref 'window)
+      :style radio :selected (eq reftex-auto-view-crossref 'window)]
+     "---"
      ["Crossref Echo may visit files"
       (setq reftex-revisit-to-echo (not reftex-revisit-to-echo))
       :style toggle :selected reftex-revisit-to-echo]
 \input texinfo  @c -*-texinfo-*-
 @c %**start of header
-@c $Id$
 @setfilename reftex
 @settitle RefTeX User Manual
 @dircategory Editors
 @direntry
-* RefTeX::	Emacs support for LaTeX cross-references, citations...
+* RefTeX: (reftex).	Support for LaTeX labels, references, and citations
+                          with Emacs.
 @end direntry
 @synindex ky cp
 @syncodeindex vr cp
 This file documents @b{Ref@TeX{}}, a package to do labels, references and
 citations for LaTeX documents with Emacs.@refill
 
-This is edition 3.34 of the @b{Ref@TeX{}} User Manual for @b{Ref@TeX{}} 3.34
+This is edition 3.38 of the @b{Ref@TeX{}} User Manual for @b{Ref@TeX{}} 3.38
 
 Copyright (c) 1997, 1998 Free Software Foundation, Inc.
 
 @titlepage
 @title Ref@TeX{} User Manual
 @subtitle Support for LaTeX labels, references, and citations with GNU Emacs
-@subtitle Edition 3.34, June 1998
+@subtitle Edition 3.38, September 1998
 
 @author by Carsten Dominik
 @page
 Copyright @copyright{} 1997, 1998 Free Software Foundation, Inc.
 
 @sp 2
-This is edition 3.34 of the @cite{Ref@TeX{} User Manual} for @b{Ref@TeX{}}
-version 3.34, June 1998.@refill
+This is edition 3.38 of the @cite{Ref@TeX{} User Manual} for @b{Ref@TeX{}}
+version 3.38, September 1998.@refill
 
 @sp 2
 
 distribution, because you use an older version of Emacs, or because new
 features have been added to @b{Ref@TeX{}} in the mean time (@pxref{Imprint}
 for information on how to obtain the distribution).  In order
-to install, the following steps are necessary.
-
-@enumerate
-@item 
-Unpack the tarfile.
-@item
-Edit the header of the @file{Makefile} to contain the correct
-installation paths for Lisp and Info files, as well as the correct name
-for the Emacs executable.@refill
-@item
-Type
-@example
-make
-make install
-@end example
-@noindent
-in order to compile the code and install it along with the online Info
-documentation.
-@item
-Copy the following lines into your @file{.emacs} file:@refill
-@cindex .emacs
-@cindex @code{autoload} forms, required
-@example
-(autoload 'reftex-mode     "reftex" "RefTeX Mode" t)
-(autoload 'turn-on- reftex "reftex" "RefTeX Mode" nil)
-(autoload 'reftex-citation "reftex" "Do citation with RefTeX" t)
-@end example
-@end enumerate
-
-In order to produce a printed version of the documentation, use
-@code{make dvi} or @code{make ps}.  This will create the files
-@file{reftex.dvi} and @file{reftex.ps}, respectively.  The command
-@code{make html} will transform the documentation into HTML format (file
-@file{reftex.html}).
+to install, follow the steps in the INSTALL file of the distribution.
 
 @section Entering @b{Ref@TeX{}} Mode
 
 derive a label from context (default for section labels)
 @item
 prompt for a label string (default for figures and tables) or
-@item
+@item 
 insert a simple label made of a prefix and a number (all other
-environments).@refill
+environments)@refill
 @end itemize
 @noindent
 Which labels are created how is configurable (variable
 When no other message occupies the echo area and point is idle on the
 argument of a @code{\ref} or @code{\cite} macro, the echo area will
 display information about the citation/cross reference.@* 
-With point on or anywhere before such a macro, press @kbd{C-c &}
+With point on the argument of such a macro, press @kbd{C-c &}
 (@code{reftex-view-crossref}), or click with @kbd{S-mouse-2} on the
 macro argument.  This will display the corresponding label definition or
-BibTeX database entry in another window.  @refill
+BibTeX database entry in another window.@refill
 
 @item
 @b{Table of Contents}@* 
 table of contents buffer.@refill
 
 @item
-@b{Speed Issues}@*
-Useful settings to make @b{Ref@TeX{}} faster for large
-(multifile) documents include:@refill
+@b{Useful Settings}@* To make @b{Ref@TeX{}} faster for large documents,
+and to integrate it with AUCTeX, try these:@refill
 @lisp
 (setq reftex-enable-partial-scans t)
 (setq reftex-save-parse-info t)
 (setq reftex-use-multiple-selection-buffers t)
+(setq reftex-plug-into-AUCTeX t)
 @end lisp
 @end enumerate
 
 @item
 A label can be derived from context.  This means, @b{Ref@TeX{}} takes
 the context of the label definition and construct a label from
-that@footnote{Note that @b{Ref@TeX{}} will remove Mule characters from
-the string before converting it to a label. @xref{Language Support} for
-additional information.}.  This works best for section labels, where the
-section heading is used to construct a label.  In fact, @b{Ref@TeX{}}'s
-default settings use this method only for section labels.  You will be
-asked to confirm the derived label, or edit it.@refill
+that@footnote{Note that the context may contain constructs which are
+illegal in labels.  @b{Ref@TeX{}} will therefore strip the accent from
+accented Latin-1 characters and remove everything else which is not
+legal in labels.  This mechanism is safe, but may not be satisfactory
+for non-western languages.  Check the following variables if you need to
+change things: @var{reftex-translate-to-ascii-function},
+@var{reftex-derive-label-parameters}, @var{reftex-label-illegal-re},
+@var{reftex-abbrev-parameters}.}.  This works best for section labels,
+where the section heading is used to construct a label.  In fact,
+@b{Ref@TeX{}}'s default settings use this method only for section
+labels.  You will be asked to confirm the derived label, or edit
+it.@refill
 
 @item
 We may also use a simple unique number to identify a label.  This is
 Reparse the document to update the information on all labels and rebuild
 the menu.  If the variable @var{reftex-enable-partial-scans} is
 non-@code{nil} and your document is a multifile document, this will
-reparse only a a part of the document (the file the label at point was
-defined in).@refill
+reparse only a part of the document (the file in which the label at
+point was defined).@refill
 
 @item R
 Reparse the @emph{entire} document.
 So we need to tell @b{Ref@TeX{}} that @code{theorem} and @code{axiom} are new
 labeled environments which define their own label categories.  We can
 either use Lisp to do this (e.g. in @file{.emacs}) or use the custom
-library.  With lisp it would look like this
+library.  With Lisp it would look like this
 
 @lisp
 (setq reftex-label-alist
 @kindex C-c &
 
 @b{Ref@TeX{}} can display the definition site of a label which is
-referenced in the text.  With the cursor on or anywhere before a
-@code{\ref} macro, type @kbd{C-c &}.  Or klick with @kbd{S-mouse-2} on
-the argument of the macro.  @b{Ref@TeX{}} will then display the definition
-of the label in another window.  This works also with references to
-external labels (@pxref{xr (LaTeX package)}).@refill
+referenced in the text.  With the cursor on the argument of a
+@code{\ref} macro, type @kbd{C-c &}.  Or click with @kbd{S-mouse-2} on
+the argument of the macro.  @b{Ref@TeX{}} will then display the
+definition of the label in another window.  This works also with
+references to external labels (@pxref{xr (LaTeX package)}).@refill
 
 @b{Ref@TeX{}} also uses the echo area to display short information about
 the cross reference whenever the cursor is inside the argument of a
 @code{\ref} macro.  Note that the information is only displayed if the
 echo area is not occupied by a different message.  You can toggle this
-feature from the menu @w{(@code{Ref->Options->Crossref Viewing})}, or
-turn it off completely by configuring the variable
+feature from the menu @w{(@code{Ref->Options->Crossref Viewing})}.  To
+turn it off or change its behavior, see the variable
 @var{reftex-auto-view-crossref}.@refill
 
 See also @ref{Displaying Citations}.
 
 @cindex @code{\bibliography}
 @cindex @code{thebibliography}, LaTeX environment
+@cindex @code{BIBINPUTS}, environment variable
+@cindex @code{TEXBIB}, environment variable
 @b{Ref@TeX{}} prefers to use BibTeX database files specified with a
-@code{\bibliography} macro to collect its information.  However, if you
-have an explicit @code{thebibliography} environment in your document, it
-will be scanned instead.  Note that in this case the information
+@code{\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 @code{BIBINPUTS}.
+If you do not use BibTeX, but the document contains an explicit
+@code{thebibliography} environment, @b{Ref@TeX{}} 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
 @code{\bibitems}, not the structured listing available with BibTeX
 database files.@refill
 @findex reftex-view-crossref
 @findex reftex-mouse-view-crossref
 
-@b{Ref@TeX{}} can display the full database entry for any citation key used
-in the document.  With the cursor on or anywhere before a @code{\cite}
-macro, type @kbd{C-c &}.  Or klick with @kbd{S-mouse-2} on the argument
-of the macro.  @b{Ref@TeX{}} will show the full database entry in another
-window.  If you press @kbd{C-c &} immediately again, @b{Ref@TeX{}} will
-move to the next following citation key - so this can be used to display
-the database entries for several keys in a single @code{\cite} macro, or
-in subsequent macros.@refill
+@b{Ref@TeX{}} can display the full database entry for any citation key
+used in the document.  With the cursor on the argument of a @code{\cite}
+macro, type @kbd{C-c &}.  Or click with @kbd{S-mouse-2} on the argument
+of the macro.  @b{Ref@TeX{}} will show the full database entry in
+another window.@refill
 
 @b{Ref@TeX{}} also uses the echo area to display short information about
 the citation whenever the cursor is inside the argument of a
 @code{\cite} macro.  Note that the information is only displayed if the
 echo area is not occupied by a different message.  You can toggle this
-feature from the menu @w{(@code{Ref->Options->Crossref Viewing})}, or
-turn it off completely by configuring the variable
+feature from the menu @w{(@code{Ref->Options->Crossref Viewing})}.  To
+turn it off or change its behavior, see the variable
 @var{reftex-auto-view-crossref}.@refill
 
 See also @ref{Displaying Cross References}.
 buffer.  This can be useful to reference articles in Emails and other
 documents.  The list of BibTeX files will in this case be taken from the
 variable @var{reftex-default-bibliography}.  Setting the variable
-@var{reftex-cite-format} to the symbol @code{'locally} does a decent job of
+@var{reftex-cite-format} to the symbol @code{locally} does a decent job of
 putting all relevant information about a citation directly into the
 buffer.  Here is the lisp code to add the @kbd{C-c [} binding to the
 mail buffer.  It also provides a local binding for
 
 @item
 @b{Notifying @b{Ref@TeX{}} about New Sections}@* When creating a new
-section with @kbd{C-c C-s}, @b{Ref@TeX{}} be notified about it, so that
-it does not have to rescan the buffer.@refill
+section with @kbd{C-c C-s}, @b{Ref@TeX{}} ill be notified about it, so
+that it does not have to rescan the buffer.@refill
 
 @item
 @findex reftex-arg-label
 @var{reftex-derive-label-parameters} and @var{reftex-abbrev-parameters}.
 
 @item
-@cindex Mule characters in labels
-@cindex Labels, missing Mule characters
-The regular expression @var{reftex-label-illegal-re} is used to remove
-characters which are illegal in labels from a label string.  This
-regular expression currently matches some ASCII characters and all Mule
-characters@footnote{Note that the default regexp allows the single byte
-representation of the European characters in ISO-8859-1.  So if you
-disable the Mule features in Emacs there should be no problems for these
-characters.}.  If you find out that your TeX and Emacs work well with
-labels containing funny Mule characters, try this setting to make
-@emph{all} Mule characters legal in labels:
-
-@lisp
-(setq reftex-label-illegal-re 
-      "[][\000-\037 !\"#$%&'()*,/<=>?@@\\^`@{|@}~\177]")
-@end lisp
-
-Alternatively the hook @var{reftex-translate-to-ascii-function} can be
-used to change Mule characters before the conversion to a label takes
-place.
+Also, when a label is derived from context, @b{Ref@TeX{}} clears the
+context string from non-ASCII characters in order to make a legal
+label.  If you are using a special version of @TeX{} which allows
+extended characters @emph{in labels}, then you should look at the
+variables @var{reftex-translate-to-ascii-function} and
+@var{reftex-label-illegal-re}.
 
 @item
 When a label is referenced, @b{Ref@TeX{}} looks at the word before point
 see @ref{Adding Magic Words}.
 @end itemize
 
+@page
+
 @node Optimizations, Problems and Work-Arounds, Language Support, Top
 @section Optimizations
 @cindex Optimizations
 @item
 The label environment definitions in @var{reftex-label-alist} are global
 and apply to all documents.  If you need to make definitions local to a
-document, because they would interfere with other settings in other
-documents, you should use AUCTeX and set up style files with
-calls to @code{reftex-add-label-environments},
-@code{reftex-set-cite-format}, and @code{reftex-add-section-levels}.
-Settings made with these functions remain local to the current
-document. @xref{AUCTeX} for more information.@refill
+document, because they would interfere with settings in other documents,
+you should use AUCTeX and set up style files with calls to
+@code{reftex-add-label-environments}, @code{reftex-set-cite-format}, and
+@code{reftex-add-section-levels}.  Settings made with these functions
+remain local to the current document. @xref{AUCTeX} for more
+information.@refill
 
 @item
 @cindex @code{x-symbol}, Emacs package
 context.@refill 
 
 @item
+@cindex BibTeX database files, not found
+@cindex TeX files, not found
+@cindex @code{TEXINPUTS}, environment variable
+@cindex @code{BIBINPUTS}, environment variable
+A common problem with Emacs and LaTeX on non-UNIX systems is that the
+search paths for TeX and BibTeX files have to be known to both Emacs and
+TeX.  Under UNIX, both is usually controlled with the appropriate
+environment variables, @code{TEXINPUTS} and @code{BIBINPUTS}.  Some TeX
+implementations, however, specify these paths in a special configuration
+file where Emacs does not see them.  Make sure that these variables are
+available in Emacs's environment as well.
+
+@item
 @cindex Idle timer restart
 @vindex reftex-use-itimer-in-xemacs
 In XEmacs, idle timer restart does not work reliably after fast
 When reporting a bug, please include a backtrace if you know how to
 produce one.
 
-@b{Ref@TeX{}} is distributed with Emacs (version 20.2 and later) and XEmacs
-(version 19.16 and 20.2 and later).  The latest version of @b{Ref@TeX{}}
-is available at@refill
+@b{Ref@TeX{}} is distributed with Emacs (version 20.2 and later) and is
+one of the XEmacs @emph{packages} which are distributed from the XEmacs
+WEB site.  The latest version of @b{Ref@TeX{}} is available at@refill
 
 @example
 http://www.strw.leidenuniv.nl/~dominik/Tools/
-ftp://strw.leidenuniv.nl/pub/dominik/
+ftp://ftp.strw.leidenuniv.nl/pub/dominik/
 @end example
 
 @noindent
 @i{F. Burstall, Alastair Burt, Soren Dayton, Stephen Eglen, Karl
 Eichwalder, Peter Galbraith, Dieter Kraft, Adrian Lanz, Rory Molinari,
 Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani, Robin Socha, Richard
-Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler}.@refill
+Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler, Alan
+Williams}.@refill
 
 The @code{view-crossref} feature was inspired by @i{Peter Galbraith's}
 @file{bib-cite.el}.@refill
 View cross reference of @code{\ref} or @code{\cite} macro at point.  If
 the macro at point is a @code{\ref}, show the corresponding label
 definition.  If it is a @code{\cite}, show the BibTeX database entry or the
-@code{\bibitem}.  If there is no such macro at point, search forward to find
-one.  When you call this function several times in direct succession,
-point will move to view subsequent cross references further down in the
-buffer.  To cope with the plethora of variations in packages, this
+@code{\bibitem}.  To cope with the plethora of variations in packages, this
 function assumes any macro either starting with or ending in @samp{ref} or
 @samp{cite} to contain cross references.  When the LaTeX package @code{xr} is
 being used, this command will also view cross-references in external
 @code{\externaldocument} macros are used with the optional label prefix
 argument.@*@refill
 With one or two @kbd{C-u} prefixes, enforce rescanning of the
-document.  With argument t or 1, select the window showing the cross
-reference.@refill
+document.  With argument 2, select the window showing the cross
+reference. The optional 2nd argument HOW can be @code{echo} or
+@code{tmp-window} and is used by the functions which do automatic
+crossref display.@refill
 @end deffn
 
 @deffn Command reftex-toc
 @deffn Command reftex-grep-document
 Run grep query through all files related to this document.
 With prefix arg, force to rescan document.
-This works also without an active TAGS table.@refill
+No active TAGS table is required.@refill
 @end deffn
 
 @deffn Command reftex-search-document
 Regexp search through all files of the current TeX document.
 Starts always in the master file.  Stops when a match is found.
-This works also without an active TAGS table.@refill
+No active TAGS table is required.@refill
 @end deffn
 
 @deffn Command reftex-query-replace-document
 Run a query-replace-regexp of FROM with TO over the entire TeX document.
 With prefix arg, replace only word-delimited matches.
-This works also without an active TAGS table.@refill
+No active TAGS table is required.@refill
 @end deffn
 
 @deffn Command reftex-change-label
 Query replace FROM with TO in all @code{\label} and @code{\ref} commands.
 Works on the entire multifile document.
-This works also without an active TAGS table.@refill
+No active TAGS table is required.@refill
 @end deffn
 
 @deffn Command reftex-renumber-simple-labels
 @item
 If a string, use as regexp to search @emph{backward} from the label.
 Context is then the text following the end of the match.  E.g. putting
-this to @samp{\\caption[@{]]} will use the caption in a figure or table
+this to @samp{\\caption[[@{]} will use the caption in a figure or table
 environment.  @samp{\\begin@{eqnarray@}\|\\\\} works for
 eqnarrays.@refill
 @item
 
 @deffn Hook reftex-translate-to-ascii-function
 Filter function which will process a context string before it is used to
-derive a label from it.  A useful application would be to convert ISO or
-Mule characters into something legal in labels.  By default,
-@b{Ref@TeX{}} just removes these characters.  @code{X-Symbol} (>=2.6)
-sets this variable to @code{x-symbol-translate-to-ascii}.@refill
+derive a label from it.  The intended application is to convert ISO or
+Mule characters into something legal in labels.  The default function
+@code{reftex-latin1-to-ascii} removes the accents from Latin-1
+characters.  X-Symbol (>=2.6) sets this variable to the much more
+general @code{x-symbol-translate-to-ascii}.@refill
 @end deffn
 
 @defopt reftex-derive-label-parameters
 @end defopt
 
 @defopt reftex-label-illegal-re
-Regexp matching characters not legal in labels.  For historic reasons,
-this character class comes @emph{with} the @code{[]} brackets.
-The default value allows the characters \300-\377 because these are the
-european letters in ISO 8859-1.@refill
+Regexp matching characters not legal in labels.
 @end defopt
 
 @defopt reftex-abbrev-parameters
 @end defopt
 
 @defopt reftex-default-bibliography
-List of BibTeX database file which should be used if none are specified.
+List of BibTeX database files which should be used if none are specified.
 When @code{reftex-citation} is called from a document which has neither
 a @samp{\bibliography@{...@}} statement nor a @code{thebibliography}
 environment, @b{Ref@TeX{}} will scan these files instead.  Intended for
 
 @defopt reftex-auto-view-crossref
 Non-@code{nil} means, initially turn automatic viewing of crossref info
-on.  Automatic viewing of crossref info uses the echo area.  Whenever
-point is in the argument of a @code{\ref} or @code{\cite} macro, and no other
-message is being displayed, the echo area will display information about
-that cross reference.  The function @code{reftex-toggle-auto-view-crossref}
-can be used to toggle this feature after startup.  See also the variable
-@var{reftex-revisit-to-echo}.
+on.  Automatic viewing of crossref info normally uses the echo area.
+Whenever point is on the argument of a @code{\ref} or @code{\cite}
+macro, and no other message is being displayed, the echo area will
+display information about that cross reference.  You can also set the
+variable to the symbol @code{window}.  In this case a small temporary
+window is used for the display.  This feature can be turned on and of
+from the menu (Ref->Options->Crossref Viewing).@refill
 @end defopt
 
 @defopt reftex-idle-time
 session will read that file (if available) instead of parsing the
 document.@refill
 @item
-each time (part of) the document is rescanned, a new version of the file
-is written.@refill
+exiting Emacs or killing a buffer in reftex-mode will cause a new
+version of the file to be written.@refill
 @end itemize
 @end defopt
 
 
 You may also set the variable itself to t or nil in order to turn all
 options on or off, respectively.@*
-Supplying labels in new sections and environments aplies when creating
+Supplying labels in new sections and environments applies when creating
 sections with @kbd{C-c C-s} and environments with @kbd{C-c C-e}.@*
 Supplying macro arguments applies when you insert such a macro
 interactively with @kbd{C-c @key{RET}}.@*
 @end deffn
 
 Furthermore, the 3 modes used for referencing labels, creating citations
-and fo the table of contents buffer have their own keymaps and mode
+and for the table of contents buffer have their own keymaps and mode
 hooks.  See the respective sections: @ref{Options (Referencing Labels)},
 @ref{Options (Creating Citations)}, and @ref{Options (Table of
 Contents)}.@refill
 @item
 @b{Ref@TeX{}} notifies AUCTeX about new labels.
 @item
-@code{TeX-arg-ref} no longer used (introduction was unnecessaary).
+@code{TeX-arg-ref} no longer used (introduction was unnecessary).
 @item
 @code{reftex-arg-label} and @code{reftex-arg-cite} fixed up.
 @item
 @itemize @bullet
 @item
 In @code{reftex-citation}, the regular expression used to scan BibTeX
-files can be specified using copletion on known citation keys.
+files can be specified using completion on known citation keys.
 @item
-New keys @kbd{a} and @kbd{A} in BibTeX selecton process to cite @emph{all}
+New keys @kbd{a} and @kbd{A} in BibTeX selection process to cite @emph{all}
 entries.
 @item
 New command @code{reftex-renumber-simple-labels} to renumber simple
 Single byte representations of accented European letters (ISO-8859-1)
 are now legal in labels.
 @end itemize
+@noindent @b{Version 3.35}
+@itemize @bullet
+@item
+ISO 8859 Latin-1 chars are converted to ASCII to derive better labels.
+This takes back the related changes in 3.34 for safety reasons.@refill
+@end itemize
+@noindent @b{Version 3.36}
+@itemize @bullet
+@item
+New value @code{window} for option @var{reftex-auto-view-crossref}.
+@end itemize
+@noindent @b{Version 3.38}
+@itemize @bullet
+@item
+@code{reftex-view-crossref} no longer moves to find a macro.  Point has
+to be on the macro argument.
+@item
+Bugfix for selection process under XEmacs.
+@end itemize
 
 @node Index,  , , Top
 @unnumbered Index