emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110293: Merge from standalone RefTeX


From: Ralf Angeli
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110293: Merge from standalone RefTeX repository.
Date: Sun, 30 Sep 2012 22:30:13 +0200
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110293
committer: Ralf Angeli <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-30 22:30:13 +0200
message:
  Merge from standalone RefTeX repository.
  
  Here is the ChangeLog of the standalone version of RefTeX without
  information about Makefiles and other auxiliary files.  The differences to
  the Emacs repository are documented in the respective ChangeLog files.
  
  2010-11-06  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-create-bibtex-file): Make sure that
        entries with whitespace at various places are found.
        (reftex-extract-bib-entries-from-thebibliography): Remove
        superfluous backslash.
  
  2010-10-16  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el
        (reftex-extract-bib-entries-from-thebibliography): Use
        `with-current-buffer'.
  
  2010-09-14  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-do-citation): Make it possible again
        to insert non-existent entries.
  
  2010-01-30  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el (reftex-syntax-table-for-bib, reftex-mode):
        Do not derive `reftex-syntax-table-for-bib' from
        `reftex-syntax-table' because parens have to retain their paren
        syntax in order for parsing of BibTeX entries like @book(...) to
        work.
  
  2009-09-12  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-label-alist): Doc fix.
  
        * lisp/reftex-toc.el (reftex-re-enlarge): Call `enlarge-window'
        only if there is something to do because in Emacs the horizontal
        version throws an error even if the parameter is 0.
  
  2009-08-08  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-index.el: Suppress byte-compiler warnings.  Move
        provide statement to end of file.
  
        * lisp/reftex-dcr.el: Suppress byte-compiler warnings.  Move
        provide statement to end of file.
  
        * lisp/reftex-auc.el: Suppress byte-compiler warnings.
  
        * doc/reftex.texi (Imprint): Mention Wolfgang in list of
        contributors.
  
        * lisp/reftex-vars.el (reftex-plug-into-AUCTeX): Doc fix.
  
  2009-07-05  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi (Creating Citations): Give a hint about how to
        auto-revert the BibTeX database file when using external editors.
  
        * lisp/reftex-cite.el (reftex-do-citation): Save match data when
        asking for optional arguments.
  
  2009-04-29  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el (reftex-in-comment): Do not error out if
        `comment-start-skip' is not set.
  
  2009-03-01  Wolfgang Mayer  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-all-used-citation-keys):
        Fix regexp to correctly extract all citations in the same line.
  
  2008-12-29  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-vref-is-default)
        (reftex-fref-is-default): Adapt doc string.
        (reftex-ref-style-default-list): New name for
        `reftex-ref-style-active-list'.  Use :set instead of :repeat.
        (reftex-vref-is-default, reftex-fref-is-default): Adapt to new
        name.
  
        * lisp/reftex-base.el (reftex-tie-multifile-symbols): Add doc
        string.
        (reftex-tie-multifile-symbols): Initialize
        `reftex-ref-style-list'.
        (reftex-untie-multifile-symbols): Add doc string.
        (reftex-add-index-macros): Doc fix.
        (reftex-ref-style-activate, reftex-ref-style-toggle)
        (reftex-ref-style-list): New functions.
        (reftex-mode-menu): Use them.
  
        * lisp/reftex-sel.el (reftex-select-cycle-ref-style-internal): Use
        `reftex-ref-style-list' function.
  
        * lisp/reftex-ref.el (reftex-reference): Use
        `reftex-ref-style-list' function.
  
        * doc/reftex.texi (Referencing Labels): Simplify section about
        reference macro cycling.
        (Reference Styles, Options (Referencing Labels)): Adapt to changed
        implementation.
  
  2008-12-18  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el (reftex-in-comment): Deal correctly with
        escaped comment characters.
  
  2008-11-30  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-ref-style-alist): Change structure
        so that it is not possible to use multiple different package names
        within a style.
        (reftex-ref-style-active-list): Adapt to new structure of
        `reftex-ref-style-alist'.
  
        * lisp/reftex-sel.el (reftex-select-cycle-active-ref-styles):
        Remove.
        (reftex-select-cycle-ref-style-internal): Adapt to new structure
        of `reftex-ref-style-alist'.
  
        * lisp/reftex-ref.el: Adapt creation of `reftex-<package>-<macro>'
        functions to new structure of `reftex-ref-style-alist'.
        (reftex-reference): Adapt to new structure of
        `reftex-ref-style-alist'.
  
        * lisp/reftex-base.el (reftex-mode-menu): Adapt to new structure
        of `reftex-ref-style-alist'.
  
        * doc/reftex.texi (Options (Referencing Labels)): Adapt to new
        structure of `reftex-ref-style-alist'.
  
  2008-10-16  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi (Referencing Labels, Reference Styles): Document
        changes in the referencing functionality.
  
  2008-10-15  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-ref-style-alist): Remove the symbols
        for symbols for macro type distinction.  Add characters for macro
        selection.
        (reftex-ref-macro-prompt): New variable.
  
        * lisp/reftex-sel.el (reftex-select-cycle-ref-style-internal):
        Remove code for testing macro type.
        (reftex-select-toggle-numref-pageref): Remove.
        (reftex-select-label-map): Remove binding for
        `reftex-select-toggle-numref-pageref'.
  
        * lisp/reftex-ref.el (reftex-reference): Prompt for a reference
        macro if `reftex-ref-macro-prompt' is non-nil.
  
        * lisp/reftex-base.el (reftex-select-with-char): Kill the RefTeX
        Select buffer when done.
  
  2008-06-07  David Kastrup  <address@hidden>
  
        * lisp/reftex-base.el (reftex-remove-if): Improve performance.
  
  2008-06-07  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-get-string-refs): Use a regexp
        alternative for better performance.
  
        * doc/reftex.texi (Commands): Mention options for definition of
        header and footer in BibTeX files.
        (Options (Creating Citations)): Document
        `reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.
  
        * lisp/reftex-cite.el (reftex-stringref-p): Remove.
        (reftex-get-string-refs): Do without `reftex-stringref-p' and use
        `reftex-remove-if' instead of the cl-based `remove-if'.
        (reftex-create-bibtex-file): Doc fix.
  
        * lisp/reftex-base.el (reftex-remove-if): New function.
  
  2008-06-07  Wolfgang Mayer  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-create-bibtex-header)
        (reftex-create-bibtex-footer): New variables.
  
        * lisp/reftex-cite.el (reftex-parse-bibtex-entry): Accept
        additional optional argument `raw' and keep quotes or braces if it
        is non-nil.
        (reftex-stringref-p, reftex-get-string-refs): New functions.
        (reftex-create-bibtex-file): Include entries that are
        cross-referenced from cited entries.  Include @String definitions
        in the resulting bib file.  Add header and footer defined in
        `reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.
  
  2008-05-03  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-parse.el (reftex-parse-from-file): Move backward one
        char if a `\' was matched after a section macro.
  
        * lisp/reftex-global.el (reftex-isearch-switch-to-next-file): Use
        `reverse' instead of `nreverse' and `copy-list' in order to make
        the byte compiler happy.  Get rid of unused `orig-flist' variable.
  
        * lisp/reftex-base.el (reftex-compile-variables): Revert last
        change.  Match `\' after a section macro.
        (reftex-mapconcat-with-predicate): Remove.
  
  2008-04-13  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el (reftex-mapconcat-with-predicate): New
        function.
        (reftex-compile-variables): Use it.  Treat environments and macros
        differently in the regexp for section matching.
  
        * lisp/reftex-parse.el (reftex-parse-from-file): Use beginning of
        match instead of end as bound.
  
        * lisp/reftex-sel.el (reftex-select-label-map): Changing binding
        of reference style toggling to "s" which is not already taken.
  
        * doc/reftex.texi (Reference Styles): Reflect change in key
        binding for toggling reference styles.  Some minor changes.
  
  2008-03-27  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el: Some whitespace, doc and checkdoc fixes.
  
  2008-03-16  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-index.el (reftex-index-selection-or-word): Use
        `reftex-region-active-p'.
        (reftex-index-show-entry)
        (reftex-index-initialize-phrases-buffer)
        (reftex-index-phrases-apply-to-region): Sync with Emacs trunk.
  
        * lisp/reftex-dcr.el (reftex-start-itimer-once): Silence the byte
        compiler.
  
        * lisp/reftex-auc.el: Move `provide' call to bottom of file.
  
        * lisp/reftex-base.el: Require easymenu and define autoloads
        earlier to avoid compiler warnings.
        (reftex-region-active-p, reftex-select-with-char)
        (reftex-show-commentary): Sync with version in Emacs trunk.
        (reftex-make-overlay, reftex-overlay-put, reftex-move-overlay)
        (reftex-delete-overlay): Define in a way which hides the XEmacs
        symbols from the byte compiler.
        (reftex-info): Silence the byte compiler.  Use `reftex.info'
        instead of `reftex' in order to get the correct file.
  
  2008-03-07  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-extract-bib-entries): Check if
        BibTeX file changed on disk and ask if it should be reread in case
        it did.
  
  2008-03-02  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi: Lots of small fixes.
        (Reference Styles): New section.
        (varioref (LaTeX package), fancyref (LaTeX package)): Remove.
        (Options (Referencing Labels)): Remove descriptions of deprecated
        variables `reftex-vref-is-default' and `reftex-fref-is-default'.
        Add descriptions for `reftex-ref-style-alist' and
        `reftex-ref-style-active-list'.
        (Referencing Labels): Update regarding reference styles.
  
  2008-02-17  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-ref.el (reftex-format-special): Add third argument
        for refstyle possible to be passed, making the byte compiler
        happy.
        (reftex-reference): Pass refstyle to `reftex-format-special'.
  
        * lisp/reftex-vars.el (reftex-ref-style-active-list): Make
        creation of type compatible with Emacs 21.
        (reftex-format-ref-function): Mention third argument of special
        format function.
  
        * lisp/reftex-base.el (reftex-mode-menu): Make creation of
        Reference Style menu compatible with Emacs 21.
  
        * doc/reftex.texi: Fix some typos.
  
  2008-01-27  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-ref-style-active-list): Doc fix.
  
        * lisp/reftex-base.el (reftex-erase-all-selection-and-index-buffers)
        (reftex-access-parse-file): Use `mapc' instead of `mapcar' where
        return value is not used.
  
        * lisp/reftex-ref.el (reftex-offer-label-menu): Use `mapc' instead
        of `mapcar' where return value is not used.
  
        * lisp/reftex-sel.el (reftex-select-item, reftex-select-unmark):
        Use `mapc' instead of `mapcar' where return value is not used.
  
        * lisp/reftex-vars.el (reftex-ref-style-alist)
        (reftex-ref-style-active-list): New variables.
        (reftex-vref-is-default, reftex-fref-is-default): Adapt doc string
        to new implementation.  Mark as obsolete.  Add compatibility code
        for honoring the variable values in case they are set.
  
        * lisp/reftex-base.el (reftex-mode-menu): Reference styles are now
        computed from `reftex-ref-style-alist'.  Fix typo.
  
        * lisp/reftex-ref.el (reftex-reference): Determine reference macro
        by looking at `reftex-ref-style-active-list' and
        `reftex-ref-style-alist'.  Use only one special format function.
        (reftex-varioref-vref, reftex-fancyref-fref)
        (reftex-fancyref-Fref): Remove definitions.  The functions are now
        generated from `reftex-ref-style-alist'.
        (reftex-format-vref, reftex-format-Fref, reftex-format-fref):
        Remove.
        (reftex-format-special): New function.
  
        * lisp/reftex-sel.el (reftex-select-toggle-varioref)
        (reftex-select-toggle-fancyref): Remove.
        (reftex-select-cycle-active-ref-styles)
        (reftex-select-cycle-ref-style-internal)
        (reftex-select-cycle-ref-style-forward)
        (reftex-select-cycle-ref-style-backward)
        (reftex-select-toggle-numref-pageref): New functions.
        (reftex-select-label-map): Use `v' and `V' for general cycling
        through reference styles.  Add `p' for switching between number
        and page reference types.
  
  2008-01-06  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el (reftex-pop-to-bibtex-entry)
        (reftex-extract-bib-entries-from-thebibliography): Match \bibitem
        entries with spaces or tabs in front of arguments.
        (reftex-insert-bib-matches): Use `mapc' instead of `mapcar'
        because return value is not used.
  
  2008-01-05  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-toc.el (reftex-make-separate-toc-frame): Hide
        non-operational call to `focus-frame' in Emacs for the compilers's
        sake.
  
  2008-01-03  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-dcr.el (reftex-mouse-view-crossref): Explain why
        point is set.
  
        * lisp/reftex-toc.el (reftex-toc-do-promote): Use `mapc' instead
        of `mapcar' because return value is not used.
        (reftex-toggle-auto-toc-recenter): Fix typo.
  
        * lisp/reftex-cite.el (reftex-do-citation): Use `mapc' instead of
        `mapcar' because return value is not used.
  
  2007-10-10  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-cite-format-builtin)
        (reftex-bibliography-commands): Add support for ConTeXt.
  
        * doc/reftex.texi (Citation Styles): Mention support for ConTeXt.
  
  2007-08-23  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi (Options (Defining Label Environments)): Fix
        typo.
  
  2007-07-22  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el (reftex-set-cite-format): Autoload.
        (reftex-access-parse-file): Create parse file in a way that does
        not interfere with recentf mode.
        (reftex-access-parse-file): Do not risk destroying an existing
        buffer.
  
  2007-07-07  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-parse.el (reftex-nth-arg): Use `forward-comment'
        instead of `comment-forward'.  The latter is not always available
        and the former is sufficient for LaTeX.
        (reftex-nth-arg): Revert last change since moving over whitespace
        and comments is done by `reftex-move-to-next-arg'.
  
  2007-05-20  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi (Citation Styles): Correct some mistakes.
  
  2007-04-03  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-cite.el: Delete trailing whitespace.
        (reftex-pop-to-bibtex-entry, reftex-extract-bib-entries)
        (reftex-parse-bibtex-entry, reftex-create-bibtex-file): Match
        entries containing numbers and symbol constituents.
  
  2007-03-28  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi: Replace BibTeX by @BibTeX{} throughout the
        file.
  
  2007-03-12  John Paul Wallington  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-format-ref-function)
        (reftex-format-cite-function): Fix custom type.
  
  2007-03-10  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-base.el: Remove information in comment already in
        imprint or cluttering output of `finder-commentary'.
        Require reftex.el.
  
        * lisp/reftex.el: Remove.  Now generated from reftex.el.in.
  
        * lisp/reftex-dcr.el: Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-global.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-index.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-parse.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-ref.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-sel.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-toc.el Remove version info in header.  Add
        maintainer info.
  
        * lisp/reftex-vars.el Remove version info in header.  Add
        maintainer info.
  
  2007-03-08  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi: Include macros.texi and version.texi.  Change
        maintainer and version information.  Express TeX, LaTeX, AUCTeX
        and RefTeX with macros.
        (Imprint): Change maintainer information.
  
  2007-03-04  Ralf Angeli  <address@hidden>
  
        * lisp/reftex.el: Update.
  
        * lisp/reftex-base.el (reftex-show-commentary): Look in
        reftex-base.el.
        (reftex-report-bug): New function.
  
        * lisp/reftex.el: Move original content to reftex-base.el.  Add
        new header and automatically generated autoloads.
  
        * lisp/reftex-base.el: New file.  Insert original content of
        reftex.el.  Remove autoload for `reftex-index-phrases-mode'.
        Delete trailing whitespace.
  
  2007-02-26  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-index.el (reftex-index-visit-phrases-buffer): Set
        marker when visiting buffer.  This allows for returning from the
        phrases file to the file one was just editing instead of the file
        where the last phrases was added from.
  
  2007-02-25  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-index.el (reftex-index-phrases-syntax-table): New
        variable.  Give ?\" punctuation syntax as it usually is not used
        as string quote in TeX-related modes and may occur unmatched.  The
        change also prevents fontification of quoted content.
        (reftex-index-phrases-mode): Use it.
  
        * lisp/reftex-cite.el (reftex-parse-bibtex-entry): Match fields
        containing hyphens (besides word constituents).
  
  2007-02-25  David Kastrup  <address@hidden>
  
        * lisp/reftex.el (reftex-uniquify, reftex-uniquify-by-car):
        Replace O(n^2) algorithms with O(n log n).  Introduce optional
        argument SORT (not yet used).  TODO: figure out callers that can
        specify SORT, in order to further speed this up.
  
  2007-02-25  Ralf Angeli  <address@hidden>
  
        * lisp/reftex-vars.el (reftex-cite-key-separator): New variable.
  
        * lisp/reftex-auc.el (reftex-arg-cite): Use
        `reftex-cite-key-separator'.
  
        * lisp/reftex-cite.el (reftex-do-citation)
        (reftex-figure-out-cite-format): Use `reftex-cite-key-separator'.
  
        * doc/reftex.texi (Options (Creating Citations)): Document
        `reftex-cite-key-separator'.
  
        * lisp/reftex-cite.el (reftex-do-citation): Return all keys, not
        just the first one.
  
        * lisp/reftex-auc.el (reftex-arg-cite): Correctly handle new
        value type returned by `reftex-citation'.
  
  2007-02-24  Ralf Angeli  <address@hidden>
  
        * doc/reftex.texi: Set correct filename for standalone
        distribution.
  
  2007-02-07  Ralf Angeli  <address@hidden>
  
        Create `reftex' module.
modified:
  doc/misc/ChangeLog
  doc/misc/reftex.texi
  lisp/ChangeLog
  lisp/textmodes/reftex-auc.el
  lisp/textmodes/reftex-cite.el
  lisp/textmodes/reftex-dcr.el
  lisp/textmodes/reftex-global.el
  lisp/textmodes/reftex-index.el
  lisp/textmodes/reftex-parse.el
  lisp/textmodes/reftex-ref.el
  lisp/textmodes/reftex-sel.el
  lisp/textmodes/reftex-toc.el
  lisp/textmodes/reftex-vars.el
  lisp/textmodes/reftex.el
=== modified file 'doc/misc/ChangeLog'
--- a/doc/misc/ChangeLog        2012-09-30 15:14:59 +0000
+++ b/doc/misc/ChangeLog        2012-09-30 20:30:13 +0000
@@ -1,3 +1,34 @@
+2012-09-30  Ralf Angeli  <address@hidden>
+
+       Merge from standalone RefTeX repository.
+
+       * reftex.texi: Express TeX, LaTeX, AUCTeX, BibTeX and RefTeX
+       with macros.
+       (Imprint): Mention Wolfgang in list of contributors.
+       (Creating Citations): Give a hint about how to
+       auto-revert the BibTeX database file when using external editors.
+       (Referencing Labels): Simplify section about reference macro
+       cycling.
+       (Options (Referencing Labels)): Adapt to new structure of
+       `reftex-ref-style-alist'.
+       (Referencing Labels, Reference Styles): Document changes in the
+       referencing functionality.
+       (Commands): Mention options for definition of header and footer in
+       BibTeX files.
+       (Options (Creating Citations)): Document
+       `reftex-create-bibtex-header' and `reftex-create-bibtex-footer'.
+       (Reference Styles): New section.
+       (varioref (LaTeX package), fancyref (LaTeX package)): Remove.
+       (Options (Referencing Labels)): Remove descriptions of deprecated
+       variables `reftex-vref-is-default' and `reftex-fref-is-default'.
+       Add descriptions for `reftex-ref-style-alist' and
+       `reftex-ref-style-default-list'.
+       (Referencing Labels): Update regarding reference styles.
+       (Citation Styles): Mention support for ConTeXt.
+       (Options (Defining Label Environments)): Fix typo.
+       (Options (Creating Citations)): Document
+       `reftex-cite-key-separator'.
+
 2012-09-30  Achim Gratz  <address@hidden>
 
        * org.texi: Add description of ORG_ADD_CONTRIB to info

=== modified file 'doc/misc/reftex.texi'
--- a/doc/misc/reftex.texi      2012-01-19 07:21:25 +0000
+++ b/doc/misc/reftex.texi      2012-09-30 20:30:13 +0000
@@ -6,26 +6,44 @@
 @syncodeindex vr cp
 @syncodeindex fn cp
 
address@hidden Version and Contact Info
address@hidden VERSION 4.31
address@hidden EDITION 4.31
address@hidden DATE February 2006
address@hidden AUCTEXSITE @uref{http://www.gnu.org/software/auctex/,AUCTeX 
distribution site}
address@hidden MAINTAINERSITE 
@uref{http://www.gnu.org/software/auctex/reftex.html,address@hidden web page}
address@hidden
address@hidden RefTeX {}
address@hidden
address@hidden macro
address@hidden AUCTeX {}
address@hidden
address@hidden macro
address@hidden BibTeX {}
address@hidden
address@hidden macro
address@hidden ConTeXt {}
address@hidden
address@hidden macro
address@hidden ifnottex
address@hidden
+\gdef\RefTeX{Ref\TeX}
+\gdef\AUCTeX{AUC\TeX}
+\gdef\BibTeX{Bib\TeX}
+\gdef\ConTeXt{Con\TeX t}
address@hidden tex
+
address@hidden ../emacs/emacsver.texi
+
address@hidden VERSION @value{EMACSVER}
address@hidden AUCTEXSITE @uref{http://www.gnu.org/software/auctex/,@AUCTeX{} 
web site}
address@hidden MAINTAINERSITE 
@uref{http://www.gnu.org/software/auctex/reftex.html,@RefTeX{} web page}
 @set MAINTAINERCONTACT @uref{mailto:auctex-devel@@gnu.org,contact the 
maintainers}
address@hidden MAINTAINER the address@hidden project
address@hidden SUPPORTADDRESS address@hidden user mailing list 
(@email{auctex@@gnu.org})
address@hidden DEVELADDRESS address@hidden developer mailing list 
(@email{auctex-devel@@gnu.org})
address@hidden BUGADDRESS address@hidden bug mailing list 
(@email{bug-auctex@@gnu.org})
address@hidden XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs 
ftp site}
address@hidden MAINTAINER the @AUCTeX{} project
address@hidden SUPPORTADDRESS @AUCTeX{} user mailing list 
(@email{auctex@@gnu.org})
address@hidden DEVELADDRESS @AUCTeX{} developer mailing list 
(@email{auctex-devel@@gnu.org})
address@hidden BUGADDRESS @AUCTeX{} bug mailing list 
(@email{bug-auctex@@gnu.org})
address@hidden XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs 
FTP site}
 @c %**end of header
 
 @copying
-This file documents @address@hidden, a package to do labels, references,
-citations and indices for LaTeX documents with Emacs.
-
-This is edition @value{EDITION} of the @address@hidden User Manual for
address@hidden@TeX{}} @value{VERSION}
+This manual documents @RefTeX{} (version @value{VERSION}), a package
+to do labels, references, citations and indices for LaTeX documents
+with Emacs.
 
 Copyright @copyright{} 1997-2012  Free Software Foundation, Inc.
 
@@ -64,9 +82,9 @@
 @end macro
 
 @titlepage
address@hidden address@hidden User Manual
address@hidden Support for LaTeX labels, references, citations and index 
entries with GNU Emacs
address@hidden Edition @value{EDITION}, @value{DATE}
address@hidden @RefTeX{} User Manual
address@hidden Support for @LaTeX{} labels, references, citations and index 
entries with GNU Emacs
address@hidden Version @value{VERSION}
 
 @author by Carsten Dominik
 @page
@@ -79,18 +97,17 @@
 
 @ifnottex
 @node Top,,,(dir)
address@hidden RefTeX
-
address@hidden@TeX{}} is a package for managing Labels, References,
-Citations and index entries with GNU Emacs.
-
-Don't be discouraged by the size of this manual, which covers
address@hidden@TeX{}} in great depth.  All you need to know to use
address@hidden@TeX{}} can be summarized on two pages (@pxref{RefTeX in a
-Nutshell}).  You can go back later to other parts of this document when
-needed.
-
address@hidden
address@hidden @RefTeX{}
+
address@hidden is a package for managing Labels, References, Citations and
+index entries with GNU Emacs.
+
+This manual documents @RefTeX{} version @value{VERSION}.
+
+Don't be discouraged by the size of this manual, which covers @RefTeX{}
+in great depth.  All you need to know to use @RefTeX{} can be summarized
+on two pages (@pxref{RefTeX in a Nutshell}).  You can go back later to
+other parts of this document when needed.
 
 @menu
 * Introduction::                     Quick-Start information.
@@ -106,8 +123,8 @@
 * Faces::                            Fontification of RefTeX's buffers.
 * Multifile Documents::              Document spread over many files.
 * Language Support::                 How to support other languages.
-* Finding Files::                    Included TeX files and BibTeX .bib files.
-* AUCTeX::                           Cooperation with AUCTeX.
+* Finding Files::                    Included @TeX{} files and @BibTeX{} .bib 
files.
+* AUCTeX::                           Cooperation with @AUCTeX{}.
 * Optimizations::                    When RefTeX is too slow.
 * Problems and Work-Arounds::        First Aid.
 * Imprint::                          Author, Web-site, Thanks
@@ -123,6 +140,7 @@
 * Index::                            The full index.
 
 @detailmenu
+ --- The Detailed Node Listing ---
 
 Introduction
 
@@ -136,9 +154,8 @@
 * Builtin Label Environments::       The environments RefTeX knows about.
 * Defining Label Environments::        ... and environments it doesn't.
 * Reference Info::                   View the label corresponding to a \ref.
+* Reference Styles::                 Macros to be used instead of \ref.
 * xr (LaTeX package)::               References to external documents.
-* varioref (LaTeX package)::         How to create \vref instead of \ref.
-* fancyref (LaTeX package)::         How to create \fref instead of \ref.
 
 Defining Label Environments
 
@@ -176,7 +193,7 @@
 AUCTeX
 
 * AUCTeX-RefTeX Interface::          How both packages work together
-* Style Files::                      AUCTeX's style files can support RefTeX
+* Style Files::                      @AUCTeX{}'s style files can support RefTeX
 * Bib-Cite::                         Hypertext reading of a document
 
 Options, Keymaps, Hooks
@@ -202,18 +219,18 @@
 @chapter Introduction
 @cindex Introduction
 
address@hidden@TeX{}} is a specialized package for support of labels,
-references, citations, and the index in LaTeX.  @address@hidden wraps
-itself round 4 LaTeX macros: @code{\label}, @code{\ref}, @code{\cite},
-and @code{\index}.  Using these macros usually requires looking up
-different parts of the document and searching through BibTeX database
-files.  @address@hidden automates these time--consuming tasks almost
-entirely.  It also provides functions to display the structure of a
-document and to move around in this structure quickly.
address@hidden is a specialized package for support of labels, references,
+citations, and the index in @LaTeX{}.  @RefTeX{} wraps itself round four
address@hidden macros: @code{\label}, @code{\ref}, @code{\cite}, and
address@hidden  Using these macros usually requires looking up different
+parts of the document and searching through @BibTeX{} database files.
address@hidden automates these time-consuming tasks almost entirely.  It also
+provides functions to display the structure of a document and to move
+around in this structure quickly.
 
 @iftex
-Don't be discouraged by the size of this manual, which covers @address@hidden
-in great depth.  All you need to know to use @address@hidden can be
+Don't be discouraged by the size of this manual, which covers @RefTeX{}
+in great depth.  All you need to know to use @RefTeX{} can be
 summarized on two pages (@pxref{RefTeX in a Nutshell}).  You can go
 back later to other parts of this document when needed.
 @end iftex
@@ -230,51 +247,122 @@
 @section Installation
 @cindex Installation
 
address@hidden@TeX{}} is bundled and pre--installed with Emacs since version
-20.2.  It was also bundled and pre--installed with XEmacs 19.16--20.x.
-XEmacs 21.x users want to install the corresponding plug-in package
-which is available from the @value{XEMACSFTP}.  See the XEmacs 21.x
-documentation on package installation for details.
-
-Users of earlier Emacs distributions (including Emacs 19) can get a copy
-of the @address@hidden distribution from the maintainers web-page.
address@hidden, for more information.
-
address@hidden Environment
address@hidden has been bundled and pre-installed with Emacs since
+version 20.2.  It has also been bundled and pre-installed with XEmacs
+19.16--20.x.  XEmacs 21.x users want to install the corresponding
+plug-in package which is available from the @value{XEMACSFTP}.  See the
+XEmacs 21.x documentation on package installation for details.
+
+Users of earlier Emacs distributions (including Emacs 19) or people
+craving for new features and bugs can get a copy of the @RefTeX{}
+distribution from the maintainer's web page.  @xref{Imprint}, for more
+information.  The following instructions will guide you through the
+process of installing such a distribution.
+
address@hidden Building and Installing
+
+Note: Currently installation is supported for Emacs only.  XEmacs users
+might want to refer to the @RefTeX{} package available through the
+package system of XEmacs.
+
address@hidden Installation with make
+
+In order to install RefTeX, unpack the distribution and edit the header
+of the Makefile.  Basically, you need to change the path specifications
+for Emacs Lisp files and info files.  Also, enter the name of your Emacs
+executable (usually either @samp{emacs} or @samp{xemacs}).
+
+Then, type 
+
address@hidden
+make
+make install
address@hidden example
+
+to compile and install the code and documentation.
+
+Per default @RefTeX{} is installed in its own subdirectory which might
+not be on your load path.  In this case, add it to load path with a
+command like the following, replacing the sample directory with the one
+where @RefTeX{} is installed in your case.
+
address@hidden
+(add-to-list 'load-path "/path/to/reftex")
address@hidden example
+
+Put this command into your init file before other @RefTeX{}-related
+settings.
+
address@hidden Installation by Hand
+
+If you want to get your hands dirty, there is also the possibility to
+install by manually copying files.
+
address@hidden a
address@hidden
+Copy the reftex*.el lisp files to a directory on your load path.  Make
+sure that no old copy of @RefTeX{} shadows these files.
address@hidden
+Byte compile the files.  The sequence of compiling should be:
+reftex-var.el, reftex.el, and then all the others.
address@hidden
+Copy the info file reftex.info to the info directory.
address@hidden enumerate
+
address@hidden Loading @RefTeX{}
+
+In order to make the most important functions for entering @RefTeX{}
+mode available add the following line to your init file.
+
address@hidden
+(require 'reftex)
address@hidden example
+
address@hidden Entering @RefTeX{} Mode
+
address@hidden turn-on-reftex
address@hidden reftex-mode
address@hidden LaTeX-mode-hook
address@hidden latex-mode-hook
+To turn @RefTeX{} Mode on and off in a particular buffer, use
address@hidden reftex-mode @key{RET}}.  To turn on @RefTeX{} Mode for all
+LaTeX files, add the following lines to your @file{.emacs} file:
+
address@hidden
+(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
+(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
address@hidden example
+
+That's all!
+
+To get started, read the documentation, in particular the
+summary. (@pxref{RefTeX in a Nutshell})
+
+In order to produce a printed version of the documentation, use
address@hidden pdf} to produce a reftex.pdf file.  Analogously you can use
+the @code{dvi}, @code{ps}, or @code{html} targets to create DVI,
+PostScript or HTML files.
+
address@hidden Environment
 @cindex Finding files
 @cindex BibTeX database files, not found
 @cindex TeX files, not found
 @cindex @code{TEXINPUTS}, environment variable
 @cindex @code{BIBINPUTS}, environment variable
 
address@hidden@TeX{}} needs to access all files which are part of a multifile
address@hidden needs to access all files which are part of a multifile
 document, and the BibTeX database files requested by the
address@hidden command.  To find these files, @address@hidden will
address@hidden command.  To find these files, @RefTeX{} will
 require a search path, i.e. a list of directories to check.  Normally
 this list is stored in the environment variables @code{TEXINPUTS} and
address@hidden which are also used by @address@hidden  However, on some
address@hidden which are also used by @RefTeX{}.  However, on some
 systems these variables do not contain the full search path.  If
address@hidden@TeX{}} does not work for you because it cannot find some files,
-read @ref{Finding Files}.
-
address@hidden Entering @address@hidden Mode
-
address@hidden turn-on-reftex
address@hidden reftex-mode
address@hidden LaTeX-mode-hook
address@hidden latex-mode-hook
-To turn @address@hidden Mode on and off in a particular buffer, use
address@hidden reftex-mode}.  To turn on @address@hidden Mode for all LaTeX
-files, add the following lines to your @file{.emacs} file:
-
address@hidden
-(add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
-(add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
address@hidden example
address@hidden does not work for you because it cannot find some files,
address@hidden Files}.
 
 @page
 @node RefTeX in a Nutshell, , Installation, Introduction
address@hidden @address@hidden in a Nutshell
address@hidden @RefTeX{} in a Nutshell
 @cindex Quick-Start
 @cindex Getting Started
 @cindex RefTeX in a Nutshell
@@ -289,7 +377,7 @@
 help.
 
 @item
address@hidden and address@hidden @address@hidden helps to create unique labels
address@hidden and address@hidden @RefTeX{} helps to create unique labels
 and to find the correct key for references quickly.  It distinguishes
 labels for different environments, knows about all standard
 environments (and many others), and can be configured to recognize any
@@ -300,7 +388,7 @@
 @item
 @b{Creating address@hidden
 Type @kbd{C-c (} (@code{reftex-label}) to insert a label at point.
address@hidden@TeX{}} will either
address@hidden will either
 @itemize @minus
 @item
 derive a label from context (default for section labels)
@@ -325,7 +413,7 @@
 @item
 @address@hidden
 Typing @kbd{C-c [} (@code{reftex-citation}) will let you specify a
-regular expression to search in current BibTeX database files (as
+regular expression to search in current @BibTeX{} database files (as
 specified in the @code{\bibliography} command) and pull out a list of
 matches for you to choose from.  The list is @emph{formatted} and
 sorted.  The selected article is referenced as @address@hidden@address@hidden
@@ -334,9 +422,9 @@
 
 @item
 @b{Index address@hidden
address@hidden@TeX{}} helps to enter index entries.  It also compiles all
address@hidden helps to enter index entries.  It also compiles all
 entries into an alphabetically sorted @file{*Index*} buffer which you
-can use to check and edit the entries.  @address@hidden knows about the
+can use to check and edit the entries.  @RefTeX{} knows about the
 standard index macros and can be configured to recognize any additional
 macros you have defined (@code{reftex-index-macros}).  Multiple indices
 are supported.
@@ -354,7 +442,7 @@
 @b{The Index Phrases File (Delayed Indexing)address@hidden
 Type @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word}) to add
 the current word or selection to a special @emph{index phrase file}.
address@hidden@TeX{}} can later search the document for occurrences of these
address@hidden can later search the document for occurrences of these
 phrases and let you interactively index the matches.
 
 @item
@@ -366,11 +454,11 @@
 
 @page
 @item @b{Viewing address@hidden
-When point is on the @var{key} argument of a cross--referencing macro
+When point is on the @var{key} argument of a cross-referencing macro
 (@code{\label}, @code{\ref}, @code{\cite}, @code{\bibitem},
address@hidden, and variations) or inside a BibTeX database entry, you
address@hidden, and variations) or inside a @BibTeX{} database entry, you
 can press @kbd{C-c &} (@code{reftex-view-crossref}) to display
-corresponding locations in the document and associated BibTeX database
+corresponding locations in the document and associated @BibTeX{} database
 files. @*
 When the enclosing macro is @code{\cite} or @code{\ref} and no other
 message occupies the echo area, information about the citation or label
@@ -380,12 +468,12 @@
 @b{Multifile address@hidden
 Multifile Documents are fully supported.  The included files must have a
 file variable @code{TeX-master} or @code{tex-main-file} pointing to the
-master file.  @address@hidden provides cross-referencing information from
+master file.  @RefTeX{} provides cross-referencing information from
 all parts of the document, and across document borders
 (@file{xr.sty}).
 
 @item
address@hidden address@hidden @address@hidden needs to parse the document in
address@hidden address@hidden @RefTeX{} needs to parse the document in
 order to find labels and other information.  It does it automatically
 once and updates its list internally when @code{reftex-label} and
 @code{reftex-index} are used.  To enforce reparsing, call any of the
@@ -394,20 +482,20 @@
 buffer, or the index buffer.
 
 @item
address@hidden @* If your major LaTeX mode is AUCTeX, @address@hidden can
-cooperate with it (see variable @code{reftex-plug-into-AUCTeX}).  AUCTeX
address@hidden@AUCTeX{}} @* If your major @LaTeX{} mode is @AUCTeX{}, @RefTeX{} 
can
+cooperate with it (see variable @code{reftex-plug-into-AUCTeX}).  @AUCTeX{}
 contains style files which trigger appropriate settings in
address@hidden@TeX{}}, so that for many of the popular LaTeX packages no
address@hidden, so that for many of the popular @LaTeX{} packages no
 additional customizations will be necessary.
 
 @item
 @b{Useful address@hidden
-To integrate RefTeX with AUCTeX, use
+To integrate RefTeX with @AUCTeX{}, use
 @lisp
 (setq reftex-plug-into-AUCTeX t)
 @end lisp
 
-To make your own LaTeX macro definitions known to @address@hidden,
+To make your own @LaTeX{} macro definitions known to @RefTeX{},
 customize the variables
 @example
 @code{reftex-label-alist}          @r{(for label macros/environments)}
@@ -417,15 +505,15 @@
 @code{reftex-index-default-macro}  @r{(to set the default macro)}
 @end example
 If you have a large number of macros defined, you may want to write
-an AUCTeX style file to support them with both AUCTeX and
address@hidden@TeX{}}.
+an @AUCTeX{} style file to support them with both @AUCTeX{} and
address@hidden
 
address@hidden @b{Where address@hidden Go ahead and use @address@hidden  Use 
its menus
address@hidden @b{Where address@hidden Go ahead and use @RefTeX{}.  Use its 
menus
 until you have picked up the key bindings.  For an overview of what you
 can do in each of the different special buffers, press @kbd{?}.  Read
-the manual if you get stuck, of if you are curious what else might be
+the manual if you get stuck, or if you are curious what else might be
 available.  The first part of the manual explains in
-a tutorial way how to use and customize @address@hidden  The second
+a tutorial way how to use and customize @RefTeX{}.  The second
 part is a command and variable reference.
 @end enumerate
 
@@ -463,10 +551,10 @@
 
 @tablesubheading{Moving around}
 @item n
-Goto next entry in the table of context.
+Goto next entry in the table of contents.
 
 @item p
-Goto previous entry in the table of context.
+Goto previous entry in the table of contents.
 
 @item C-c C-n
 Goto next section heading.  Useful when many labels and index entries
@@ -506,7 +594,7 @@
 @file{*toc*} buffer.  This is similar to pressing @key{SPC} after each
 cursor motion.  The default for this flag can be set with the variable
 @code{reftex-toc-follow-mode}.  Note that only context in files already
-visited is shown.  @address@hidden will not visit a file just for follow
+visited is shown.  @RefTeX{} will not visit a file just for follow
 mode.  See, however, the variable
 @code{reftex-revisit-to-follow}.
 
@@ -521,8 +609,8 @@
 Promote the current section.  This will convert @code{\section} to
 @code{\chapter}, @code{\subsection} to @code{\section} etc. If there is
 an active region, all sections in the region will be promoted, including
-the one at point.  To avoid mistakes, @address@hidden requires a fresh
-document scan before executing this command - if necessary, it will
+the one at point.  To avoid mistakes, @RefTeX{} requires a fresh
+document scan before executing this command -- if necessary, it will
 automatically do this scan and ask the user to repeat the promotion
 command.
 
@@ -578,7 +666,7 @@
 Toggle the display of labels in the @file{*toc*} buffer.  The default
 for this flag can be set with the variable
 @code{reftex-toc-include-labels}.  When called with a prefix argument,
address@hidden@TeX{}} will prompt for a label type and include only labels of
address@hidden will prompt for a label type and include only labels of
 the selected type in the @file{*toc*} buffer.  The mode line @samp{L<>}
 indicator shows which labels are included.
 
@@ -587,7 +675,7 @@
 Toggle the display of index entries in the @file{*toc*} buffer.  The
 default for this flag can be set with the variable
 @code{reftex-toc-include-index-entries}.  When called with a prefix
-argument, @address@hidden will prompt for a specific index and include
+argument, @RefTeX{} will prompt for a specific index and include
 only entries in the selected index in the @file{*toc*} buffer.  The mode
 line @samp{I<>} indicator shows which index is used.
 
@@ -605,18 +693,18 @@
 
 @item r
 @vindex reftex-enable-partial-scans
-Reparse the LaTeX document and rebuild the @file{*toc*} buffer.  When
+Reparse the @LaTeX{} document and rebuild the @file{*toc*} buffer.  When
 @code{reftex-enable-partial-scans} is address@hidden, rescan only the file this
 location is defined in, not the entire document.
 
 @item C-u r
-Reparse the @emph{entire} LaTeX document and rebuild the @file{*toc*}
+Reparse the @emph{entire} @LaTeX{} document and rebuild the @file{*toc*}
 buffer.
 
 @item x
 Switch to the @file{*toc*} buffer of an external document.  When the
 current document is using the @code{xr} package (@pxref{xr (LaTeX
-package)}), @address@hidden will switch to one of the external
+package)}), @RefTeX{} will switch to one of the external
 documents.
 
 
@@ -669,11 +757,11 @@
 @cindex LaTeX classes, KOMA-Script
 @cindex TOC entries for environments
 @vindex reftex-section-levels
-The section macros recognized by @address@hidden are all LaTeX section
+The section macros recognized by @RefTeX{} are all @LaTeX{} section
 macros (from @code{\part} to @code{\subsubparagraph}) and the commands
 @code{\addchap} and @code{\addsec} from the KOMA-Script classes.
 Additional macros can be configured with the variable
address@hidden  It is also possible to add certain LaTeX
address@hidden  It is also possible to add certain @LaTeX{}
 environments to the table of contents.  This is probably only useful for
 theorem-like environments. @xref{Defining Label Environments}, for an
 example.
@@ -686,21 +774,21 @@
 @cindex Label environment
 @cindex @code{\label}
 
-LaTeX provides a powerful mechanism to deal with cross--references in a
address@hidden provides a powerful mechanism to deal with cross-references in a
 document.  When writing a document, any part of it can be marked with a
-label, like @address@hidden@}}.  LaTeX records the current value of a
+label, like @address@hidden@}}.  @LaTeX{} records the current value of a
 certain counter when a label is defined.  Later references to this label
 (like @address@hidden@}}) will produce the recorded value of the
 counter.
 
 Labels can be used to mark sections, figures, tables, equations,
-footnotes, items in enumerate lists etc.  LaTeX is context sensitive in
+footnotes, items in enumerate lists etc.  @LaTeX{} is context sensitive in
 doing this: A label defined in a figure environment automatically
 records the figure counter, not the section counter.
 
 Several different environments can share a common counter and therefore
-a common label category.  E.g.  labels in both @code{equation} and
address@hidden environments record the value of the same counter - the
+a common label category.  For example labels in both @code{equation} and
address@hidden environments record the value of the same counter -- the
 equation counter.
 
 @menu
@@ -709,9 +797,8 @@
 * Builtin Label Environments::       The environments RefTeX knows about.
 * Defining Label Environments::        ... and environments it doesn't.
 * Reference Info::                   View the label corresponding to a \ref.
+* Reference Styles::                 Macros to be used instead of \ref.
 * xr (LaTeX package)::               References to external documents.
-* varioref (LaTeX package)::         How to create \vref instead of \ref.
-* fancyref (LaTeX package)::         How to create \fref instead of \ref.
 @end menu
 
 @node Creating Labels, Referencing Labels, , Labels and References
@@ -722,12 +809,12 @@
 @kindex C-c (
 @findex reftex-label
 
-In order to create a label in a LaTeX document, press @kbd{C-c (}
-(@code{reftex-label}).  Just like LaTeX, @address@hidden is context sensitive
+In order to create a label in a @LaTeX{} document, press @kbd{C-c (}
+(@code{reftex-label}).  Just like @LaTeX{}, @RefTeX{} is context sensitive
 and will figure out the environment it currently is in and adapt the
 label to that environment.  A label usually consists of a short prefix
-indicating the type of the label and a unique mark.  @address@hidden has
-3 different modes to create this mark.
+indicating the type of the label and a unique mark.  @RefTeX{} has
+three different modes to create this mark.
 
 @enumerate
 @item
@@ -735,10 +822,10 @@
 @vindex reftex-derive-label-parameters
 @vindex reftex-label-illegal-re
 @vindex reftex-abbrev-parameters
-A label can be derived from context.  This means, @address@hidden takes
+A label can be derived from context.  This means, @RefTeX{} takes
 the context of the label definition and constructs a label from
 address@hidden that the context may contain constructs which are
-invalid in labels.  @address@hidden will therefore strip the accent from
+invalid in labels.  @RefTeX{} will therefore strip the accent from
 accented Latin-1 characters and remove everything else which is not
 valid in labels.  This mechanism is safe, but may not be satisfactory
 for non-western languages.  Check the following variables if you need to
@@ -746,28 +833,28 @@
 @code{reftex-derive-label-parameters}, @code{reftex-label-illegal-re},
 @code{reftex-abbrev-parameters}.}.  This works best for section labels,
 where the section heading is used to construct a label.  In fact,
address@hidden@TeX{}}'s default settings use this method only for section
address@hidden's default settings use this method only for section
 labels.  You will be asked to confirm the derived label, or edit
 it.
 
 @item
 We may also use a simple unique number to identify a label.  This is
 mostly useful for labels where it is difficult to come up with a very
-good descriptive name.  @address@hidden's default settings use this method
-for equations, enumerate items and footnotes.  The author of @address@hidden
+good descriptive name.  @RefTeX{}'s default settings use this method
+for equations, enumerate items and footnotes.  The author of @RefTeX{}
 tends to write documents with many equations and finds it impossible
 to come up with good names for each of them.  These simple labels are
 inserted without query, and are therefore very fast.  Good descriptive
-names are not really necessary as @address@hidden will provide context to
+names are not really necessary as @RefTeX{} will provide context to
 reference a label (@pxref{Referencing Labels}).
 
 @item
 The third method is to ask the user for a label.  This is most
 useful for things which are easy to describe briefly and do not turn up
-too frequently in a document.  @address@hidden uses this for figures and
+too frequently in a document.  @RefTeX{} uses this for figures and
 tables.  Of course, one can enter the label directly by typing the full
 @address@hidden@}}.  The advantage of using @code{reftex-label}
-anyway is that @address@hidden will know that a new label has been defined.
+anyway is that @RefTeX{} will know that a new label has been defined.
 It will then not be necessary to rescan the document in order to access
 this label later.
 @end enumerate
@@ -777,9 +864,9 @@
 variable @code{reftex-insert-label-flags} (@pxref{Options (Creating
 Labels)}).
 
-If you are using AUCTeX to write your LaTeX documents, you can
+If you are using @AUCTeX{} to write your @LaTeX{} documents, you can
 set it up to delegate the creation of labels to
address@hidden@TeX{}}. @xref{AUCTeX}, for more information.
address@hidden @xref{AUCTeX}, for more information.
 
 @node Referencing Labels, Builtin Label Environments, Creating Labels, Labels 
and References
 @section Referencing Labels
@@ -792,24 +879,31 @@
 @findex reftex-reference
 
 @vindex reftex-trust-label-prefix
address@hidden@TeX{}} scans the document in order to find all labels.  To make
address@hidden scans the document in order to find all labels.  To make
 referencing labels easier, it assigns to each label a category, the
 @emph{label type} (for example section, table, figure, equation, etc.).
-In order to determine the label type, RefTeX parses around each label
+In order to determine the label type, @RefTeX{} parses around each label
 to see in what kind of environments it is located.  You can speed up
 the parsing by using type-specific prefixes for labels and configuring
 the variable @code{reftex-trust-label-prefix}.
 
-Referencing Labels is really at the heart of @address@hidden  Press @kbd{C-c
-)} in order to reference a label (reftex-reference).  This will start a
-selection process and finally insert the complete @address@hidden@}}
-into the buffer.
-
-First, @address@hidden will determine the label category which is required.
-Often that can be figured out from context.  For example, if you
-write @samp{As shown in eq.} and the press @kbd{C-c )}, @address@hidden knows
-that an equation label is going to be referenced.  If it cannot figure
-out what label category is needed, it will query for one.
+Referencing Labels is really at the heart of @RefTeX{}.  Press @kbd{C-c
+)} in order to reference a label (@code{reftex-reference}).  This will
+start a selection process and finally insert the complete
address@hidden@address@hidden into the buffer.
+
address@hidden reftex-ref-macro-prompt
+First, you can select which reference macro you want to use,
+e.g. @samp{\ref} or @samp{\pageref}.  Later in the process you have
+another chance to make this selection and you can therefore disable this
+step by customizing @code{reftex-ref-macro-prompt} if you find it too
+intrusive.  @xref{Reference Styles}.
+
+Then, @RefTeX{} will determine the label category which is required.
+Often that can be figured out from context.  For example, if you write
address@hidden shown in eq.} and then press @kbd{C-c )}, @RefTeX{} knows that
+an equation label is going to be referenced.  If it cannot figure out
+what label category is needed, it will query for one.
 
 You will then be presented with a label selection menu.  This is a
 special buffer which contains an outline of the document along with all
@@ -820,7 +914,7 @@
 label, pressing @key{SPC} will show the label definition point in
 another window.
 
-In order to reference a label, move to cursor to the correct label and
+In order to reference a label, move the cursor to the correct label and
 press @key{RET}.  You can also reference several labels with a single
 call to @code{reftex-reference} by marking entries with the @kbd{m}
 key (see below).
@@ -871,7 +965,7 @@
 Toggle follow mode.  When follow mode is active, the other window will
 always display the full context of the current label.  This is similar
 to pressing @key{SPC} after each cursor motion.  Note that only context
-in files already visited is shown.  @b{RefTeX} will not visit a file
+in files already visited is shown.  @RefTeX{} will not visit a file
 just for follow mode.  See, however, the variable
 @code{reftex-revisit-to-follow}.
 
@@ -888,8 +982,8 @@
 @item mouse-2
 @vindex reftex-highlight-selection
 Clicking with mouse button 2 on a label will accept it like @key{RET}
-would. See also variable @code{reftex-highlight-selection}, @ref{Options
-(Misc)}.
+would.  See also variable @code{reftex-highlight-selection},
address@hidden (Misc)}.
 
 @vindex reftex-multiref-punctuation
 @item m - + ,
@@ -923,26 +1017,15 @@
 yet exist in the document.
 
 @item v
address@hidden @code{varioref}, LaTeX package
address@hidden @code{\vref}
address@hidden LaTeX packages, @code{varioref}
-Toggle between @code{\ref} and @code{\vref} macro for references.  The
address@hidden macro is defined in the @code{varioref} LaTeX package.
-With this key you can force @address@hidden to insert a @code{\vref}
-macro.  The current state of this flag is displayed by the @samp{S<>}
-indicator in the mode line of the selection buffer.
+Cycle forward through active reference macros.  The selected macro is
+displayed by the @samp{S<...>} indicator in the mode line of the
+selection buffer.  This mechanism comes in handy if you are using
address@hidden packages like @code{varioref} or @code{fancyref} and want to
+use the special referencing macros they provide (e.g. @code{\vref} or
address@hidden) instead of @code{\ref}.
 
 @item V
address@hidden @code{fancyref}, LaTeX package
address@hidden @code{\fref}
address@hidden @code{\Fref}
address@hidden LaTeX packages, @code{fancyref}
-Cycle between @code{\ref}, @code{\fref} and @code{\Fref}.  The
address@hidden and @code{\Fref} macros are defined in the @code{fancyref}
-LaTeX package.  With this key you can force @address@hidden to insert a
address@hidden or @code{\Fref} macro.  The current state of this flag is
-displayed by the @samp{S<>} indicator in the mode line of the
-selection buffer.
+Cycle backward through active reference macros.
 
 @tablesubheading{Exiting}
 
@@ -966,7 +1049,7 @@
 @item t
 Toggle the display of the table of contents in the selection buffer.
 With prefix @var{arg}, change the maximum level of toc entries displayed
-to @var{arg}.  Chapters are level 1, section are level 2.
+to @var{arg}.  Chapters are level 1, sections are level 2.
 
 @item #
 Toggle the display of a label counter in the selection buffer.
@@ -974,7 +1057,7 @@
 @item %
 Toggle the display of labels hidden in comments in the selection
 buffers.  Sometimes, you may have commented out parts of your document.
-If these parts contain label definitions, @address@hidden can still display
+If these parts contain label definitions, @RefTeX{} can still display
 and reference these labels.
 
 @tablesubheading{Updating the buffer}
@@ -998,7 +1081,7 @@
 a menu for that category will be shown.
 
 @item x
-Reference a label from an external document.  With the LaTeX package
+Reference a label from an external document.  With the @LaTeX{} package
 @code{xr} it is possible to reference labels defined in another
 document.  This key will switch to the label menu of an external
 document and let you select a label from there (@pxref{xr (LaTeX
@@ -1018,10 +1101,10 @@
 @vindex reftex-label-alist
 @vindex reftex-label-alist-builtin
 
address@hidden@TeX{}} needs to be aware of the environments which can be 
referenced
-with a label (i.e. which carry their own counters).  By default, 
@address@hidden
address@hidden needs to be aware of the environments which can be referenced
+with a label (i.e. which carry their own counters).  By default, @RefTeX{}
 recognizes all labeled environments and macros discussed in @cite{The
-LaTeX Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
address@hidden Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
 1994.}.  These are:
 
 @itemize @minus
@@ -1038,7 +1121,7 @@
 @cindex LaTeX core
 @code{figure}, @code{figure*}, @code{table}, @code{table*}, @code{equation},
 @code{eqnarray}, @code{enumerate}, the @code{\footnote} macro (this is
-the LaTeX core stuff)
+the @LaTeX{} core stuff)
 @item
 @cindex AMS-LaTeX
 @cindex @code{amsmath}, LaTeX package
@@ -1053,7 +1136,7 @@
 @cindex @code{subequations}, AMS-LaTeX environment
 @code{align}, @code{gather}, @code{multline}, @code{flalign},
 @code{alignat}, @code{xalignat}, @code{xxalignat}, @code{subequations}
-(from AMS-LaTeX's @file{amsmath.sty} package)
+(from address@hidden's @file{amsmath.sty} package)
 @item
 @cindex @code{endnote}, LaTeX package
 @cindex LaTeX packages, @code{endnote}
@@ -1112,7 +1195,7 @@
 @end itemize
 
 If you want to use other labeled environments, defined with
address@hidden, @address@hidden needs to be configured to recognize
address@hidden, @RefTeX{} needs to be configured to recognize
 them (@pxref{Defining Label Environments}).
 
 @node Defining Label Environments, Reference Info, Builtin Label Environments, 
Labels and References
@@ -1120,7 +1203,7 @@
 @cindex Label environments, defining
 
 @vindex reftex-label-alist
address@hidden@TeX{}} can be configured to recognize additional labeled
address@hidden can be configured to recognize additional labeled
 environments and macros.  This is done with the variable
 @code{reftex-label-alist} (@pxref{Options (Defining Label
 Environments)}).  If you are not familiar with Lisp, you can use the
@@ -1143,7 +1226,7 @@
 * Quick Equation::                   When a macro sets the label type.
 * Figure Wrapper::                   When a macro argument is a label.
 * Adding Magic Words::               Other words for other languages.
-* Using \eqref::                     How to switch to this AMS-LaTeX macro.
+* Using \eqref::                     How to switch to this address@hidden 
macro.
 * Non-Standard Environments::        Environments without \begin and \end
 * Putting it Together::              How to combine many entries.
 @end menu
@@ -1154,7 +1237,7 @@
 @cindex @code{axiom}, newtheorem
 @cindex @code{\newtheorem}
 
-Suppose you are using @code{\newtheorem} in LaTeX in order to define two
+Suppose you are using @code{\newtheorem} in @LaTeX{} in order to define two
 new environments, @code{theorem} and @code{axiom}
 
 @example
@@ -1172,7 +1255,7 @@
 address@hidden@}
 @end example
 
-So we need to tell @address@hidden that @code{theorem} and @code{axiom} are new
+So we need to tell @RefTeX{} 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
@@ -1184,7 +1267,7 @@
 @end lisp
 
 The type indicator characters @code{?a} and @code{?h} are used for
-prompts when @address@hidden queries for a label type.  @code{?h}
+prompts when @RefTeX{} queries for a label type.  @code{?h}
 was chosen for @code{theorem} since @code{?t} is already taken by
 @code{table}.  Note that also @code{?s}, @code{?f}, @code{?e},
 @code{?i}, @code{?n} are already used for standard environments.
@@ -1192,10 +1275,10 @@
 @noindent
 The labels for Axioms and Theorems will have the prefixes @samp{ax:} and
 @samp{thr:}, respectively.  @xref{AUCTeX}, for information on how
-AUCTeX can use RefTeX to automatically create labels when a new environment
-is inserted into a buffer.  Additionally, the following needs to be
-added to one's .emacs file before AUCTeX will automatically create
-labels for the new environments.
address@hidden can use @RefTeX{} to automatically create labels when a new
+environment is inserted into a buffer.  Additionally, the following
+needs to be added to one's .emacs file before @AUCTeX{} will
+automatically create labels for the new environments.
 
 @lisp
 (add-hook 'LaTeX-mode-hook
@@ -1226,9 +1309,9 @@
 @end itemize
 
 The following list of strings is used to guess the correct label type
-from the word before point when creating a reference.  E.g. if you
+from the word before point when creating a reference.  For example if you
 write: @samp{As we have shown in Theorem} and then press @kbd{C-c )},
address@hidden@TeX{}} will know that you are looking for a theorem label and
address@hidden will know that you are looking for a theorem label and
 restrict the menu to only these labels without even asking.
 
 The final item in each entry is the level at which the environment
@@ -1299,7 +1382,7 @@
 Einstein's equation is address@hidden address@hidden:address@hidden@}.
 @end example
 
-We need to tell @address@hidden that any label defined in the argument of the
+We need to tell @RefTeX{} that any label defined in the argument of the
 @code{\quickeq} is an equation label.  Here is how to do this with lisp:
 
 @lisp
@@ -1310,7 +1393,7 @@
 @emph{image} of the macro arguments.  @code{?e} indicates that this is
 an equation label, the different @code{nil} elements indicate to use the
 default values for equations.  The @samp{1} as the fifth element
-indicates that the context of the label definition should be the 1st
+indicates that the context of the label definition should be the first
 argument of the macro.
 
 Here is again how this would look in the customization buffer:
@@ -1352,7 +1435,7 @@
 address@hidden@address@hidden address@hidden@address@hidden@address@hidden
 @end example
 
-Now we need to tell @address@hidden that the 4th argument of the
+Now we need to tell @RefTeX{} that the fourth argument of the
 @code{\myfig} macro @emph{is itself} a figure label, and where to find
 the context.
 
@@ -1366,8 +1449,8 @@
 indicates that this is a figure label which will be listed together with
 labels from normal figure environments.  The @code{nil} entries for
 prefix and reference format mean to use the defaults for figure labels.
-The @samp{3} for the context method means to grab the 3rd macro argument
-- the caption.
+The @samp{3} for the context method means to grab the third macro argument
+-- the caption.
 
 As a side effect of this configuration, @code{reftex-label} will now
 insert the required naked label (without the @code{\label} macro) when
@@ -1420,7 +1503,7 @@
 
 Another case where one only wants to change the information associated
 with the label category is to change the macro which is used for
-referencing the label.  When working with the AMS-LaTeX stuff, you might
+referencing the label.  When working with the address@hidden, you might
 prefer @code{\eqref} for doing equation references.  Here is how to
 do this:
 
@@ -1428,7 +1511,7 @@
 (setq reftex-label-alist '((nil ?e nil "address@hidden@}" nil nil)))
 @end lisp
 
address@hidden@TeX{}} has also a predefined symbol for this special purpose.  
The
address@hidden has also a predefined symbol for this special purpose.  The
 following is equivalent to the line above.
 
 @lisp
@@ -1436,7 +1519,7 @@
 @end lisp
 
 Note that this is automatically done by the @file{amsmath.el} style file
-of AUCTeX (@pxref{Style Files}) - so if you use AUCTeX,
+of @AUCTeX{} (@pxref{Style Files}) -- so if you use @AUCTeX{},
 this configuration will not be necessary.
 
 @node Non-Standard Environments, Putting it Together, Using \eqref, Defining 
Label Environments
@@ -1446,8 +1529,8 @@
 @cindex Special parser functions
 @cindex Parser functions, for special environments
 
-Some LaTeX packages define environment-like structures without using the
-standard @samp{\begin..\end} structure.  @address@hidden cannot parse
+Some @LaTeX{} packages define environment-like structures without using the
+standard @samp{\begin..\end} structure.  @RefTeX{} cannot parse
 these directly, but you can write your own special-purpose parser and
 use it instead of the name of an environment in an entry for
 @code{reftex-label-alist}.  The function should check if point is
@@ -1506,7 +1589,7 @@
 The difficulty is that the @samp{\a.} lists can nest and that an empty
 line terminates all list levels in one go.  So we have to count nesting
 levels between @samp{\a.} and @samp{\z.}.  Here is the implementation
-for @address@hidden
+for @RefTeX{}.
 
 @lisp
 (setq reftex-label-alist
@@ -1558,7 +1641,7 @@
     (detect-linguex ?x "ex:" "address@hidden@}" nil ("Example" "Ex."))))
 @end lisp
 
address@hidden Reference Info, xr (LaTeX package), Defining Label Environments, 
Labels and References
address@hidden Reference Info, Reference Styles, Defining Label Environments, 
Labels and References
 @section Reference Info
 @findex reftex-view-crossref
 @findex reftex-mouse-view-crossref
@@ -1575,12 +1658,100 @@
 is only displayed if the echo area is not occupied by a different
 message.
 
address@hidden@TeX{}} can also display the label definition corresponding to a
address@hidden can also display the label definition corresponding to a
 @code{\ref} macro, or all reference locations corresponding to a
 @code{\label} macro.  @xref{Viewing Cross-References}, for more
 information.
 
address@hidden xr (LaTeX package), varioref (LaTeX package), Reference Info, 
Labels and References
address@hidden Reference Styles, xr (LaTeX package), Reference Info, Labels and 
References
address@hidden Reference Styles
+
+In case you defined your own macros for referencing or you are using
address@hidden packages providing specialized macros to be used instead of
address@hidden, @RefTeX{} provides ways to select and insert them in a
+convenient way.
+
address@hidden comes equipped with a set of so-called reference styles where
+each relates to one or more reference macros.  The standard macros
address@hidden and @samp{\pageref} or provided by the ``Default'' style.
+The ``Varioref'' style offers macros for the @samp{varioref} @LaTeX{}
+package (@samp{\vref}, @samp{\Vref}, @samp{\Ref}, @samp{\vpageref}),
+``Fancyref'' for the @samp{fancyref} package (@samp{\fref},
address@hidden) and ``Hyperref'' for the @samp{hyperref} package
+(@samp{\autoref}, @samp{\autopageref}).
+
address@hidden reftex-ref-style-default-list
+A style can be toggled by selecting the respective entry in the
address@hidden Style} menu.  Changes made through the menu will only
+last for the Emacs session.  In order to configure a preference
+permanently, the variable @code{reftex-ref-style-default-list} should be
+customized.  This variable specifies the list of styles to be activated.
+It can also be set as a file variable if the preference should be set
+for a specific file.
+
address@hidden reftex-ref-style-alist
+In case the built-in styles do not suffice, you can add additional
+macros and styles to the variable @code{reftex-ref-style-alist}.  Those
+do not necessarily have to be related to a certain @LaTeX{} package but
+can follow an arbitrary grouping rule.  For example you could define a
+style called ``Personal'' for your personal referencing macros.  (When
+changing the variable you should be aware that other Emacs packages,
+like @AUCTeX{}, might rely on the entries from the default value to be
+present.)
+
+Once a style is active the macros it relates to are available for
+selection when you are about to insert a reference.  In general this
+process involves three steps: the selection of a reference macro, a
+label type and a label.  Reference macros can be chosen in the first and
+last step.
+
address@hidden reftex-ref-macro-prompt
+In the first step you will be presented with a list of macros from which
+you can select one by typing a single key.  If you dislike having an
+extra step for reference macro selection, you can disable it by
+customizing @code{reftex-ref-macro-prompt} and relying only on the
+selection facilities provided in the last step.
+
+In the last step, i.e. the label selection, two key bindings are
+provided to set the reference macro.  Type @key{v} in order to cycle
+forward through the list of available macros or @key{V} to cycle
+backward.  The mode line of the selection buffer shows the macro
+currently selected.
+
+In case you are not satisfied with the order of macros when cycling
+through them you should adapt the order of entries in the variable
address@hidden to fit your liking.
+
+For each entry in @code{reftex-ref-style-alist} a function with the name
address@hidden<package>-<macro>} (e.g. @code{reftex-varioref-vref}) will
+be created automatically by @RefTeX{}.  These functions can be used
+instead of @kbd{C-c )} and provide an alternative way of having your
+favorite referencing macro preselected and if cycling through the macros
+seems inconvenient to address@hidden could e.g. bind
address@hidden to @kbd{C-c v} and
address@hidden to @kbd{C-c f}.}
+
address@hidden @code{varioref}, LaTeX package
address@hidden LaTeX packages, @code{varioref}
address@hidden @code{fancyref}, LaTeX package
address@hidden LaTeX packages, @code{fancyref}
address@hidden reftex-vref-is-default (deprecated)
address@hidden reftex-fref-is-default (deprecated)
+In former versions of @RefTeX{} only support for @code{varioref} and
address@hidden was included.  @code{varioref} is a @LaTeX{} package to
+create cross-references with page information.  @code{fancyref} is a
+package where a macro call like @address@hidden@var{fig:address@hidden
+creates not only the number of the referenced counter but also the
+complete text around it, like @samp{Figure 3 on the preceding page}.  In
+order to make it work you need to use label prefixes like @samp{fig:}
+consistently -- something @RefTeX{} does automatically.  For each of
+these packages a variable could be configured to make its macros to take
+precedence over @code{\ref}.  Those were @code{reftex-vref-is-default}
+and @code{reftex-fref-is-default} respectively.  While still working,
+these variables are deprecated now.  Instead of setting them, the
+variable @code{reftex-ref-style-default-list} should be adapted now.
+
address@hidden xr (LaTeX package), , Reference Styles, Labels and References
 @section @code{xr}: Cross-Document References
 @cindex @code{xr}, LaTeX package
 @cindex LaTeX packages, @code{xr}
@@ -1589,7 +1760,7 @@
 @cindex References to external documents
 @cindex Cross-document references
 
-The LaTeX package @code{xr} makes it possible to create references to
+The @LaTeX{} package @code{xr} makes it possible to create references to
 labels defined in external documents.  The preamble of a document using
 @code{xr} will contain something like this:
 
@@ -1604,66 +1775,26 @@
 external documents by using the prefixes @samp{V1-} and @samp{V3-},
 respectively.
 
address@hidden@TeX{}} can be used to create such references as well.  Start the
address@hidden can be used to create such references as well.  Start the
 referencing process normally, by pressing @kbd{C-c )}.  Select a label
 type if necessary.  When you see the label selection buffer, pressing
 @kbd{x} will switch to the label selection buffer of one of the external
-documents.  You may then select a label as before and @address@hidden will
+documents.  You may then select a label as before and @RefTeX{} will
 insert it along with the required prefix.
 
 For this kind of inter-document cross-references, saving of parsing
 information and the use of multiple selection buffers can mean a large
 speed-up (@pxref{Optimizations}).
 
address@hidden varioref (LaTeX package), fancyref (LaTeX package), xr (LaTeX 
package), Labels and References
address@hidden @code{varioref}: Variable Page References
address@hidden @code{varioref}, LaTeX package
address@hidden @code{\vref}
address@hidden LaTeX packages, @code{varioref}
address@hidden reftex-vref-is-default
address@hidden is a frequently used LaTeX package to create
-cross--references with page information.  When you want to make a
-reference with the @code{\vref} macro, just press the @kbd{v} key in the
-selection buffer to toggle between @code{\ref} and @code{\vref}
-(@pxref{Referencing Labels}).  The mode line of the selection buffer
-shows the current status of this switch.  If you find that you almost
-always use @code{\vref}, you may want to make it the default by
-customizing the variable @code{reftex-vref-is-default}.  If this
-toggling seems too inconvenient, you can also use the command
address@hidden@footnote{bind it to @kbd{C-c v}.}.
-Or use AUCTeX to create your macros (@pxref{AUCTeX}).
-
address@hidden fancyref (LaTeX package), , varioref (LaTeX package), Labels and 
References
address@hidden @code{fancyref}: Fancy Cross References
address@hidden @code{fancyref}, LaTeX package
address@hidden @code{\fref}
address@hidden @code{\Fref}
address@hidden LaTeX packages, @code{fancyref}
address@hidden reftex-fref-is-default
address@hidden is a LaTeX package where a macro call like
address@hidden@address@hidden:address@hidden creates not only the number of
-the referenced counter but also the complete text around it, like
address@hidden 3 on the preceding page}.  In order to make it work you
-need to use label prefixes like @samp{fig:} consistently - something
address@hidden@TeX{}} does automatically.  When you want to make a reference
-with the @code{\fref} macro, just press the @kbd{V} key in the selection
-buffer to cycle between @code{\ref}, @code{\fref} and @code{\Fref}
-(@pxref{Referencing Labels}).  The mode line of the selection buffer
-shows the current status of this switch.  If this cycling seems
-inconvenient, you can also use the commands @code{reftex-fancyref-fref}
-and @address@hidden them to @kbd{C-c
-f} and @kbd{C-c F}.}.  Or use AUCTeX to create your macros
-(@pxref{AUCTeX}).
-
 @node Citations, Index Support, Labels and References, Top
 @chapter Citations
 @cindex Citations
 @cindex @code{\cite}
 
-Citations in LaTeX are done with the @code{\cite} macro or variations of
+Citations in @LaTeX{} are done with the @code{\cite} macro or variations of
 it.  The argument of the macro is a citation key which identifies an
-article or book in either a BibTeX database file or in an explicit
address@hidden environment in the document.  @address@hidden's
+article or book in either a @BibTeX{} database file or in an explicit
address@hidden environment in the document.  @RefTeX{}'s
 support for citations helps to select the correct key quickly.
 
 @menu
@@ -1684,7 +1815,7 @@
 @cindex Selection buffer, citations
 @cindex Selection process
 
-In order to create a citation, press @kbd{C-c [}.  @address@hidden then
+In order to create a citation, press @kbd{C-c [}.  @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
@@ -1695,8 +1826,8 @@
 @samp{Einstein&&Bose} 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
+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 @samp{\cite} command.  Sometimes this may be a
 good search key.
 
@@ -1704,16 +1835,16 @@
 @cindex @code{thebibliography}, LaTeX environment
 @cindex @code{BIBINPUTS}, environment variable
 @cindex @code{TEXBIB}, environment variable
address@hidden@TeX{}} prefers to use BibTeX database files specified with a
address@hidden prefers to use @BibTeX{} database files specified with a
 @code{\bibliography} macro to collect its information.  Just like
-BibTeX, it will search for the specified files in the current directory
address@hidden, 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
address@hidden environment, @address@hidden will collect its
+If you do not use @BibTeX{}, but the document contains an explicit
address@hidden 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
 @code{\bibitem} entries, not the structured listing available with
-BibTeX database files.
address@hidden database files.
 
 @kindex ?
 In the selection buffer, the following keys provide special commands.  A
@@ -1743,7 +1874,7 @@
 @item f
 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 @key{SPC} after each cursor motion.  With BibTeX
+equivalent to pressing @key{SPC} after each cursor motion.  With @BibTeX{}
 entries, follow mode can be rather slow.
 
 @tablesubheading{Selecting entries and creating the citation}
@@ -1774,12 +1905,12 @@
 separate @code{\cite} macro for each of it.
 
 @item e
-Create a new BibTeX database file which contains all @i{marked} entries
+Create a new @BibTeX{} database file which contains all @i{marked} entries
 in the selection buffer.  If no entries are marked, all entries are
 selected.
 
 @item E
-Create a new BibTeX database file which contains all @i{unmarked}
+Create a new @BibTeX{} database file which contains all @i{unmarked}
 entries in the selection buffer.  If no entries are marked, all entries
 are selected.
 
@@ -1814,6 +1945,17 @@
 In order to define additional commands for this selection process, the
 keymap @code{reftex-select-bib-map} may be used.
 
+Note that if you do not use Emacs to edit the @BibTeX{} database files,
address@hidden 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:
+
address@hidden
+(add-hook 'bibtex-mode-hook 'turn-on-auto-revert-mode)
address@hidden lisp
+
+
 @node Citation Styles, Citation Info, Creating Citations, Citations
 @section Citation Styles
 @cindex Citation styles
@@ -1821,20 +1963,22 @@
 @cindex Citation styles, @code{harvard}
 @cindex Citation styles, @code{chicago}
 @cindex Citation styles, @code{jurabib}
address@hidden Citation styles, @ConTeXt{}
 @cindex @code{natbib}, citation style
 @cindex @code{harvard}, citation style
 @cindex @code{chicago}, citation style
 @cindex @code{jurabib}, citation style
address@hidden @ConTeXt{}, citation style
 
 @vindex reftex-cite-format
-The standard LaTeX macro @code{\cite} works well with numeric or simple
-key citations.  To deal with the more complex task of author-year
+The standard @LaTeX{} macro @code{\cite} works well with numeric or
+simple key citations.  To deal with the more complex task of author-year
 citations as used in many natural sciences, a variety of packages has
 been developed which define derived forms of the @code{\cite} macro.
address@hidden@TeX{}} can be configured to produce these citation macros as well
-by setting the variable @code{reftex-cite-format}.  For the most
-commonly used packages (@code{natbib}, @code{harvard}, @code{chicago},
address@hidden) this may be done from the menu, under
address@hidden can be configured to produce these citation macros as well by
+setting the variable @code{reftex-cite-format}.  For the most commonly
+used @LaTeX{} packages (@code{natbib}, @code{harvard}, @code{chicago},
address@hidden) and for @ConTeXt{} this may be done from the menu, under
 @code{Ref->Citation Styles}.  Since there are usually several macros to
 create the citations, executing @code{reftex-citation} (@kbd{C-c [})
 starts by prompting for the correct macro.  For the Natbib style, this
@@ -1856,7 +2000,7 @@
 @end example
 
 @vindex reftex-cite-prompt-optional-args
-If cite formats contain empty paris of square brackets, RefTeX can
+If citation formats contain empty pairs of square brackets, @RefTeX{}
 will prompt for values of these optional arguments if you call the
 @code{reftex-citation} command with a @kbd{C-u} prefix.
 Following the most generic of these packages, @code{natbib}, the builtin
@@ -1872,12 +2016,12 @@
 (setq reftex-cite-format 'natbib)
 @end lisp
 
-You can also use AUCTeX style files to automatically set the
+You can also use @AUCTeX{} style files to automatically set the
 citation style based on the @code{usepackage} commands in a given
 document.  @xref{Style Files}, for information on how to set up the style
 files correctly.
 
address@hidden Citation Info, Chapterbib and Bibunits, Citation Styles, 
Citations, Top
address@hidden Citation Info, Chapterbib and Bibunits, Citation Styles, 
Citations
 @section Citation Info
 @cindex Displaying citations
 @cindex Citations, displaying
@@ -1893,9 +2037,9 @@
 information about the article cited there.  Note that the information is
 only displayed if the echo area is not occupied by a different message.
 
address@hidden@TeX{}} can also display the @code{\bibitem} or BibTeX database
address@hidden can also display the @code{\bibitem} or @BibTeX{} database
 entry corresponding to a @code{\cite} macro, or all citation locations
-corresponding to a @code{\bibitem} or BibTeX database entry.
+corresponding to a @code{\bibitem} or @BibTeX{} database entry.
 @xref{Viewing Cross-References}.
 
 @node Chapterbib and Bibunits, Citations Outside LaTeX, Citation Info, 
Citations
@@ -1904,24 +2048,24 @@
 @cindex @code{bibunits}, LaTeX package
 @cindex Bibliographies, multiple
 
address@hidden and @code{bibunits} are two LaTeX packages which
address@hidden and @code{bibunits} are two @LaTeX{} packages which
 produce multiple bibliographies in a document.  This is no problem for
address@hidden@TeX{}} as long as all bibliographies use the same BibTeX database
address@hidden as long as all bibliographies use the same @BibTeX{} database
 files.  If they do not, it is best to have each document part in a
 separate file (as it is required for @code{chapterbib} anyway).  Then
address@hidden@TeX{}} will still scan the locally relevant databases correctly. 
 If
address@hidden will still scan the locally relevant databases correctly.  If
 you have multiple bibliographies within a @emph{single file}, this may
 or may not be the case.
 
 @node Citations Outside LaTeX, BibTeX Database Subsets, Chapterbib and 
Bibunits, Citations
address@hidden Citations outside LaTeX
address@hidden Citations outside @LaTeX{}
 @cindex Citations outside LaTeX
 @vindex reftex-default-bibliography
 
-The command @code{reftex-citation} can also be executed outside a LaTeX
+The command @code{reftex-citation} can also be executed outside a @LaTeX{}
 buffer.  This can be useful to reference articles in the mail buffer and
 other documents.  You should @emph{not} enter @code{reftex-mode} for
-this, just execute the command.  The list of BibTeX files will in this
+this, just execute the command.  The list of @BibTeX{} files will in this
 case be taken from the variable @code{reftex-default-bibliography}.
 Setting the variable @code{reftex-cite-format} to the symbol
 @code{locally} does a decent job of putting all relevant information
@@ -1943,24 +2087,24 @@
 @cindex BibTeX database subsets
 @findex reftex-create-bibtex-file
 
address@hidden@TeX{}} offers two ways to create a new BibTeX database file.
address@hidden offers two ways to create a new @BibTeX{} database file.
 
 The first option produces a file which contains only the entries
 actually referenced in the current document.  This can be useful if
-the database in only meant for a single document and you want to clean
+the database is only meant for a single document and you want to clean
 it of old and unused ballast.  It can also be useful while writing a
 document together with collaborators, in order to avoid sending around
 the entire (possibly very large) database.  To create the file, use
 @kbd{M-x reftex-create-bibtex-file}, also available from the menu
 under @code{Ref->Global Actions->Create Bibtex File}.  The command will
-prompt for a BibTeX file name and write the extracted entries to that
+prompt for a @BibTeX{} file name and write the extracted entries to that
 file.
 
 The second option makes use of the selection process started by the
 command @kbd{C-c [} (@pxref{Creating Citations}).  This command uses a
 regular expression to select entries, and lists them in a formatted
 selection buffer.  After pressing the @kbd{e} key (mnemonics: Export),
-the command will prompt for the name of a new BibTeX file and write
+the command will prompt for the name of a new @BibTeX{} file and write
 the selected entries to that file.  You can also first mark some
 entries in the selection buffer with the @kbd{m} key and then export
 either the @i{marked} entries (with the @kbd{e} key) or the
@@ -1971,15 +2115,15 @@
 @cindex Index Support
 @cindex @code{\index}
 
-LaTeX has builtin support for creating an Index.  The LaTeX core
address@hidden has builtin support for creating an Index.  The @LaTeX{} core
 supports two different indices, the standard index and a glossary.  With
-the help of special LaTeX packages (@file{multind.sty} or
+the help of special @LaTeX{} packages (@file{multind.sty} or
 @file{index.sty}), any number of indices can be supported.
 
 Index entries are created with the @address@hidden@address@hidden macro.
 All entries defined in a document are written out to the @file{.aux}
 file.  A separate tool must be used to convert this information into a
-nicely formatted index.  Tools used with LaTeX include @code{MakeIndex}
+nicely formatted index.  Tools used with @LaTeX{} include @code{MakeIndex}
 and @code{xindy}.
 
 Indexing is a very difficult task.  It must follow strict conventions to
@@ -1996,27 +2140,27 @@
 very well be developed along with the document.  Often it is worthwhile
 to define special purpose macros which define an item and at the same
 time make an index entry, possibly with special formatting to make the
-reference page in the index bold or underlined.  To make @address@hidden
+reference page in the index bold or underlined.  To make @RefTeX{}
 support for indexing possible, these special macros must be added to
address@hidden@TeX{}}'s configuration (@pxref{Defining Index Macros}).
address@hidden's configuration (@pxref{Defining Index Macros}).
 
 @item
 The rest of the index is often just a collection of where in the
 document certain words or phrases are being used.  This part is
 difficult to develop along with the document, because consistent entries
 for each occurrence are needed and are best selected when the document
-is ready.  @address@hidden supports this with an @emph{index phrases file}
+is ready.  @RefTeX{} supports this with an @emph{index phrases file}
 which collects phrases and helps indexing the phrases globally.
 @end enumerate
 
-Before you start, you need to make sure that @address@hidden knows about
-the index style being used in the current document.  @address@hidden has
+Before you start, you need to make sure that @RefTeX{} knows about
+the index style being used in the current document.  @RefTeX{} has
 builtin support for the default @code{\index} and @code{\glossary}
-macros.  Other LaTeX packages, like the @file{multind} or @file{index}
+macros.  Other @LaTeX{} packages, like the @file{multind} or @file{index}
 package, redefine the @code{\index} macro to have an additional
-argument, and @address@hidden needs to be configured for those.  A
-sufficiently new version of AUCTeX (9.10c or later) will do this
-automatically.  If you really don't use AUCTeX (you should!), this
+argument, and @RefTeX{} needs to be configured for those.  A
+sufficiently new version of @AUCTeX{} (9.10c or later) will do this
+automatically.  If you really don't use @AUCTeX{} (you should!), this
 configuration needs to be done by hand with the menu (@code{Ref->Index
 Style}), or globally for all your documents with
 
@@ -2057,7 +2201,7 @@
 just call @code{reftex-index}, described below.
 
 In order to create a general index entry, press @kbd{C-c <}
-(@code{reftex-index}).  @address@hidden will prompt for one of the
+(@code{reftex-index}).  @RefTeX{} will prompt for one of the
 available index macros and for its arguments.  Completion will be
 available for the index entry and, if applicable, the index tag.  The
 index tag is a string identifying one of multiple indices.  With the
@@ -2072,7 +2216,7 @@
 @findex reftex-index-visit-phrases-buffer
 @cindex Macro definition lines, in phrase buffer
 
address@hidden@TeX{}} maintains a file in which phrases can be collected for
address@hidden maintains a file in which phrases can be collected for
 later indexing.  The file is located in the same directory as the master
 file of the document and has the extension @file{.rip} (@b{R}eftex
 @b{I}ndex @b{P}hrases).  You can create or visit the file with @kbd{C-c
@@ -2080,7 +2224,7 @@
 is initialized by inserting a file header which contains the definition
 of the available index macros.  This list is initialized from
 @code{reftex-index-macros} (@pxref{Defining Index Macros}).  You can
-edit the header as needed, but if you define new LaTeX indexing macros,
+edit the header as needed, but if you define new @LaTeX{} indexing macros,
 don't forget to add them to @code{reftex-index-macros} as well.  Here is
 a phrase file header example:
 
@@ -2122,7 +2266,7 @@
 command @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word})
 copies the current selection (if active) or the word near point into the
 phrases buffer.  It then selects this buffer, so that the phrase line
-can be edited.  To return to the LaTeX document, press @kbd{C-c C-c}
+can be edited.  To return to the @LaTeX{} document, press @kbd{C-c C-c}
 (@code{reftex-index-phrases-save-and-return}).
 
 You can also prepare the list of index phrases in a different way and
@@ -2131,7 +2275,7 @@
 indexed.
 
 The phrase lines in the phrase buffer must have a specific format.
address@hidden@TeX{}} will use font-lock to indicate if a line has the proper
address@hidden will use font-lock to indicate if a line has the proper
 format.  A phrase line looks like this:
 
 @example
@@ -2226,7 +2370,7 @@
 probably good to do indexing in small chunks since your concentration
 may not last long enough to do everything in one go.
 
address@hidden@TeX{}} will start at the first phrase line and search the phrase
address@hidden will start at the first phrase line and search the phrase
 globally in the whole document.  At each match it will stop, compute the
 replacement string and offer you the following address@hidden
 users: Restrict yourself to the described keys during indexing.  Pressing
@@ -2275,9 +2419,9 @@
 do not like.
 @item Wrap Long Lines
 Inserting index macros increases the line length.  Turn this option on
-to allow @address@hidden to wrap long lines.
+to allow @RefTeX{} to wrap long lines.
 @item Skip Indexed Matches
-When this is on, @address@hidden will at each match try to figure out if
+When this is on, @RefTeX{} will at each match try to figure out if
 this match is already indexed.  A match is considered indexed if it is
 either the argument of an index macro, or if an index macro is directly
 (without whitespace separation) before or after the match.  Index macros
@@ -2289,7 +2433,7 @@
 are bound to make changes afterwards.  Indexing then has to be applied
 to the changed regions.  The command
 @code{reftex-index-phrases-apply-to-region} is designed for this
-purpose.  When called from a LaTeX document with active region, it will
+purpose.  When called from a @LaTeX{} document with active region, it will
 apply @code{reftex-index-all-phrases} to the current region.
 
 @node Displaying and Editing the Index, Builtin Index Macros, The Index 
Phrases File, Index Support
@@ -2303,7 +2447,7 @@
 @findex reftex-display-index
 
 In order to compile and display the index, press @kbd{C-c >}.  If the
-document uses multiple indices, @address@hidden will ask you to select
+document uses multiple indices, @RefTeX{} will ask you to select
 one.  Then, all index entries will be sorted alphabetically and
 displayed in a special buffer, the @file{*Index*} buffer.  From that
 buffer you can check and edit each entry.
@@ -2317,7 +2461,7 @@
 restriction can be moved from one section to the next by pressing the
 @kbd{<} and @kbd{>} keys.
 
-One caveat: @address@hidden finds the definition point of an index entry
+One caveat: @RefTeX{} finds the definition point of an index entry
 by searching near the buffer position where it had found to macro during
 scanning.  If you have several identical index entries in the same
 buffer and significant changes have shifted the entries around, you must
@@ -2371,7 +2515,7 @@
 buffer at point.  This is similar to pressing @key{SPC} after each
 cursor motion.  The default for this flag can be set with the variable
 @code{reftex-index-follow-mode}.  Note that only context in files
-already visited is shown.  @address@hidden will not visit a file just for
+already visited is shown.  @RefTeX{} will not visit a file just for
 follow mode.  See, however, the variable
 @code{reftex-revisit-to-follow}.
 
@@ -2459,12 +2603,12 @@
 
 @item r
 @vindex reftex-enable-partial-scans
-Reparse the LaTeX document and rebuild the @file{*Index*} buffer.  When
+Reparse the @LaTeX{} document and rebuild the @file{*Index*} buffer.  When
 @code{reftex-enable-partial-scans} is address@hidden, rescan only the file this
 location is defined in, not the entire document.
 
 @item C-u r
-Reparse the @emph{entire} LaTeX document and rebuild the @file{*Index*}
+Reparse the @emph{entire} @LaTeX{} document and rebuild the @file{*Index*}
 buffer.
 
 @item s
@@ -2483,8 +2627,8 @@
 @cindex LaTeX packages, @code{multind}
 @cindex LaTeX packages, @code{index}
 
address@hidden@TeX{}} by default recognizes the @code{\index} and
address@hidden macros which are defined in the LaTeX core.  It has
address@hidden by default recognizes the @code{\index} and
address@hidden macros which are defined in the @LaTeX{} core.  It has
 also builtin support for the re-implementations of @code{\index}
 in the @file{multind} and @file{index} packages.  However, since
 the different definitions of the @code{\index} macro are incompatible,
@@ -2513,7 +2657,7 @@
 @address@hidden are using the syntax of the @file{index} package
 here.}.  The last macro also places its argument into the index, but as
 subitems under the main index entry @samp{Astronomical Objects}.  Here
-is how to make @address@hidden recognize and correctly interpret these
+is how to make @RefTeX{} recognize and correctly interpret these
 macros, first with Emacs Lisp.
 
 @lisp
@@ -2528,7 +2672,7 @@
 for the default index and for the glossary.
 
 The character arguments @code{?x}, @code{?n}, and @code{?o} are for
-quick identification of these macros when @address@hidden inserts new
+quick identification of these macros when @RefTeX{} inserts new
 index entries with @code{reftex-index}.  These codes need to be
 unique. @code{?i}, @code{?I}, and @code{?g} are reserved for the
 @code{\index}, @code{\index*}, and @code{\glossary} macros,
@@ -2589,22 +2733,22 @@
 The index tag is "idx".
 
 @node Viewing Cross-References, RefTeXs Menu, Index Support, Top
address@hidden Viewing Cross--References
address@hidden Viewing Cross-References
 @findex reftex-view-crossref
 @findex reftex-mouse-view-crossref
 @kindex C-c &
 @kindex S-mouse-2
 
address@hidden@TeX{}} can display cross--referencing information.  This means,
-if two document locations are linked, @address@hidden can display the
address@hidden can display cross-referencing information.  This means,
+if two document locations are linked, @RefTeX{} can display the
 matching location(s) in another window.  The @code{\label} and @code{\ref}
 macros are one way of establishing such a link.  Also, a @code{\cite}
-macro is linked to the corresponding @code{\bibitem} macro or a BibTeX
+macro is linked to the corresponding @code{\bibitem} macro or a @BibTeX{}
 database entry.
 
 The feature is invoked by pressing @kbd{C-c &}
 (@code{reftex-view-crossref}) while point is on the @var{key} argument
-of a macro involved in cross--referencing.  You can also click with
+of a macro involved in cross-referencing.  You can also click with
 @kbd{S-mouse-2} on the macro argument.  Here is what will happen for
 individual classes of macros:
 
@@ -2615,7 +2759,7 @@
 Display the corresponding label definition.  All usual
 address@hidden macros that start with @samp{ref} or end with
 @samp{ref} or @samp{refrange}} of the @code{\ref} macro are active for
-cross--reference display.  This works also for labels defined in an
+cross-reference display.  This works also for labels defined in an
 external document when the current document refers to them through the
 @code{xr} interface (@pxref{xr (LaTeX package)}).
 
@@ -2626,13 +2770,13 @@
 @kbd{C-c &} several times moves through the entire document and finds
 all locations.  Not only the @code{\label} macro but also other macros
 with label arguments (as configured with @code{reftex-label-alist}) are
-active for cross--reference display.
+active for cross-reference display.
 
 @item @code{\cite}
 @cindex @code{\cite}
-Display the corresponding BibTeX database entry or @code{\bibitem}.
+Display the corresponding @BibTeX{} database entry or @code{\bibitem}.
 All usual address@hidden macros that either start or end with
address@hidden of the @code{\cite} macro are active for cross--reference
address@hidden of the @code{\cite} macro are active for cross-reference
 display.
 
 @item @code{\bibitem}
@@ -2641,12 +2785,12 @@
 @kbd{C-c &} several times moves through the entire document and finds
 all locations.
 
address@hidden BibTeX
address@hidden @BibTeX{}
 @cindex BibTeX buffer, viewing cite locations from
 @cindex Viewing cite locations from BibTeX buffer
address@hidden &} is also active in BibTeX buffers.  All locations in a
address@hidden &} is also active in @BibTeX{} buffers.  All locations in a
 document where the database entry at point is cited will be displayed.
-On first use, @address@hidden will prompt for a buffer which belongs to
+On first use, @RefTeX{} will prompt for a buffer which belongs to
 the document you want to search.  Subsequent calls will use the same
 document, until you break this link with a prefix argument to @kbd{C-c
 &}.
@@ -2661,7 +2805,7 @@
 
 @vindex reftex-view-crossref-extra
 While the display of cross referencing information for the above
-mentioned macros is hard--coded, you can configure additional relations
+mentioned macros is hard-coded, you can configure additional relations
 in the variable @code{reftex-view-crossref-extra}.
 
 @iftex
@@ -2669,14 +2813,14 @@
 @end iftex
 
 @node RefTeXs Menu, Key Bindings, Viewing Cross-References, Top
address@hidden @address@hidden's Menu
address@hidden @RefTeX{}'s Menu
 @cindex RefTeXs Menu
 @cindex Menu, in the menu bar
 
address@hidden@TeX{}} installs a @code{Ref} menu in the menu bar on systems
address@hidden installs a @code{Ref} menu in the menu bar on systems
 which support this.  From this menu you can access all of
address@hidden@TeX{}}'s commands and a few of its options.  There is also a
address@hidden submenu which can be used to access @address@hidden's
address@hidden's commands and a few of its options.  There is also a
address@hidden submenu which can be used to access @RefTeX{}'s
 entire set of options.
 
 @node Key Bindings, Faces, RefTeXs Menu, Top
@@ -2713,7 +2857,7 @@
 @end example
 
 Note that the @kbd{S-mouse-2} binding is only provided if this key is
-not already used by some other package.  @address@hidden will not override an
+not already used by some other package.  @RefTeX{} will not override an
 existing binding to @kbd{S-mouse-2}.
 
 Personally, I also bind some functions in the users @kbd{C-c} map for
@@ -2749,7 +2893,7 @@
 @end lisp
 
 @vindex reftex-load-hook
-Changing and adding to @address@hidden's key bindings is best done in the hook
+Changing and adding to @RefTeX{}'s key bindings is best done in the hook
 @code{reftex-load-hook}.  For information on the keymaps
 which should be used to add keys, see @ref{Keymaps and Hooks}.
 
@@ -2757,9 +2901,9 @@
 @section Faces
 @cindex Faces
 
address@hidden@TeX{}} uses faces when available to structure the selection and
address@hidden uses faces when available to structure the selection and
 table of contents buffers.  It does not create its own faces, but uses
-the ones defined in @file{font-lock.el}.  Therefore, @address@hidden will
+the ones defined in @file{font-lock.el}.  Therefore, @RefTeX{} will
 use faces only when @code{font-lock} is loaded.  This seems to be
 reasonable because people who like faces will very likely have it
 loaded.  If you wish to turn off fontification or change the involved
@@ -2775,9 +2919,9 @@
 
 @itemize @bullet
 @item
address@hidden@TeX{}} has full support for multifile documents.  You can edit 
parts of
address@hidden has full support for multifile documents.  You can edit parts of
 several (multifile) documents at the same time without conflicts.
address@hidden@TeX{}} provides functions to run @code{grep}, @code{search} and
address@hidden provides functions to run @code{grep}, @code{search} and
 @code{query-replace} on all files which are part of a multifile
 document.
 
@@ -2785,10 +2929,10 @@
 @vindex tex-main-file
 @vindex TeX-master
 All files belonging to a multifile document should define a File
-Variable (@code{TeX-master} for AUCTeX or @code{tex-main-file} for the
-standard Emacs LaTeX mode) containing the name of the master file.  For
+Variable (@code{TeX-master} for @AUCTeX{} or @code{tex-main-file} for the
+standard Emacs @LaTeX{} mode) containing the name of the master file.  For
 example, to set the file variable @code{TeX-master}, include something
-like the following at the end of each TeX file:
+like the following at the end of each @TeX{} file:
 
 @example
 %%% Local Variables: ***
@@ -2797,7 +2941,7 @@
 %%% End: ***
 @end example
 
-AUCTeX with the setting
address@hidden with the setting
 
 @lisp
 (setq-default TeX-master nil)
@@ -2805,14 +2949,14 @@
 
 will actually ask you for each new file about the master file and insert
 this comment automatically.  For more details see the documentation of
-the AUCTeX (@pxref{Multifile,,,auctex, The AUC TeX User Manual}), the
+the @AUCTeX{} (@pxref{Multifile,,,auctex, The AUCTeX User Manual}), the
 documentation about the Emacs (La)TeX mode (@pxref{TeX Print,,,emacs,
 The GNU Emacs Manual}) and the Emacs documentation on File Variables
 (@pxref{File Variables,,,emacs, The GNU Emacs Manual}).
 
 @item
 The context of a label definition must be found in the same file as the
-label itself in order to be processed correctly by @address@hidden  The only
+label itself in order to be processed correctly by @RefTeX{}.  The only
 exception is that section labels referring to a section statement
 outside the current file can still use that section title as
 context.
@@ -2822,7 +2966,7 @@
 @section Language Support
 @cindex Language support
 
-Some parts of @address@hidden are language dependent.  The default
+Some parts of @RefTeX{} are language dependent.  The default
 settings work well for English.  If you are writing in a different
 language, the following hints may be useful:
 
@@ -2838,7 +2982,7 @@
 @item
 @vindex reftex-translate-to-ascii-function
 @vindex reftex-label-illegal-re
-Also, when a label is derived from context, @address@hidden clears the
+Also, when a label is derived from context, @RefTeX{} clears the
 context string from non-ASCII characters in order to make a valid label.
 If there should ever be a version of @TeX{} which allows extended
 characters @emph{in labels}, then we will have to look at the
@@ -2846,7 +2990,7 @@
 @code{reftex-label-illegal-re}.
 
 @item
-When a label is referenced, @address@hidden looks at the word before point
+When a label is referenced, @RefTeX{} looks at the word before point
 to guess which label type is required.  These @emph{magic words} are
 different in every language.  For an example of how to add magic words,
 see @ref{Adding Magic Words}.
@@ -2854,7 +2998,7 @@
 @vindex reftex-multiref-punctuation
 @vindex reftex-cite-punctuation
 @item
address@hidden@TeX{}} inserts ``punctuation'' for multiple references and
address@hidden inserts ``punctuation'' for multiple references and
 for the author list in citations.  Some of this may be language
 dependent.  See the variables @code{reftex-multiref-punctuation} and
 @code{reftex-cite-punctuation}.
@@ -2865,25 +3009,25 @@
 @cindex Finding files
 
 In order to find files included in a document via @code{\input} or
address@hidden, @address@hidden searches all directories specified in the
address@hidden, @RefTeX{} searches all directories specified in the
 environment variable @code{TEXINPUTS}.  Similarly, it will search the
 path specified in the variables @code{BIBINPUTS} and @code{TEXBIB} for
-BibTeX database files.
address@hidden database files.
 
-When searching, @address@hidden will also expand recursive path
+When searching, @RefTeX{} will also expand recursive path
 definitions (directories ending in @samp{//} or @samp{!!}).  But it will
 only search and expand directories @emph{explicitly} given in these
 variables. This may cause problems under the following circumstances:
 
 @itemize @bullet
 @item
-Most TeX system have a default search path for both TeX files and BibTeX
+Most @TeX{} system have a default search path for both @TeX{} files and 
@BibTeX{}
 files which is defined in some setup file.  Usually this default path is
-for system files which @address@hidden does not need to see.  But if your
-document needs TeX files or BibTeX database files in a directory only
-given in the default search path, @address@hidden will fail to find them.
+for system files which @RefTeX{} does not need to see.  But if your
+document needs @TeX{} files or @BibTeX{} database files in a directory only
+given in the default search path, @RefTeX{} will fail to find them.
 @item
-Some TeX systems do not use environment variables at all in order to
+Some @TeX{} systems do not use environment variables at all in order to
 specify the search path.  Both default and user search path are then
 defined in setup files.
 @end itemize
@@ -2896,7 +3040,7 @@
 Specify all relevant directories explicitly in the environment
 variables.  If for some reason you don't want to mess with the default
 variables @code{TEXINPUTS} and @code{BIBINPUTS}, define your own
-variables and configure @address@hidden to use them instead:
+variables and configure @RefTeX{} to use them instead:
 
 @lisp
 (setq reftex-texpath-environment-variables '("MYTEXINPUTS"))
@@ -2904,7 +3048,7 @@
 @end lisp
 
 @item
-Specify the full search path directly in @address@hidden's variables.
+Specify the full search path directly in @RefTeX{}'s variables.
 
 @lisp
 (setq reftex-texpath-environment-variables
@@ -2914,10 +3058,10 @@
 @end lisp
 
 @item
-Some TeX systems provide stand--alone programs to do the file search just
-like TeX and BibTeX.  E.g. Thomas Esser's @code{teTeX} uses the
+Some @TeX{} systems provide stand-alone programs to do the file search just
+like @TeX{} and @BibTeX{}.  E.g. Thomas Esser's @code{teTeX} uses the
 @code{kpathsearch} library which provides the command @code{kpsewhich}
-to search for files.  @address@hidden can be configured to use this
+to search for files.  @RefTeX{} can be configured to use this
 program.  Note that the exact syntax of the @code{kpsewhich}
 command depends upon the version of that program.
 
@@ -2935,8 +3079,8 @@
 Some people like to use RefTeX with noweb files, which usually have the
 extension @file{.nw}.  In order to deal with such files, the new
 extension must be added to the list of valid extensions in the variable
address@hidden  When working with AUCTeX as major mode,
-the new extension must also be known to AUCTeX via the variable
address@hidden  When working with @AUCTeX{} as major mode,
+the new extension must also be known to @AUCTeX{} via the variable
 @code{TeX-file-extension}.  For example:
 
 @lisp
@@ -2956,15 +3100,15 @@
 books, where some of it still might be useful.}
 
 Implementing the principle of least surprises, the default settings of
address@hidden@TeX{}} ensure a safe ride for beginners and casual users.  
However,
-when using @address@hidden for a large project and/or on a small computer,
address@hidden ensure a safe ride for beginners and casual users.  However,
+when using @RefTeX{} for a large project and/or on a small computer,
 there are ways to improve speed or memory usage.
 
 @itemize @bullet
 @item
 @b{Removing Lookup address@hidden
 @cindex Removing lookup buffers
address@hidden@TeX{}} will load other parts of a multifile document as well as 
BibTeX
address@hidden will load other parts of a multifile document as well as 
@BibTeX{}
 database files for lookup purposes.  These buffers are kept, so that
 subsequent use of the same files is fast.  If you can't afford keeping
 these buffers around, and if you can live with a speed penalty, try
@@ -2978,13 +3122,13 @@
 @b{Partial Document address@hidden
 @cindex Partial documents scans
 @cindex Document scanning, partial
-A @kbd{C-u} prefix on the major @address@hidden commands @code{reftex-label}
+A @kbd{C-u} prefix on the major @RefTeX{} commands @code{reftex-label}
 (@kbd{C-u C-c (}), @code{reftex-reference} (@kbd{C-u C-c )}),
 @code{reftex-citation} (@kbd{C-u C-c [}), @code{reftex-toc} (@kbd{C-u C-c
 =}), and @code{reftex-view-crossref} (@kbd{C-u C-c &}) initiates
 re-parsing of the entire document in order to update the parsing
 information.  For a large document this can be unnecessary, in
-particular if only one file has changed.  @address@hidden can be configured
+particular if only one file has changed.  @RefTeX{} can be configured
 to do partial scans instead of full ones.  @kbd{C-u} re-parsing then
 does apply only to the current buffer and files included from it.
 Likewise, the @kbd{r} key in both the label selection buffer and the
@@ -3004,7 +3148,7 @@
 @cindex Saving parser information
 @cindex Parse information, saving to a file
 @vindex reftex-parse-file-extension
-Even with partial scans enabled, @address@hidden still has to make one full
+Even with partial scans enabled, @RefTeX{} still has to make one full
 scan, when you start working with a document.  To avoid this, parsing
 information can be stored in a file.  The file @file{MASTER.rel} is used
 for storing information about a document with master file
@@ -3022,11 +3166,11 @@
 @b{Identifying label types by address@hidden
 @cindex Parse information, saving to a file
 @vindex reftex-trust-label-prefix
address@hidden@TeX{}} normally parses around each label to check in which
address@hidden normally parses around each label to check in which
 environment this label is located, in order to assign a label type to
 the label.  If your document contains thousands of labels, document
 parsing will take considerable time.  If you have been using label prefixes
-like tab: and fn: consistently, you can tell @address@hidden to get the
+like tab: and fn: consistently, you can tell @RefTeX{} to get the
 label type directly from the prefix, without additional parsing.  This
 will be faster and also allow labels to end up in the correct category
 if for some reason it is not possible to derive the correct type from
@@ -3041,7 +3185,7 @@
 @b{Automatic Document address@hidden
 @cindex Automatic document scans
 @cindex Document scanning, automatic
-At rare occasions, @address@hidden will automatically rescan a part of the
+At rare occasions, @RefTeX{} will automatically rescan a part of the
 document.  If this gets into your way, it can be turned off with
 
 @vindex reftex-allow-automatic-rescan
@@ -3049,7 +3193,7 @@
 (setq reftex-allow-automatic-rescan nil)
 @end lisp
 
address@hidden@TeX{}} will then occasionally annotate new labels in the 
selection
address@hidden will then occasionally annotate new labels in the selection
 buffer, saying that their position in the label list in uncertain.  A
 manual document scan will fix this.
 
@@ -3059,7 +3203,7 @@
 @cindex Selection buffers, multiple
 Normally, the selection buffer @file{*RefTeX Select*} is re-created for
 every selection process.  In documents with very many labels this can
-take several seconds.  @address@hidden provides an option to create a
+take several seconds.  @RefTeX{} provides an option to create a
 separate selection buffer for each label type and to keep this buffer
 from one selection to the next.  These buffers are updated automatically
 only when a new label has been added in the buffers category with
@@ -3089,7 +3233,7 @@
 @need 2000
 @noindent
 @b{As a summary}, here are the settings I recommend for heavy use of
address@hidden@TeX{}} with large documents:
address@hidden with large documents:
 
 @lisp
 @group
@@ -3100,30 +3244,30 @@
 @end lisp
 
 @node AUCTeX, Multifile Documents, Faces, Top
address@hidden address@hidden
address@hidden @AUCTeX{}
 @cindex @code{AUCTeX}, Emacs package
 @cindex Emacs packages, @code{AUCTeX}
 
-AUCTeX is without doubt the best major mode for editing TeX and LaTeX
address@hidden is without doubt the best major mode for editing @TeX{} and 
@LaTeX{}
 files with Emacs (@pxref{Top,AUCTeX,,auctex, The AUCTeX User Manual}).
-If AUCTeX is not part of your Emacs distribution, you can get
+If @AUCTeX{} is not part of your Emacs distribution, you can get
 address@hidden 21.x users may want to install the corresponding
-XEmacs package.} by ftp from the @value{AUCTEXSITE}.
+XEmacs package.} by FTP from the @value{AUCTEXSITE}.
 
 @menu
 * AUCTeX-RefTeX Interface::          How both packages work together
-* Style Files::                      AUCTeX's style files can support RefTeX
+* Style Files::                      @AUCTeX{}'s style files can support RefTeX
 * Bib-Cite::                         Hypertext reading of a document
 @end menu
 
 @node AUCTeX-RefTeX Interface, Style Files, , AUCTeX
address@hidden The address@hidden@address@hidden Interface
address@hidden The @address@hidden Interface
 
address@hidden@TeX{}} contains code to interface with AUCTeX.  When this
address@hidden contains code to interface with @AUCTeX{}.  When this
 interface is turned on, both packages will interact closely.  Instead of
-using @address@hidden's commands directly, you can then also use them
-indirectly as part of the AUCTeX
address@hidden@address@hidden 4.0 and AUCTeX 9.10c will be
+using @RefTeX{}'s commands directly, you can then also use them
+indirectly as part of the @AUCTeX{}
address@hidden@RefTeX{} 4.0 and @AUCTeX{} 9.10c will be
 needed for all of this to work.  Parts of it work also with earlier
 versions.}.  The interface is turned on with
 
@@ -3146,12 +3290,12 @@
 @kindex C-c C-s
 @findex LaTeX-section, @r{AUCTeX}
 @findex TeX-insert-macro, @r{AUCTeX}
address@hidden calls @code{reftex-label} to insert address@hidden
address@hidden@AUCTeX{} calls @code{reftex-label} to insert address@hidden
 When a new section is created with @kbd{C-c C-s}, or a new environment
-is inserted with @kbd{C-c C-e}, AUCTeX normally prompts for a label to
+is inserted with @kbd{C-c C-e}, @AUCTeX{} normally prompts for a label to
 go with it.  With the interface, @code{reftex-label} is called instead.
-For example, if you type @kbd{C-c C-e equation @key{RET}}, AUCTeX and
address@hidden@TeX{}} will insert
+For example, if you type @kbd{C-c C-e equation @key{RET}}, @AUCTeX{} and
address@hidden will insert
 
 @example
 address@hidden@}
@@ -3163,12 +3307,12 @@
 @noindent
 without further prompts.
 
-Similarly, when you type @kbd{C-c C-s section @key{RET}}, @address@hidden
+Similarly, when you type @kbd{C-c C-s section @key{RET}}, @RefTeX{}
 will offer its default label which is derived from the section title.
 
 @item
address@hidden tells @address@hidden about new address@hidden
-When creating a new section with @kbd{C-c C-s}, @address@hidden will not
address@hidden@AUCTeX{} tells @RefTeX{} about new address@hidden
+When creating a new section with @kbd{C-c C-s}, @RefTeX{} will not
 have to rescan the buffer in order to see it.
 
 @item
@@ -3182,44 +3326,44 @@
 @findex TeX-arg-index, @r{AUCTeX function}
 @findex TeX-insert-macro, @r{AUCTeX function}
 @kindex C-c @key{RET}
address@hidden@address@hidden supplies macro address@hidden When you insert a 
macro
-interactively with @kbd{C-c @key{RET}}, AUCTeX normally prompts for
address@hidden@RefTeX{} supplies macro address@hidden When you insert a macro
+interactively with @kbd{C-c @key{RET}}, @AUCTeX{} normally prompts for
 macro arguments.  Internally, it uses the functions
 @code{TeX-arg-label}, @code{TeX-arg-cite}, and @code{TeX-arg-index} to
 prompt for arguments which are labels, citation keys and index entries.
 The interface takes over these address@hidden@code{fset} is used to
-do this, which is not reversible.  However, @address@hidden implements the
+do this, which is not reversible.  However, @RefTeX{} implements the
 old functionality when you later decide to turn off the interface.} and
-supplies the macro arguments with @address@hidden's} mechanisms.  For
-example, when you type @kbd{C-c @key{RET} ref @key{RET}}, @address@hidden
+supplies the macro arguments with @address@hidden's} mechanisms.  For
+example, when you type @kbd{C-c @key{RET} ref @key{RET}}, @RefTeX{}
 will supply its label selection process (@pxref{Referencing
 Labels}).
 
 @item
address@hidden@address@hidden tells AUCTeX about new labels, citation-- and 
index address@hidden
address@hidden@TeX{}} will add all newly created labels to AUCTeX's completion 
list.
address@hidden@RefTeX{} tells @AUCTeX{} about new labels, citation and index 
address@hidden
address@hidden will add all newly created labels to @AUCTeX{}'s completion list.
 @end itemize
 
 @node Style Files, Bib-Cite, AUCTeX-RefTeX Interface, AUCTeX
 @subsection Style Files
 @cindex Style files, AUCTeX
 @findex TeX-add-style-hook, @r{AUCTeX}
-Style files are Emacs Lisp files which are evaluated by AUCTeX in
+Style files are Emacs Lisp files which are evaluated by @AUCTeX{} in
 association with the @code{\documentclass} and @code{\usepackage}
 commands of a document (@pxref{Style Files,,,auctex}). Support for
address@hidden@TeX{}} in such a style file is useful when the LaTeX style
address@hidden in such a style file is useful when the @LaTeX{} style
 defines macros or environments connected with labels, citations, or the
 index.  Many style files (e.g. @file{amsmath.el} or @file{natbib.el})
-distributed with AUCTeX already support @address@hidden in this
+distributed with @AUCTeX{} already support @RefTeX{} in this
 way.
 
-Before calling a @address@hidden function, the style hook should always
+Before calling a @RefTeX{} function, the style hook should always
 test for the availability of the function, so that the style file will
-also work for people who do not use @address@hidden
+also work for people who do not use @RefTeX{}.
 
 Additions made with style files in the way described below remain local
 to the current document.  For example, if one package uses AMSTeX, the
-style file will make @address@hidden switch over to @code{\eqref}, but
+style file will make @RefTeX{} switch over to @code{\eqref}, but
 this will not affect other documents.
 
 @findex reftex-add-label-environments
@@ -3230,7 +3374,7 @@
 alias for compatibility.}  which defines additions to
 @code{reftex-label-alist}.  The argument taken by this function must have
 the same format as @code{reftex-label-alist}.  The @file{amsmath.el}
-style file of AUCTeX for example contains the following:
+style file of @AUCTeX{} for example contains the following:
 
 @lisp
 @group
@@ -3262,7 +3406,7 @@
 Similarly, a style hook may contain a call to
 @code{reftex-set-cite-format} to set the citation format.  The style
 file @file{natbib.el} for the Natbib citation style does switch
address@hidden@TeX{}}'s citation format like this:
address@hidden's citation format like this:
 
 @lisp
 (TeX-add-style-hook "natbib"
@@ -3286,7 +3430,7 @@
 @end lisp
 
 If you have your own package @file{myindex} which defines the
-following macros to be used with the LaTeX @file{index.sty} file
+following macros to be used with the @LaTeX{} @file{index.sty} file
 @example
 address@hidden@address@hidden@address@hidden@}
 address@hidden@address@hidden@address@hidden
@@ -3310,7 +3454,7 @@
 Finally the hook may contain a call to @code{reftex-add-section-levels}
 to define additional section statements.  For example, the FoilTeX class
 has just two headers, @code{\foilhead} and @code{\rotatefoilhead}.  Here
-is a style file @file{foils.el} that will inform @address@hidden about these:
+is a style file @file{foils.el} that will inform @RefTeX{} about these:
 
 @lisp
 (TeX-add-style-hook "foils"
@@ -3326,20 +3470,20 @@
 @cindex Emacs packages, @code{bib-cite}
 
 Once you have written a document with labels, references and citations,
-it can be nice to read it like a hypertext document.  @address@hidden has
+it can be nice to read it like a hypertext document.  @RefTeX{} has
 support for that: @code{reftex-view-crossref} (bound to @kbd{C-c
 &}), @code{reftex-mouse-view-crossref} (bound to @kbd{S-mouse-2}), and
 @code{reftex-search-document}.  A somewhat fancier interface with mouse
 highlighting is provided (among other things) by Peter S. Galbraith's
 @file{bib-cite.el}.  There is some overlap in the functionalities of
-Bib-cite and @address@hidden  Bib-cite.el comes bundled with
-AUCTeX.
+Bib-cite and @RefTeX{}.  Bib-cite.el comes bundled with
address@hidden
 
 Bib-cite version 3.06 and later can be configured so that bib-cite's
-mouse functions use @address@hidden for displaying references and citations.
-This can be useful in particular when working with the LaTeX @code{xr}
+mouse functions use @RefTeX{} for displaying references and citations.
+This can be useful in particular when working with the @LaTeX{} @code{xr}
 package or with an explicit @code{thebibliography} environment (rather
-than BibTeX).  Bib-cite cannot handle those, but @address@hidden does.  To
+than @BibTeX{}).  Bib-cite cannot handle those, but @RefTeX{} does.  To
 make use of this feature, try
 
 @vindex bib-cite-use-reftex-view-crossref
@@ -3354,7 +3498,7 @@
 
 @itemize @bullet
 @item
address@hidden address@hidden
address@hidden@LaTeX{} address@hidden
 @cindex LaTeX commands, not found
 @code{\input}, @code{\include}, and @code{\section} (etc.) statements
 have to be first on a line (except for white space).
@@ -3362,7 +3506,7 @@
 @item
 @b{Commented address@hidden
 @cindex Labels, commented out
address@hidden@TeX{}} sees also labels in regions commented out and will refuse 
to
address@hidden sees also labels in regions commented out and will refuse to
 make duplicates of such labels.  This is considered to be a feature.
 
 @item
@@ -3382,7 +3526,7 @@
 The label environment definitions in @code{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 settings in other
-documents, you should use AUCTeX and set up style files with calls to
+documents, you should use @AUCTeX{} and set up style files with calls to
 @code{reftex-add-label-environments}, @code{reftex-set-cite-format},
 @code{reftex-add-index-macros}, and @code{reftex-add-section-levels}.
 Settings made with these functions remain local to the current
@@ -3398,9 +3542,9 @@
 @cindex Emacs packages, @code{iso-cvt}
 When using packages which make the buffer representation of a file
 different from its disk representation (e.g. x-symbol, isotex,
-iso-cvt) you may find that @address@hidden's parsing information sometimes
+iso-cvt) you may find that @RefTeX{}'s parsing information sometimes
 reflects the disk state of a file.  This happens only in @emph{unvisited}
-parts of a multifile document, because @address@hidden visits these files
+parts of a multifile document, because @RefTeX{} visits these files
 literally for speed reasons.  Then both short context and section
 headings may look different from what you usually see on your screen.
 In rare cases @code{reftex-toc} may have problems to jump to an affected
@@ -3410,7 +3554,7 @@
 @item
 @vindex reftex-keep-temporary-buffers
 @code{(setq reftex-keep-temporary-buffers t)address@hidden
-This implies that @address@hidden will load all parts of a multifile
+This implies that @RefTeX{} will load all parts of a multifile
 document into Emacs (i.e. there won't be any temporary buffers).
 @item
 @vindex reftex-initialize-temporary-buffers
@@ -3437,7 +3581,7 @@
 @end example
 
 @noindent
-We need to trick @address@hidden into swallowing this:
+We need to trick @RefTeX{} into swallowing this:
 
 @lisp
 @group
@@ -3450,7 +3594,7 @@
 
 @noindent
 The first line is just a normal configuration for a macro.  For the
address@hidden environment we actually tell @address@hidden to look for the
address@hidden environment we actually tell @RefTeX{} to look for the
 @emph{macro} @address@hidden@}} and interpret the @emph{first}
 argument (which really is a second argument to the macro @code{\begin})
 as a label of type @code{?p}.  Argument count for this macro starts only
@@ -3462,7 +3606,7 @@
 @cindex Idle timer restart
 @vindex reftex-use-itimer-in-xemacs
 In XEmacs, idle timer restart does not work reliably after fast
-keystrokes.  Therefore @address@hidden currently uses the post command
+keystrokes.  Therefore @RefTeX{} currently uses the post command
 hook to start the timer used for automatic crossref information.  When
 this bug gets fixed, a real idle timer can be requested with
 @lisp
@@ -3475,7 +3619,7 @@
 @cindex Key bindings, problems with Viper mode
 @findex viper-harness-minor-mode
 With @i{Viper} mode prior to Vipers version 3.01, you need to protect
address@hidden@TeX{}}'s keymaps with
address@hidden's keymaps with
 
 @lisp
 (viper-harness-minor-mode "reftex")
@@ -3491,15 +3635,15 @@
 @cindex Acknowledgments
 @cindex Thanks
 @cindex Bug reports
address@hidden @code{http}, @address@hidden home page
address@hidden @code{ftp}, @address@hidden site
address@hidden @code{http}, @RefTeX{} home page
address@hidden @code{ftp}, @RefTeX{} site
 
address@hidden was written by @i{Carsten Dominik}
address@hidden was written by @i{Carsten Dominik}
 @email{dominik@@science.uva.nl}, with contributions by @i{Stephen
-Eglen}.  address@hidden is currently maintained by @value{MAINTAINER}, see
+Eglen}.  @RefTeX{} is currently maintained by @value{MAINTAINER}, see
 the @value{MAINTAINERSITE} for detailed information.
 
-If you have questions about address@hidden, you can send email to the
+If you have questions about @RefTeX{}, you can send email to the
 @value{SUPPORTADDRESS}.  If you want to contribute code or ideas, write
 to the @value{DEVELADDRESS}.  And in the rare case of finding a bug,
 please use @kbd{M-x reftex-report-bug @key{RET}} which will prepare a
@@ -3512,42 +3656,31 @@
 might be able to help: @code{comp.emacs}, @code{gnu.emacs.help},
 @code{comp.emacs.xemacs}, and @code{comp.text.tex}.
 
address@hidden@TeX{}} is bundled and pre-installed with Emacs since version 
20.2.
-It was also bundled and pre-installed with XEmacs 19.16--20.x.  XEmacs
-21.x users want to install the corresponding plugin package which is
-available from the @value{XEMACSFTP}.  See the XEmacs 21.x
-documentation on package installation for details.
-
-Users of earlier Emacs distributions (including Emacs 19) can get a
address@hidden@TeX{}} distribution from the @value{MAINTAINERSITE}.  Note that
-the Emacs 19 version supports many but not all features described in
-this manual.
-
-Thanks to the people on the Net who have used @address@hidden and helped
+Thanks to the people on the Net who have used @RefTeX{} and helped
 developing it with their reports.  In particular thanks to @i{Ralf
 Angeli, Fran Burstall, Alastair Burt, Lars Clausen, Soren Dayton,
 Stephen Eglen, Karl Eichwalder, Erik Frisk, Peter Galbraith, Kai
 Grossjohann, Frank Harrell, Till A. Heilmann, Peter Heslin, Stephan
 Heuel, Alan Ho, Lute Kamstra, Dieter Kraft, David Kastrup, Adrian Lanz,
-Juri Linkov, Rory Molinari, Stefan Monnier, Laurent Mugnier, Dan
-Nicolaescu, Sudeep Kumar Palat, Daniel Polani, Alan Shutko, Robin Socha,
-Richard Stanton, Allan Strand, Jan Vroonhof, Christoph Wedler, Alan
-Williams, Roland Winkler, Hans-Christoph Wirth, Eli Zaretskii}.
-
+Juri Linkov, Wolfgang Mayer, Rory Molinari, Stefan Monnier, Laurent
+Mugnier, Dan Nicolaescu, Sudeep Kumar Palat, Daniel Polani, Alan Shutko,
+Robin Socha, Richard Stanton, Allan Strand, Jan Vroonhof, Christoph
+Wedler, Alan Williams, Roland Winkler, Hans-Christoph Wirth, Eli
+Zaretskii}.
 
 The @code{view-crossref} feature was inspired by @i{Peter Galbraith's}
 @file{bib-cite.el}.
 
 Finally thanks to @i{Uwe Bolick} who first got me interested in
-supporting LaTeX labels and references with an editor (which was
+supporting @LaTeX{} labels and references with an editor (which was
 MicroEmacs at the time).
 
 @node Commands, Options, Imprint, Top
 @chapter Commands
 @cindex Commands, list of
 
-Here is a summary of @address@hidden's commands which can be executed from
-LaTeX files.  Command which are executed from the special buffers are
+Here is a summary of @RefTeX{}'s commands which can be executed from
address@hidden files.  Command which are executed from the special buffers are
 not described here.  All commands are available from the @code{Ref}
 menu.  See @xref{Key Bindings}.
 
@@ -3567,8 +3700,8 @@
 @end deffn
 
 @deffn Command reftex-citation
-Make a citation using BibTeX database files.  After prompting for a regular
-expression, scans the buffers with BibTeX entries (taken from the
+Make a citation using @BibTeX{} database files.  After prompting for a regular
+expression, scans the buffers with @BibTeX{} entries (taken from the
 @code{\bibliography} command or a @code{thebibliography} environment)
 and offers the matching entries for selection.  The selected entry is
 formatted according to @code{reftex-cite-format} and inserted into the
@@ -3588,8 +3721,8 @@
 @deffn Command reftex-index
 Query for an index macro and insert it along with its arguments.  The
 index macros available are those defined in @code{reftex-index-macro} or
-by a call to @code{reftex-add-index-macros}, typically from an AUCTeX
-style file.  @address@hidden provides completion for the index tag and the
+by a call to @code{reftex-add-index-macros}, typically from an @AUCTeX{}
+style file.  @RefTeX{} provides completion for the index tag and the
 index key, and will prompt for other arguments.
 @end deffn
 
@@ -3600,8 +3733,8 @@
 the word near point.  When called with one @kbd{C-u} prefix, let the
 user have a chance to edit the index entry.  When called with 2
 @kbd{C-u} as prefix, also ask for the index macro and other stuff.  When
-called inside TeX math mode as determined by the @file{texmathp.el}
-library which is part of AUCTeX, the string is first processed with the
+called inside @TeX{} math mode as determined by the @file{texmathp.el}
+library which is part of @AUCTeX{}, the string is first processed with the
 @code{reftex-index-math-format}, which see.
 @end deffn
 
@@ -3610,7 +3743,7 @@
 When you are in transient-mark-mode and the region is active, the
 selection will be used - otherwise the word at point.
 You get a chance to edit the entry in the phrases buffer - to save the
-buffer and return to the LaTeX document, finish with @kbd{C-c C-c}.
+buffer and return to the @LaTeX{} document, finish with @kbd{C-c C-c}.
 @end deffn
 
 @deffn Command reftex-index-visit-phrases-buffer
@@ -3644,9 +3777,9 @@
 @end deffn
 
 @deffn Command reftex-view-crossref-from-bibtex
-View location in a LaTeX document which cites the BibTeX entry at point.
-Since BibTeX files can be used by many LaTeX documents, this function
-prompts upon first use for a buffer in @address@hidden mode.  To reset this
+View location in a @LaTeX{} document which cites the @BibTeX{} entry at point.
+Since @BibTeX{} files can be used by many @LaTeX{} documents, this function
+prompts upon first use for a buffer in @RefTeX{} mode.  To reset this
 link to a document, call the function with a prefix arg.  Calling
 this function several times find successive citation locations.
 @end deffn
@@ -3677,7 +3810,7 @@
 
 @deffn Command reftex-isearch-minor-mode
 Toggle a minor mode which enables incremental search to work globally
-on the entire multifile document.  Files will be searched in th
+on the entire multifile document.  Files will be searched in the
 sequence they appear in the document.
 @end deffn
 
@@ -3699,7 +3832,7 @@
 Simple labels are the ones created by RefTeX, consisting only of the
 prefix and a number.  After the command completes, all these labels will
 have sequential numbers throughout the document.  Any references to the
-labels will be changed as well.  For this, @address@hidden looks at the
+labels will be changed as well.  For this, @RefTeX{} looks at the
 arguments of any macros which either start or end with the string
 @samp{ref}.  This command should be used with care, in particular in
 multifile documents.  You should not use it if another document refers
@@ -3711,21 +3844,30 @@
 @end deffn
 
 @deffn Command reftex-create-bibtex-file
-Create a new BibTeX database file with all entries referenced in document.
-The command prompts for a filename and writes the collected entries to
-that file.  Only entries referenced in the current document with
-any @code{\cite}-like macros are used.
-The sequence in the new file is the same as it was in the old database.
address@hidden reftex-create-bibtex-header
address@hidden reftex-create-bibtex-footer
+Create a new @BibTeX{} database file with all entries referenced in
+document.  The command prompts for a filename and writes the collected
+entries to that file.  Only entries referenced in the current document
+with any @code{\cite}-like macros are used.  The sequence in the new
+file is the same as it was in the old database.
+
+Entries referenced from other entries must appear after all referencing
+entries.
+
+You can define strings to be used as header or footer for the created
+files in the variables @code{reftex-create-bibtex-header} or
address@hidden respectively.
 @end deffn
 
 @deffn Command reftex-customize
-Run the customize browser on the @address@hidden group.
+Run the customize browser on the @RefTeX{} group.
 @end deffn
 @deffn Command reftex-show-commentary
 Show the commentary section from @file{reftex.el}.
 @end deffn
 @deffn Command reftex-info
-Run info on the top @address@hidden node.
+Run info on the top @RefTeX{} node.
 @end deffn
 @deffn Command reftex-parse-document
 Parse the entire document in order to update the parsing information.
@@ -3739,7 +3881,7 @@
 @chapter Options, Keymaps, Hooks
 @cindex Options, list of
 
-Here is a complete list of @address@hidden's configuration variables.  All
+Here is a complete list of @RefTeX{}'s configuration variables.  All
 variables have customize support - so if you are not familiar with Emacs
 Lisp (and even if you are) you might find it more comfortable to use
 @code{customize} to look at and change these variables. @kbd{M-x
@@ -3765,14 +3907,14 @@
 @cindex Table of contents, options
 
 @defopt reftex-include-file-commands
-List of LaTeX commands which input another file.
+List of @LaTeX{} commands which input another file.
 The file name is expected after the command, either in braces or separated
 by whitespace.
 @end defopt
 
 @defopt reftex-max-section-depth
 Maximum depth of section levels in document structure.
-Standard LaTeX needs 7, default is 12.
+Standard @LaTeX{} needs 7, default is 12.
 @end defopt
 
 @defopt reftex-section-levels
@@ -3910,7 +4052,7 @@
 @end example
 
 Each list entry describes either an environment carrying a counter for
-use with @code{\label} and @code{\ref}, or a LaTeX macro defining a
+use with @code{\label} and @code{\ref}, or a @LaTeX{} macro defining a
 label as (or inside) one of its arguments.  The elements of each list
 entry are:
 
@@ -3947,7 +4089,7 @@
 label type (like @code{equation} and @code{eqnarray}).  If the type
 indicator is @code{nil} and the macro has a label argument @address@hidden@}},
 the macro defines neutral labels just like @code{\label}.  In this case
-the reminder of this entry is ignored.
+the remainder of this entry is ignored.
 
 @item @var{label-prefix}
 Label prefix string, like @samp{tab:}.  The prefix is a short string
@@ -3968,7 +4110,7 @@
 @samp{eq:intro:}.
 
 @item @var{reference-format}
-Format string for reference insert in buffer.  @samp{%s} will be
+Format string for reference insertion in buffer.  @samp{%s} will be
 replaced by the label.  When the format starts with @samp{~}, this
 @samp{~} will only be inserted when the character before point is
 @emph{not} a whitespace.
@@ -3996,7 +4138,7 @@
 1000 means to get text after the last macro argument.
 @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
+Context is then the text following the end of the match.  E.g. setting
 this to @address@hidden will use the caption in a figure or table
 environment.  @address@hidden@}\|\\\\} works for
 eqnarrays.
@@ -4021,7 +4163,7 @@
 @end example
 @end itemize
 
-Label context is used in two ways by @address@hidden: For display in the label
+Label context is used in two ways by @RefTeX{}: For display in the label
 menu, and to derive a label string.  If you want to use a different
 method for each of these, specify them as a dotted pair.
 E.g. @code{(nil . t)} uses the text after the label (@code{nil}) for
@@ -4033,7 +4175,7 @@
 the word before point is equal to one of these words when calling
 @code{reftex-reference}, the label list offered will be automatically
 restricted to labels of the correct type.  If the first element of this
-word--list is the symbol `regexp', the strings are interpreted as regular
+word list is the symbol `regexp', the strings are interpreted as regular
 expressions.
 
 @item @var{toc-level}
@@ -4047,7 +4189,7 @@
 @end table
 
 If the type indicator characters of two or more entries are the same,
address@hidden@TeX{}} will use
address@hidden will use
 @itemize @minus
 @item
 the first address@hidden format and prefix
@@ -4081,7 +4223,7 @@
 @defopt reftex-trust-label-prefix
 address@hidden means, trust the label prefix when determining label type.
 It is customary to use special label prefixes to distinguish different label
-types.  The label prefixes have no syntactic meaning in LaTeX (unless
+types.  The label prefixes have no syntactic meaning in @LaTeX{} (unless
 special packages like fancyref) are being used.  RefTeX can and by
 default does parse around each label to detect the correct label type,
 but this process can be slow when a document contains thousands of
@@ -4122,7 +4264,7 @@
 (@var{derive} @var{prompt})
 @end example
 
-If @var{derive} is @code{t}, @address@hidden will try to derive a sensible
+If @var{derive} is @code{t}, @RefTeX{} will try to derive a sensible
 label from context.  A section label for example will be derived from
 the section heading.  The conversion of the context to a valid label is
 governed by the specifications given in
@@ -4171,7 +4313,7 @@
 
 @deffn Hook reftex-string-to-label-function
 Function to turn an arbitrary string into a valid label.
address@hidden@TeX{}}'s default function uses the variable
address@hidden's default function uses the variable
 @code{reftex-derive-label-parameters}.
 @end deffn
 
@@ -4278,35 +4420,38 @@
 @code{reftex-reference}.
 @end defopt
 
address@hidden reftex-vref-is-default
address@hidden means, the varioref macro @code{\vref} is used as
-default.  In the selection buffer, the @kbd{v} key toggles the reference
-macro between @code{\ref} and @code{\vref}.  The value of this variable
-determines the default which is active when entering the selection
-process.  Instead of @code{nil} or @code{t}, this may also be a string
-of type letters indicating the label types for which it should be
-true.
address@hidden defopt
-
address@hidden reftex-fref-is-default
address@hidden means, the fancyref macro @code{\fref} is used as
-default.  In the selection buffer, the @kbd{V} key toggles the reference
-macro between @code{\ref}, @code{\fref} and @code{\Fref}.  The value of
-this variable determines the default which is active when entering the
-selection process.  Instead of @code{nil} or @code{t}, this may also be
-a string of type letters indicating the label types for which it should
-be true.
address@hidden reftex-ref-style-alist
+Alist of reference styles.  Each element is a list of the style name,
+the name of the @LaTeX{} package associated with the style or @code{t}
+for any package, and an alist of macros where the first entry of each
+item is the reference macro and the second a key for selecting the macro
+when the macro type is being prompted for.  (See also
address@hidden)  The keys, represented as characters,
+have to be unique.
address@hidden defopt
+
address@hidden reftex-ref-style-default-list
+List of reference styles to be activated by default.  The order is
+significant and controls the order in which macros can be cycled in the
+buffer for selecting a label.  The entries in the list have to match the
+respective reference style names used in the variable
address@hidden
address@hidden defopt
+
address@hidden reftex-ref-macro-prompt
+Controls if @code{reftex-reference} prompts for the reference macro.
 @end defopt
 
 @deffn Hook reftex-format-ref-function
 If address@hidden, should be a function which produces the string to
 insert as a reference.  Note that the insertion format can also be
 changed with @code{reftex-label-alist}.  This hook also is used by the
-special commands to insert @code{\vref} and @code{\fref} references, so
-even if you set this, your setting will be ignored by the special
-commands.  The function will be called with two arguments, the
address@hidden and the @var{default-format} (usually @address@hidden@}}).
-It should return the string to insert into the buffer.
+special commands to insert e.g. @code{\vref} and @code{\fref}
+references, so even if you set this, your setting will be ignored by the
+special commands.  The function will be called with three arguments, the
address@hidden, the @var{default format} which normally is
address@hidden@address@hidden and the @var{reference style}.  The function 
should
+return the string to insert into the buffer.
 @end deffn
 
 @defopt reftex-level-indent
@@ -4315,11 +4460,11 @@
 
 @defopt reftex-guess-label-type
 address@hidden means, @code{reftex-reference} will try to guess the
-label type.  To do that, @address@hidden will look at the word before the
+label type.  To do that, @RefTeX{} will look at the word before the
 cursor and compare it with the magic words given in
address@hidden  When it finds a match, @address@hidden will
address@hidden  When it finds a match, @RefTeX{} will
 immediately offer the correct label menu - otherwise it will prompt you
-for a label type.  If you set this variable to @code{nil}, @address@hidden
+for a label type.  If you set this variable to @code{nil}, @RefTeX{}
 will always prompt for a label type.
 @end defopt
 
@@ -4351,7 +4496,7 @@
 @cindex Creating citations, options
 
 @defopt reftex-bibliography-commands
-LaTeX commands which specify the BibTeX databases to use with the document.
address@hidden commands which specify the @BibTeX{} databases to use with the 
document.
 @end defopt
 
 @defopt reftex-bibfile-ignore-regexps
@@ -4359,20 +4504,20 @@
 @address@hidden@}}.  File names matched by any of these regexps
 will not be parsed.  Intended for files which contain only
 @code{@@string} macro definitions and the like, which are ignored by
address@hidden@TeX{}} anyway.
address@hidden anyway.
 @end defopt
 
 @defopt reftex-default-bibliography
-List of BibTeX database files 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 with neither
 a @address@hidden@}} statement nor a @code{thebibliography}
-environment, @address@hidden will scan these files instead.  Intended for
-using @code{reftex-citation} in non-LaTeX files.  The files will be
+environment, @RefTeX{} will scan these files instead.  Intended for
+using @code{reftex-citation} in address@hidden files.  The files will be
 searched along the BIBINPUTS or TEXBIB path.
 @end defopt
 
 @defopt reftex-sort-bibtex-matches
-Sorting of the entries found in BibTeX databases by reftex-citation.
+Sorting of the entries found in @BibTeX{} databases by reftex-citation.
 Possible values:
 @example
 nil          @r{Do not sort entries.}
@@ -4393,7 +4538,7 @@
 
 @table @code
 @item %l
-The BibTeX label of the citation.
+The @BibTeX{} label of the citation.
 @item %a
 List of author names, see also @code{reftex-cite-punctuation}.
 @item %2a
@@ -4405,7 +4550,7 @@
 @samp{%E} work a well).
 @end table
 
-It is also possible to access all other BibTeX database fields:
+It is also possible to access all other @BibTeX{} database fields:
 
 @example
 %b booktitle     %c chapter        %d edition    %h howpublished
@@ -4426,7 +4571,7 @@
 A pair of square brackets indicates an optional argument, and RefTeX
 will prompt for the values of these arguments.
 
-Beware that all this only works with BibTeX database files.  When
+Beware that all this only works with @BibTeX{} database files.  When
 citations are made from the @code{\bibitems} in an explicit
 @code{thebibliography} environment, only @samp{%l} is available.
 
@@ -4505,6 +4650,24 @@
 (@pxref{Creating Citations}).
 @end deffn
 
address@hidden reftex-cite-key-separator
+String used to separate several keys in a single @samp{\\cite} macro.
+Per default this is @samp{","} but if you often have to deal with a lot
+of entries and need to break the macro across several lines you might
+want to change it to @samp{", "}.
address@hidden defopt
+
address@hidden reftex-create-bibtex-header
+Header to insert in BibTeX files generated by
address@hidden
address@hidden defopt
+
address@hidden reftex-create-bibtex-footer
+Footer to insert in BibTeX files generated by
address@hidden
address@hidden defopt
+
+
 @node Options (Index Support), Options (Viewing Cross-References), Options 
(Creating Citations),  Options
 @section Index Support
 @cindex Options, Index support
@@ -4553,7 +4716,7 @@
 @var{exclude} can be a function.  If this function exists and returns a
 address@hidden value, the index entry at point is ignored.  This was
 implemented to support the (deprecated) @samp{^} and @samp{_} shortcuts
-in the LaTeX2e @code{index} package.
+in the @LaTeX{}2e @code{index} package.
 
 @var{repeat}, if address@hidden, means the index macro does not typeset
 the entry in the text, so that the text has to be repeated outside the
@@ -4564,14 +4727,14 @@
 the variable @code{reftex-index-macros-builtin} to specify the main
 indexing package you are using.  Valid values are currently
 @example
-default         @r{The LaTeX default - unnecessary to specify this one}
+default         @r{The @LaTeX{} default - unnecessary to specify this one}
 multind         @r{The multind.sty package}
 index           @r{The index.sty package}
 index-shortcut  @r{The index.sty packages with the ^ and _ shortcuts.}
                 @r{Should not be used - only for old documents}
 @end example
-Note that AUCTeX sets these things internally for @address@hidden as well,
-so with a sufficiently new version of AUCTeX, you should not set the
+Note that @AUCTeX{} sets these things internally for @RefTeX{} as well,
+so with a sufficiently new version of @AUCTeX{}, you should not set the
 package here.
 @end defopt
 
@@ -4584,7 +4747,7 @@
 
 @var{default-tag} is the tag to be used if the macro requires a
 @var{tag} argument.  When this is @code{nil} and a @var{tag} is needed,
address@hidden@TeX{}} will ask for it.  When this is the empty string and the
address@hidden will ask for it.  When this is the empty string and the
 TAG argument of the index macro is optional, the TAG argument will be
 omitted.
 @end defopt
@@ -4604,11 +4767,11 @@
 
 @defopt reftex-index-math-format
 Format of index entries when copied from inside math mode.  When
address@hidden is executed inside TeX math mode,
address@hidden is executed inside @TeX{} math mode,
 the index key copied from the buffer is processed with this format
 string through the @code{format} function.  This can be used to add the
 math delimiters (e.g. @samp{$}) to the string.  Requires the
address@hidden library which is part of AUCTeX.
address@hidden library which is part of @AUCTeX{}.
 @end defopt
 
 @defopt reftex-index-phrase-file-extension
@@ -4660,7 +4823,7 @@
 phrases may match at places where that phrase was already indexed.  In
 particular when indexing an already processed document again, this
 will even be the norm.  When this variable is address@hidden,
address@hidden@TeX{}} checks if the match is an index macro argument, or if an
address@hidden checks if the match is an index macro argument, or if an
 index macro is directly before or after the phrase.  If that is the
 case, that match will be ignored.
 @end defopt
@@ -4701,7 +4864,7 @@
 The letters which denote sections in the index.  Usually these are all
 capital letters.  Don't use any downcase letters.  Order is not
 significant, the index will be sorted by whatever the sort function
-thinks is correct.  In addition to these letters, @address@hidden will
+thinks is correct.  In addition to these letters, @RefTeX{} will
 create a group @samp{!} which contains all entries sorted below the
 lowest specified letter.  In the @file{*Index*} buffer, pressing any of
 these capital letters or @kbd{!} will jump to that section.
@@ -4773,7 +4936,7 @@
 address@hidden means, automatic citation display will revisit files if
 necessary.  When nil, citation display in echo area will only be active
 for cached echo strings (see @code{reftex-cache-cite-echo}), or for
-BibTeX database files which are already visited by a live associated
address@hidden database files which are already visited by a live associated
 buffers.
 @end defopt
 
@@ -4790,7 +4953,7 @@
 @cindex Finding files, options
 
 @defopt reftex-texpath-environment-variables
-List of specifications how to retrieve the search path for TeX files.
+List of specifications how to retrieve the search path for @TeX{} files.
 Several entries are possible.
 @itemize @minus
 @item
@@ -4809,7 +4972,7 @@
 @end defopt
 
 @defopt reftex-bibpath-environment-variables
-List of specifications how to retrieve the search path for BibTeX
+List of specifications how to retrieve the search path for @BibTeX{}
 files.  Several entries are possible.
 @itemize @minus
 @item
@@ -4847,14 +5010,14 @@
 option is @code{nil}, the subdirectories of @samp{./} are searched
 before @samp{/tex/}.  This is mainly for speed - most of the time the
 recursive path is for the system files and not for the user files.  Set
-this to @code{nil} if the default makes @address@hidden finding files with
+this to @code{nil} if the default makes @RefTeX{} finding files with
 equal names in wrong sequence.
 @end defopt
 
 @defopt reftex-use-external-file-finders
 address@hidden means, use external programs to find files.  Normally,
address@hidden@TeX{}} searches the paths given in the environment variables
address@hidden and @code{BIBINPUTS} to find TeX files and BibTeX
address@hidden searches the paths given in the environment variables
address@hidden and @code{BIBINPUTS} to find @TeX{} files and @BibTeX{}
 database files.  With this option turned on, it calls an external
 program specified in the option @code{reftex-external-file-finders}
 instead.  As a side effect, the variables
@@ -4881,14 +5044,14 @@
 
 @defopt reftex-keep-temporary-buffers
 address@hidden means, keep buffers created for parsing and lookup.
address@hidden@TeX{}} sometimes needs to visit files related to the current
address@hidden sometimes needs to visit files related to the current
 document.  We distinguish files visited for
 @table @asis
 @item PARSING
 Parts of a multifile document loaded when (re)-parsing the
 document.
 @item LOOKUP
-BibTeX database files and TeX files loaded to find a reference, to
address@hidden database files and @TeX{} files loaded to find a reference, to
 display label context, etc.
 @end table
 The created buffers can be kept for later use, or be thrown away
@@ -4912,7 +5075,7 @@
 
 @defopt reftex-initialize-temporary-buffers
 address@hidden means do initializations even when visiting file
-temporarily.  When @code{nil}, @address@hidden may turn off find-file hooks and
+temporarily.  When @code{nil}, @RefTeX{} may turn off find-file hooks and
 other stuff to briefly visit a file. When @code{t}, the full default
 initializations are done (@code{find-file-hook} etc.).  Instead of
 @code{t} or @code{nil}, this variable may also be a list of hook
@@ -4923,12 +5086,12 @@
 List of regular expressions to exclude certain input files from parsing.
 If the name of a file included via @code{\include} or @code{\input} is
 matched by any of the regular expressions in this list, that file is not
-parsed by @address@hidden
+parsed by @RefTeX{}.
 @end defopt
 
 @defopt reftex-enable-partial-scans
 address@hidden means, re-parse only 1 file when asked to re-parse.
-Re-parsing is normally requested with a @kbd{C-u} prefix to many 
@address@hidden
+Re-parsing is normally requested with a @kbd{C-u} prefix to many @RefTeX{}
 commands, or with the @kbd{r} key in menus.  When this option is
 @code{t} in a multifile document, we will only parse the current buffer,
 or the file associated with the label or section heading near point in a
@@ -4958,7 +5121,7 @@
 @end defopt
 
 @defopt reftex-allow-automatic-rescan
address@hidden means, @address@hidden may rescan the document when this seems
address@hidden means, @RefTeX{} may rescan the document when this seems
 necessary.  Applies (currently) only in rare cases, when a new label
 cannot be placed with certainty into the internal label list.
 @end defopt
@@ -5092,8 +5255,8 @@
 @end defopt
 
 @defopt reftex-plug-into-AUCTeX
-Plug-in flags for AUCTeX interface.  This variable is a list of
-5 boolean flags.  When a flag is address@hidden, @address@hidden
+Plug-in flags for @AUCTeX{} interface.  This variable is a list of
+5 boolean flags.  When a flag is address@hidden, @RefTeX{}
 will
 
 @example
@@ -5110,7 +5273,7 @@
 sections with @kbd{C-c C-s} and environments with @kbd{C-c address@hidden
 Supplying macro arguments applies when you insert such a macro
 interactively with @kbd{C-c @address@hidden
-See the AUCTeX documentation for more information.
+See the @AUCTeX{} documentation for more information.
 @end defopt
 
 @defopt reftex-revisit-to-follow
@@ -5130,10 +5293,10 @@
 @section Keymaps and Hooks
 @cindex Keymaps
 
address@hidden@TeX{}} has the usual general keymap and load-- and mode-hook.
address@hidden has the usual general keymap, load hook and mode hook.
 
 @deffn Keymap reftex-mode-map
-The keymap for @address@hidden mode.
+The keymap for @RefTeX{} mode.
 @end deffn
 
 @deffn {Normal Hook} reftex-load-hook
@@ -5141,20 +5304,54 @@
 @end deffn
 
 @deffn {Normal Hook} reftex-mode-hook
-Normal hook which is being run when turning on @address@hidden mode.
+Normal hook which is being run when turning on @RefTeX{} mode.
 @end deffn
 
-Furthermore, the 4 modes used for referencing labels, creating
+Furthermore, the four modes used for referencing labels, creating
 citations, the table of contents buffer and the phrases buffer have
 their own keymaps and mode hooks.  See the respective sections.  There
 are many more hooks which are described in the relevant sections about
-options for a specific part of @address@hidden
+options for a specific part of @RefTeX{}.
 
 @node Changes, GNU Free Documentation License, Keymaps and Hooks, Top
 @chapter Changes
 @cindex Changes
 
-Here is a list of recent changes to @address@hidden
+Here is a list of recent changes to @RefTeX{}.
+
address@hidden @b{Version 4.33}
+
address@hidden @bullet
address@hidden
+Update to GPLv3.
address@hidden
+Parse files are created in a way that does not interfere with recentf
+mode.
address@hidden itemize
+
address@hidden @b{Version 4.32}
+
address@hidden @bullet
address@hidden
+First release by @AUCTeX{} project.
address@hidden
+Installation routine rewritten after structure of source package
+changed.
address@hidden
+Activation of @RefTeX{} changed, so make sure you read the installation
+instructions and remove obsolete cruft related to @RefTeX{} from your
+init file.
address@hidden
+Fixed bug where point would end up in the wrong buffer when jumping
+between several @LaTeX{} and phrases buffers.
address@hidden
+Fixed bug where @BibTeX{} keys with hyphens were parsed incorrectly.
address@hidden
+Some performance improvements.
address@hidden
+The separator used between multiple citations in a \cite macro can now
+be changed by customizing the variable @code{reftex-cite-key-separator}.
address@hidden itemize
 
 @noindent @b{Version 4.28}
 @itemize @bullet
@@ -5504,7 +5701,7 @@
 @item
 Expansion of recursive tex and bib path rewritten.
 @item
-Fixed problem where @address@hidden did not scan unsaved buffers.
+Fixed problem where @RefTeX{} did not scan unsaved buffers.
 @item
 Fixed bug with section numbering after *-red sections.
 @end itemize
@@ -5571,15 +5768,15 @@
 AUCTeX interface updates:
 @itemize @minus
 @item
-AUCTeX 9.9c and later notifies @address@hidden about new sections.
+AUCTeX 9.9c and later notifies @RefTeX{} about new sections.
 @item
address@hidden@TeX{}} notifies AUCTeX about new labels.
address@hidden notifies AUCTeX about new labels.
 @item
 @code{TeX-arg-ref} no longer used (introduction was unnecessary).
 @item
 @code{reftex-arg-label} and @code{reftex-arg-cite} fixed up.
 @item
-Settings added to @address@hidden via style files remain local.
+Settings added to @RefTeX{} via style files remain local.
 @end itemize
 @item
 Fixed bug with @code{reftex-citation} in non-latex buffers.
@@ -5601,7 +5798,7 @@
 @noindent @b{Version 3.21}
 @itemize @bullet
 @item
-New options for all faces used by @address@hidden They're in the
+New options for all faces used by @RefTeX{}. They're in the
 customization group @code{reftex-fontification-configurations}.
 @end itemize
 
@@ -5627,7 +5824,7 @@
 @item
 Follow-mode is now only used after point motion.
 @item
address@hidden@TeX{}} now finally does not fontify temporary files anymore.
address@hidden now finally does not fontify temporary files anymore.
 @end itemize
 
 @noindent @b{Version 3.17}
@@ -5740,7 +5937,7 @@
 @noindent @b{Version 3.00}
 @itemize @bullet
 @item
address@hidden@TeX{}} should work better for very large projects:
address@hidden should work better for very large projects:
 @item
 The new parser works without creating a master buffer.
 @item
@@ -5748,19 +5945,19 @@
 @item
 Information from the parser can be stored in a file.
 @item
address@hidden@TeX{}} can deal with macros having a naked label as an argument.
address@hidden can deal with macros having a naked label as an argument.
 @item
 Macros may have white space and newlines between arguments.
 @item
 Multiple identical section headings no longer confuse
 @code{reftex-toc}.
 @item
address@hidden@TeX{}} should work correctly in combination with buffer-altering
address@hidden should work correctly in combination with buffer-altering
 packages like outline, folding, x-symbol, iso-cvt, isotex, etc.
 @item
 All labeled environments discussed in @emph{The LaTeX Companion} by
 Goossens, Mittelbach & Samarin, Addison-Wesley 1994) are part of
address@hidden@TeX{}}'s defaults.
address@hidden's defaults.
 @end itemize
 
 @noindent @b{Version 2.17}
@@ -5858,7 +6055,7 @@
 @noindent @b{Version 1.07}
 @itemize @bullet
 @item
address@hidden@TeX{}} gets its own menu.
address@hidden gets its own menu.
 @end itemize
 
 @noindent @b{Version 1.05}

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-09-30 20:16:12 +0000
+++ b/lisp/ChangeLog    2012-09-30 20:30:13 +0000
@@ -1,3 +1,146 @@
+2012-09-30  Ralf Angeli  <address@hidden>
+
+       Merge from standalone RefTeX repository.
+
+       The following ChangeLog entries are shortened versions of the
+       original ones with file paths adapted.  A not so strongly edited
+       version of the original ChangeLog can be found in the commit log.
+
+       * textmodes/reftex-auc.el: Move `provide' call to bottom of file.
+       (reftex-arg-cite): Use `reftex-cite-key-separator'.  Correctly
+       handle new value type returned by `reftex-citation'.
+
+       * textmodes/reftex-cite.el (reftex-create-bibtex-file): Make sure
+       that entries with whitespace at various places are found.  Doc
+       fix. Include entries that are cross-referenced from cited entries.
+       Include @String definitions in the resulting bib file.  Add header
+       and footer defined in `reftex-create-bibtex-header' and
+       `reftex-create-bibtex-footer'.
+       (reftex-do-citation): Make it possible again to insert
+       non-existent entries.  Save match data when asking for optional
+       arguments. Return all keys, not just the first one.
+       (reftex-all-used-citation-keys): Fix regexp to correctly extract
+       all citations in the same line.
+       (reftex-parse-bibtex-entry): Accept additional optional argument
+       `raw' and keep quotes or braces if it is non-nil.  Match fields
+       containing hyphens besides word constituents.
+       (reftex-get-string-refs): New function.
+       (reftex-extract-bib-entries): Check if BibTeX file changed on disk
+       and ask if it should be reread in case it did.
+       (reftex-pop-to-bibtex-entry)
+       (reftex-extract-bib-entries-from-thebibliography): Match \bibitem
+       entries with spaces or tabs in front of arguments.
+       (reftex-pop-to-bibtex-entry, reftex-extract-bib-entries)
+       (reftex-parse-bibtex-entry, reftex-create-bibtex-file): Match
+       entries containing numbers and symbol constituents.
+       (reftex-do-citation, reftex-figure-out-cite-format): Use
+       `reftex-cite-key-separator'.
+
+       * textmodes/reftex-dcr.el: Move provide statement to end of file.
+       (reftex-mouse-view-crossref): Explain why point is set.
+
+       * textmodes/reftex-global.el: Whitespace changes.
+
+       * textmodes/reftex-index.el: Move provide statement to end of
+       file.
+       (reftex-index-selection-or-word): Use `reftex-region-active-p'.
+       (reftex-index-visit-phrases-buffer): Set marker when visiting
+       buffer.  This allows for returning from the phrases file to the
+       file one was just editing instead of the file where the last
+       phrases was added from.
+       (reftex-index-phrases-syntax-table): New variable.  Give ?\"
+       punctuation syntax as it usually is not used as string quote in
+       TeX-related modes and may occur unmatched.  The change also
+       prevents fontification of quoted content.
+       (reftex-index-phrases-mode): Use it.
+
+       * textmodes/reftex-parse.el (reftex-parse-from-file): Move
+       backward one char if a `\' was matched after a section macro.
+       (reftex-parse-from-file): Use beginning of match instead of end as
+       bound.
+
+       * textmodes/reftex-ref.el: Adapt creation of
+       `reftex-<package>-<macro>' functions to new structure of
+       `reftex-ref-style-alist'.
+       (reftex-reference): Use `reftex-ref-style-list' function.  Adapt
+       to new structure of `reftex-ref-style-alist'.  Prompt for a
+       reference macro if `reftex-ref-macro-prompt' is non-nil.
+       (reftex-reference): Pass refstyle to `reftex-format-special'.
+       Determine reference macro by looking at
+       `reftex-ref-style-default-list' and `reftex-ref-style-alist'.  Use
+       only one special format function.
+       (reftex-varioref-vref, reftex-fancyref-fref)
+       (reftex-fancyref-Fref): Remove definitions.  The functions are now
+       generated from `reftex-ref-style-alist'.
+       (reftex-format-vref, reftex-format-Fref, reftex-format-fref):
+       Remove.
+       (reftex-format-special): New function.
+
+       * textmodes/reftex-sel.el
+       (reftex-select-cycle-ref-style-internal): Adapt to new structure
+       of `reftex-ref-style-alist'. Remove code for testing macro type.
+       (reftex-select-toggle-varioref)
+       (reftex-select-toggle-fancyref): Remove.
+       (reftex-select-cycle-ref-style-internal)
+       (reftex-select-cycle-ref-style-forward)
+       (reftex-select-cycle-ref-style-backward): New functions.
+       (reftex-select-label-map): Use `v' and `V' for general cycling
+       through reference styles.  Add `p' for switching between number
+       and page reference types.
+
+       * textmodes/reftex-toc.el (reftex-re-enlarge): Call
+       `enlarge-window' only if there is something to do because in Emacs
+       the horizontal version throws an error even if the parameter is 0.
+
+       * textmodes/reftex-vars.el (reftex-label-alist): Doc fix.
+       (reftex-plug-into-AUCTeX): Doc fix.
+       (reftex-vref-is-default, reftex-fref-is-default): Adapt doc
+       string.  Adapt to new name.
+       (reftex-ref-style-alist): Change structure so that it is not
+       possible to use multiple different package names within a style.
+       Remove the symbols for symbols for macro type distinction.  Add
+       characters for macro selection.
+       (reftex-ref-macro-prompt, reftex-create-bibtex-header)
+       (reftex-create-bibtex-footer): New variables.
+       (reftex-format-ref-function): Mention third argument of special
+       format function.
+       (reftex-ref-style-alist, reftex-ref-style-default-list): New
+       variables.
+       (reftex-vref-is-default, reftex-fref-is-default): Adapt doc string
+       to new implementation.  Mark as obsolete.  Add compatibility code
+       for honoring the variable values in case they are set.
+       (reftex-cite-format-builtin, reftex-bibliography-commands): Add
+       support for ConTeXt.
+       (reftex-format-ref-function, reftex-format-cite-function): Fix
+       custom type.
+       (reftex-cite-key-separator): New variable.
+
+       * textmodes/reftex.el (reftex-syntax-table-for-bib)
+       (reftex-mode): Do not derive `reftex-syntax-table-for-bib' from
+       `reftex-syntax-table' because parens have to retain their paren
+       syntax in order for parsing of BibTeX entries like @book(...) to
+       work.
+       (reftex-in-comment): Do not error out if `comment-start-skip' is
+       not set.  Deal correctly with escaped comment characters.
+       (reftex-tie-multifile-symbols): Add doc string.  Initialize
+       `reftex-ref-style-list'.
+       (reftex-untie-multifile-symbols): Add doc string.
+       (reftex-add-index-macros): Doc fix.
+       (reftex-ref-style-activate, reftex-ref-style-toggle)
+       (reftex-ref-style-list): New functions.
+       (reftex-mode-menu): Use them.  Adapt to new structure of
+       `reftex-ref-style-alist'.
+       (reftex-select-with-char): Kill the RefTeX Select buffer when
+       done.
+       (reftex-remove-if): New function.
+       (reftex-erase-all-selection-and-index-buffers)
+       (reftex-mode-menu): Reference styles are now computed from
+       `reftex-ref-style-alist'.  Fix typo.
+       (reftex-report-bug): New function.
+       (reftex-uniquify, reftex-uniquify-by-car): Replace O(n^2)
+       algorithms with O(n log n).  Introduce optional argument SORT (not
+       yet used).
+
 2012-09-30  Fabián Ezequiel Gallina  <address@hidden>
 
        Enhancements for triple-quote string syntax.

=== modified file 'lisp/textmodes/reftex-auc.el'
--- a/lisp/textmodes/reftex-auc.el      2012-01-19 07:21:25 +0000
+++ b/lisp/textmodes/reftex-auc.el      2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,21 +25,21 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-auc)
+
 (require 'reftex)
-;;;
 
-(declare-function TeX-argument-insert "ext:tex" (name optional &optional 
prefix))
-(declare-function TeX-argument-prompt "ext:tex" (optional prompt default 
&optional complete))
-(declare-function multi-prompt "ext:multi-prompt" 
-                 (separator
-                  unique prompt table
-                  &optional mp-predicate require-match initial history))
+(declare-function TeX-argument-prompt "ext:tex"
+                 (optional prompt default &optional complete))
+(declare-function TeX-argument-insert "ext:tex"
+                 (name optional &optional prefix))
+(declare-function LaTeX-add-labels "ext:tex" (&rest entries) t)
 (declare-function LaTeX-add-index-entries "ext:tex" (&rest entries) t)
-(declare-function LaTeX-add-labels "ext:tex" (&rest entries) t)
 (declare-function LaTeX-bibitem-list "ext:tex" () t)
 (declare-function LaTeX-index-entry-list "ext:tex" () t)
 (declare-function LaTeX-label-list "ext:tex" () t)
+(declare-function multi-prompt "ext:multi-prompt"
+                 (separator unique prompt table &optional
+                            mp-predicate require-match initial history))
 
 (defun reftex-plug-flag (which)
   ;; Tell if a certain flag is set in reftex-plug-into-AUCTeX
@@ -76,14 +74,15 @@
   (let (items)
     (cond
      ((and (not definition) (reftex-plug-flag 3))
-      (setq items (list (or (reftex-citation t) ""))))
+      (setq items (or (reftex-citation t) (list ""))))
      (t
       (setq prompt (concat (if optional "(Optional) " "")
                           (if prompt prompt "Add key")
                           " (default none): "))
       (setq items (multi-prompt "," t prompt (LaTeX-bibitem-list)))))
     (apply 'LaTeX-add-bibitems items)
-    (TeX-argument-insert (mapconcat 'identity items ",") optional)))
+    (TeX-argument-insert (mapconcat 'identity items reftex-cite-key-separator)
+                        optional)))
 
 
 (defun reftex-arg-index-tag (optional &optional prompt &rest args)
@@ -223,4 +222,6 @@
 (defun reftex-notice-new-section ()
   (reftex-notice-new 1 'force))
 
+(provide 'reftex-auc)
+
 ;;; reftex-auc.el ends here

=== modified file 'lisp/textmodes/reftex-cite.el'
--- a/lisp/textmodes/reftex-cite.el     2012-09-24 11:39:33 +0000
+++ b/lisp/textmodes/reftex-cite.el     2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -129,9 +127,10 @@
 
   (let* ((re
           (if item
-              (concat "\\\\bibitem\\(\\[[^]]*\\]\\)?{" (regexp-quote key) "}")
-            (concat "@[a-zA-Z]+[ \t\n\r]*[{(][ \t\n\r]*" (regexp-quote key)
-                    "[, \t\r\n}]")))
+              (concat "\\\\bibitem[ \t]*\\(\\[[^]]*\\]\\)?[ \t]*{"
+                     (regexp-quote key) "}")
+            (concat "@\\(?:\\w\\|\\s_\\)+[ \t\n\r]*[{(][ \t\n\r]*"
+                   (regexp-quote key) "[, \t\r\n}]")))
          (buffer-conf (current-buffer))
          file buf pos oldpos)
 
@@ -229,7 +228,13 @@
                            buffer (not reftex-keep-temporary-buffers))))
           (if (not buffer1)
               (message "No such BibTeX file %s (ignored)" buffer)
-            (message "Scanning bibliography database %s" buffer1))
+            (message "Scanning bibliography database %s" buffer1)
+           (unless (verify-visited-file-modtime buffer1)
+                (when (y-or-n-p
+                       (format "File %s changed on disk.  Reread from disk? "
+                               (file-name-nondirectory
+                                (buffer-file-name buffer1))))
+                  (with-current-buffer buffer1 (revert-buffer t t)))))
 
           (set-buffer buffer1)
           (reftex-with-special-syntax-for-bib
@@ -238,8 +243,8 @@
              (while (re-search-forward first-re nil t)
                (catch 'search-again
                  (setq key-point (point))
-                 (unless (re-search-backward
-                          "\\(\\`\\|[\n\r]\\)[ address@hidden([a-zA-Z]+\\)[ 
\t\n\r]*[{(]" nil t)
+                 (unless (re-search-backward "\\(\\`\\|[\n\r]\\)[ \t]*\
address@hidden(\\(?:\\w\\|\\s_\\)+\\)[ \t\n\r]*[{(]" nil t)
                    (throw 'search-again nil))
                  (setq start-point (point))
                  (goto-char (match-end 0))
@@ -451,7 +456,8 @@
       (setq names (replace-match " " nil t names)))
     (split-string names "\n")))
 
-(defun reftex-parse-bibtex-entry (entry &optional from to)
+(defun reftex-parse-bibtex-entry (entry &optional from to raw)
+  ; if RAW is non-nil, keep double quotes/curly braces delimiting fields
   (let (alist key start field)
     (save-excursion
       (save-restriction
@@ -463,41 +469,56 @@
               (erase-buffer)
               (insert entry))
           (widen)
-          (narrow-to-region from to))
+          (if (and from to) (narrow-to-region from to)))
         (goto-char (point-min))
 
-        (if (re-search-forward
-             "@\\(\\w+\\)[ \t\n\r]*[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t)
+        (if (re-search-forward "@\\(\\(?:\\w\\|\\s_\\)+\\)[ \t\n\r]*\
+\[{(][ \t\n\r]*\\([^ \t\n\r,]+\\)" nil t)
             (setq alist
                   (list
                    (cons "&type" (downcase (reftex-match-string 1)))
                    (cons "&key"  (reftex-match-string 2)))))
-        (while (re-search-forward "\\(\\w+\\)[ \t\n\r]*=[ \t\n\r]*" nil t)
+        (while (re-search-forward "\\(\\(?:\\w\\|-\\)+\\)[ \t\n\r]*=[ \t\n\r]*"
+                                 nil t)
           (setq key (downcase (reftex-match-string 1)))
           (cond
            ((= (following-char) ?{)
-            (forward-char 1)
-            (setq start (point))
-            (condition-case nil
-                (up-list 1)
-              (error nil)))
+            (cond
+             (raw
+              (setq start (point))
+              (forward-char 1))
+             (t
+              (forward-char 1)
+              (setq start (point))
+              (condition-case nil
+                  (up-list 1)
+                (error nil)))))
            ((= (following-char) ?\")
-            (forward-char 1)
-            (setq start (point))
+            (cond
+             (raw
+              (setq start (point))
+              (forward-char 1))
+             (t
+              (forward-char 1)
+              (setq start (point))))
             (while (and (search-forward "\"" nil t)
                         (= ?\\ (char-after (- (point) 2))))))
            (t
             (setq start (point))
             (re-search-forward "[ \t]*[\n\r,}]" nil 1)))
-          (setq field (buffer-substring-no-properties start (1- (point))))
+          ;; extract field value, ignore trailing comma if in RAW mode
+          (let ((stop (if (and raw (not (= (char-after (1- (point))) ?,)))
+                        (point)
+                        (1- (point))) ))
+            (setq field (buffer-substring-no-properties start stop)))
           ;; remove extra whitespace
           (while (string-match "[\n\t\r]\\|[ \t][ \t]+" field)
             (setq field (replace-match " " nil t field)))
           ;; remove leading garbage
-          (if (string-match "^[ \t{]+" field)
+          (if (string-match (if raw "^[ \t]+" "^[ \t{]+") field)
               (setq field (replace-match "" nil t field)))
           ;; remove trailing garbage
-          (if (string-match "[ \t}]+$" field)
+          (if (string-match (if raw "[ \t]+$" "[ \t}]+$") field)
               (setq field (replace-match "" nil t field)))
           (push (cons key field) alist))))
     alist))
@@ -638,15 +659,13 @@
          (insert-entries selected-entries)
          entry string cite-view)
 
-    (when (stringp selected-entries)
-      (error selected-entries))
     (unless selected-entries (error "Quit"))
 
     (if (stringp selected-entries)
         ;; Nonexistent entry
-        (setq selected-entries nil
-              insert-entries (list (list selected-entries
-                                         (cons "&key" selected-entries))))
+        (setq insert-entries (list (list selected-entries
+                                         (cons "&key" selected-entries)))
+             selected-entries nil)
       ;; It makes sense to compute the cite-view strings.
       (setq cite-view t))
 
@@ -654,7 +673,8 @@
       ;; All keys go into a single command - we need to trick a little
       ;; FIXME: Unfortunately, this means that commenting does not work right.
       (pop selected-entries)
-      (let ((concat-keys (mapconcat 'car selected-entries ",")))
+      (let ((concat-keys (mapconcat 'car selected-entries
+                                   reftex-cite-key-separator)))
         (setq insert-entries
               (list (list concat-keys (cons "&key" concat-keys))))))
 
@@ -675,8 +695,9 @@
                        (equal arg '(4))))
           (let ((start 0) (nth 0) value)
             (while (setq start (string-match "\\[\\]" string start))
-              (setq value (read-string (format "Optional argument %d: "
-                                               (setq nth (1+ nth)))))
+              (setq value (save-match-data
+                           (read-string (format "Optional argument %d: "
+                                                (setq nth (1+ nth))))))
               (setq string (replace-match (concat "[" value "]") t t string))
               (setq start (1+ start)))))
         ;; Should we cleanup empty optional arguments?
@@ -725,7 +746,7 @@
         (forward-char 1)))
 
     ;; Return the citation key
-    (car (car selected-entries))))
+    (mapcar 'car selected-entries)))
 
 (defun reftex-figure-out-cite-format (arg &optional no-insert format-key)
   ;; Check if there is already a cite command at point and change cite format
@@ -744,9 +765,13 @@
       (if (or (not arg) (not (listp arg)))
           (setq format
                 (concat
-                 (if (member (preceding-char) '(?\{ ?,)) "" ",")
+                 (if (member (preceding-char) '(?\{ ?,))
+                    ""
+                  reftex-cite-key-separator)
                  "%l"
-                 (if (member (following-char) '(?\} ?,)) "" ",")))
+                 (if (member (following-char) '(?\} ?,))
+                    ""
+                  reftex-cite-key-separator)))
         (setq format "%l")))
      (t
       ;; Figure out the correct format
@@ -1114,7 +1139,7 @@
           (save-restriction
             (widen)
             (goto-char (point-min))
-            (while (re-search-forward 
"^[^%\n\r]*\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}"
 nil t)
+            (while (re-search-forward 
"\\(?:^\\|\\=\\)[^%\n\r]*?\\\\\\(bibentry\\|[a-zA-Z]*cite[a-zA-Z]*\\)\\(\\[[^\\]]*\\]\\)?{\\([^}]+\\)}"
 nil t)
               (setq kk (match-string-no-properties 3))
               (while (string-match "%.*\n?" kk)
                 (setq kk (replace-match "" t t kk)))
@@ -1125,18 +1150,35 @@
     (reftex-kill-temporary-buffers)
     keys))
 
+(defun reftex-get-string-refs (alist)
+  "Return a list of BibTeX @string references that appear as values in ALIST."
+  (reftex-remove-if (lambda (x) (string-match "^\\([\"{]\\|[0-9]+$\\)" x))
+                   ;; get list of values, discard keys
+                   (mapcar 'cdr
+                           ;; remove &key and &type entries
+                           (reftex-remove-if (lambda (pair)
+                                               (string-match "^&" (car pair)))
+                                             alist))))
+
 (defun reftex-create-bibtex-file (bibfile)
   "Create a new BibTeX database file with all entries referenced in document.
-The command prompts for a filename and writes the collected entries to
-that file.  Only entries referenced in the current document with
-any \\cite-like macros are used.
-The sequence in the new file is the same as it was in the old database."
+The command prompts for a filename and writes the collected
+entries to that file.  Only entries referenced in the current
+document with any \\cite-like macros are used.  The sequence in
+the new file is the same as it was in the old database.
+
+Entries referenced from other entries must appear after all
+referencing entries.
+
+You can define strings to be used as header or footer for the
+created files in the variables `reftex-create-bibtex-header' or
+`reftex-create-bibtex-footer' respectively."
   (interactive "FNew BibTeX file: ")
   (let ((keys (reftex-all-used-citation-keys))
         (files (reftex-get-bibfile-list))
-        file key entries beg end entry)
+        file key entries beg end entry string-keys string-entries)
     (save-current-buffer
-      (while (setq file (pop files))
+      (dolist (file files)
         (set-buffer (reftex-get-file-buffer-force file 'mark))
         (reftex-with-special-syntax-for-bib
          (save-excursion
@@ -1156,14 +1198,54 @@
                (when (member key keys)
                  (setq entry (buffer-substring beg end)
                        entries (cons entry entries)
-                       keys (delete key keys)))))))))
+                       keys (delete key keys))
+
+                 ;; check for crossref entries
+                 (let* ((attr-list (reftex-parse-bibtex-entry nil beg end))
+                        (xref-key (cdr (assoc "crossref" attr-list))))
+                   (if xref-key (pushnew xref-key keys)))
+                 ;; check for string references
+                 (let* ((raw-fields (reftex-parse-bibtex-entry nil beg end t))
+                        (string-fields (reftex-get-string-refs raw-fields)))
+                   (dolist (skey string-fields)
+                     (unless (member skey string-keys)
+                       (push skey string-keys)))))))))))
+    ;; second pass: grab @string references
+    (if string-keys
+        (save-current-buffer
+          (dolist (file files)
+            (set-buffer (reftex-get-file-buffer-force file 'mark))
+            (reftex-with-special-syntax-for-bib
+             (save-excursion
+               (save-restriction
+                 (widen)
+                 (goto-char (point-min))
+                 (while (re-search-forward
+                         "^[ address@hidden \t]*{[ \t]*\\([^ \t\r\n]+\\)"
+                         nil t)
+                   (setq key (match-string 1)
+                         beg (match-beginning 0)
+                         end (progn
+                               (goto-char (match-beginning 1))
+                               (condition-case nil
+                                   (up-list 1)
+                                 (error (goto-char (match-end 0))))
+                               (point)))
+                   (when (member key string-keys)
+                     (setq entry (buffer-substring beg end)
+                           string-entries (cons entry string-entries)
+                           string-keys (delete key string-keys))))))))))
     (find-file-other-window bibfile)
     (if (> (buffer-size) 0)
         (unless (yes-or-no-p
                  (format "Overwrite non-empty file %s? " bibfile))
           (error "Abort")))
     (erase-buffer)
+    (if reftex-create-bibtex-header (insert reftex-create-bibtex-header 
"\n\n"))
+    (insert (mapconcat 'identity (reverse string-entries) "\n\n"))
+    (if string-entries (insert "\n\n\n"))
     (insert (mapconcat 'identity (reverse entries) "\n\n"))
+    (if reftex-create-bibtex-footer (insert "\n\n" 
reftex-create-bibtex-footer))
     (goto-char (point-min))
     (save-buffer)
     (message "%d entries extracted and copied to new database"

=== modified file 'lisp/textmodes/reftex-dcr.el'
--- a/lisp/textmodes/reftex-dcr.el      2012-04-09 13:05:48 +0000
+++ b/lisp/textmodes/reftex-dcr.el      2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,10 +25,10 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-dcr)
-(provide 'reftex-vcr)
+
+(declare-function bibtex-beginning-of-entry "bibtex" ())
+
 (require 'reftex)
-;;;
 
 (defun reftex-view-crossref (&optional arg auto-how fail-quietly)
   "View cross reference of macro at point.  Point must be on the KEY
@@ -229,6 +227,7 @@
 If there is no such macro at point, search forward to find one.
 With argument, actually select the window showing the cross reference."
   (interactive "e")
+  ;; Make sure the referencing macro stays visible in the original window.
   (mouse-set-point ev)
   (reftex-view-crossref current-prefix-arg))
 
@@ -348,15 +347,14 @@
     (message "Automatic display of crossref information was turned on")))
 
 (defun reftex-start-itimer-once ()
-   (and (featurep 'xemacs) reftex-mode
+   (and (featurep 'xemacs)
+       reftex-mode
         (not (itimer-live-p reftex-auto-view-crossref-timer))
         (setq reftex-auto-view-crossref-timer
               (start-itimer "RefTeX Idle Timer"
                             'reftex-view-crossref-when-idle
                             reftex-idle-time nil t))))
 
-(declare-function bibtex-beginning-of-entry "bibtex" ())
-
 (defun reftex-view-crossref-from-bibtex (&optional arg)
   "View location in a LaTeX document which cites the BibTeX entry at point.
 Since BibTeX files can be used by many LaTeX documents, this function
@@ -481,4 +479,6 @@
       (move-marker reftex-global-search-marker nil)
       (error "All files processed"))))
 
+(provide 'reftex-dcr)
+
 ;;; reftex-dcr.el ends here

=== modified file 'lisp/textmodes/reftex-global.el'
--- a/lisp/textmodes/reftex-global.el   2012-06-02 10:56:09 +0000
+++ b/lisp/textmodes/reftex-global.el   2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -407,7 +405,7 @@
     (when flist
       (if wrapp
          (unless isearch-forward
-             (setq flist (last flist)))
+           (setq flist (last flist)))
        (unless isearch-forward
          (setq flist (reverse flist)))
        (while (not (string= (car flist) cb))
@@ -437,7 +435,8 @@
              (with-current-buffer crt-buf
                (when reftex-mode
                  (if (boundp 'multi-isearch-next-buffer-function)
-                     (set (make-local-variable 
'multi-isearch-next-buffer-function)
+                     (set (make-local-variable
+                           'multi-isearch-next-buffer-function)
                           'reftex-isearch-switch-to-next-file)
                    (set (make-local-variable 'isearch-wrap-function)
                         'reftex-isearch-wrap-function)

=== modified file 'lisp/textmodes/reftex-index.el'
--- a/lisp/textmodes/reftex-index.el    2012-09-24 11:39:33 +0000
+++ b/lisp/textmodes/reftex-index.el    2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,9 +25,9 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-index)
+(declare-function texmathp "ext:texmathp" ())
+
 (require 'reftex)
-;;;
 
 ;; START remove for XEmacs release
 (defvar mark-active)
@@ -37,8 +35,6 @@
 (defvar TeX-master)
 ;; END remove for XEmacs release
 
-(declare-function texmathp "ext:texmathp" ())
-
 (defun reftex-index-selection-or-word (&optional arg phrase)
   "Put selection or the word near point into the default index macro.
 This uses the information in `reftex-index-default-macro' to make an index
@@ -52,9 +48,7 @@
   (interactive "P")
   (let* ((use-default (not (equal arg '(16))))  ; check for double prefix
          ;; check if we have an active selection
-         (active (if (featurep 'xemacs)
-                     (and zmacs-regions (region-exists-p))  ; XEmacs
-                   (and transient-mark-mode mark-active)))  ; Emacs
+         (active (reftex-region-active-p))
          (beg (if active
                   (region-beginning)
                 (save-excursion
@@ -1244,7 +1238,11 @@
 
     map)
   "Keymap used for *toc* buffer.")
-
+(defvar reftex-index-phrases-syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?\" "." table)
+    table)
+  "Syntax table for RefTeX Index Phrases mode.")
 
 (defun reftex-index-phrase-selection-or-word (arg)
   "Add current selection or word at point to the phrases buffer.
@@ -1264,6 +1262,7 @@
   "Switch to the phrases buffer, initialize if empty."
   (interactive)
   (reftex-access-scan-info)
+  (set-marker reftex-index-return-marker (point))
   (let* ((master (reftex-TeX-master-file))
          (name (concat (file-name-sans-extension master)
                        reftex-index-phrase-file-extension)))
@@ -1371,6 +1370,7 @@
 Here are all local bindings.
 
 \\{reftex-index-phrases-mode-map}"
+  :syntax-table reftex-index-phrases-syntax-table
   (set (make-local-variable 'font-lock-defaults)
        reftex-index-phrases-font-lock-defaults)
   (easy-menu-add reftex-index-phrases-menu reftex-index-phrases-mode-map)
@@ -2093,5 +2093,6 @@
                                   reftex-index-phrases-macro-data "\n"))))
     (reftex-select-with-char prompt help delay)))
 
+(provide 'reftex-index)
 
 ;;; reftex-index.el ends here

=== modified file 'lisp/textmodes/reftex-parse.el'
--- a/lisp/textmodes/reftex-parse.el    2012-01-19 07:21:25 +0000
+++ b/lisp/textmodes/reftex-parse.el    2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,7 +25,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-parse)
+
 (require 'reftex)
 
 (defmacro reftex-with-special-syntax (&rest body)
@@ -241,8 +239,17 @@
 
                 ((match-end 3)
                  ;; It is a section
-                 (setq bound (point))
 
+                ;; Use the beginning as bound and not the end
+                ;; (i.e. (point)) because the section command might
+                ;; be the start of the current environment to be
+                ;; found by `reftex-label-info'.
+                 (setq bound (match-beginning 0))
+                ;; The section regexp matches a character at the end
+                ;; we are not interested in.  Especially if it is the
+                ;; backslash of a following macro we want to find in
+                ;; the next parsing iteration.
+                (when (eq (char-before) ?\\) (backward-char))
                  ;; Insert in List
                  (setq toc-entry (reftex-section-info file))
                  (when toc-entry
@@ -1072,4 +1079,6 @@
               nrest (- nrest i))))
     string))
 
+(provide 'reftex-parse)
+
 ;;; reftex-parse.el ends here

=== modified file 'lisp/textmodes/reftex-ref.el'
--- a/lisp/textmodes/reftex-ref.el      2012-06-26 16:23:01 +0000
+++ b/lisp/textmodes/reftex-ref.el      2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,10 +25,9 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-ref)
+
 (require 'reftex)
 (require 'reftex-parse)
-;;;
 
 (defun reftex-label-location (&optional bound)
   "Return the environment or macro which determines the label type at point.
@@ -413,27 +410,54 @@
 
   (interactive)
 
-  ;; check for active recursive edits
+  ;; Check for active recursive edits
   (reftex-check-recursive-edit)
 
-  ;; Ensure access to scanning info and rescan buffer if prefix are is '(4)
+  ;; Ensure access to scanning info and rescan buffer if prefix is '(4)
   (reftex-access-scan-info current-prefix-arg)
 
-  (unless type
-    ;; guess type from context
-    (if (and reftex-guess-label-type
-             (setq type (reftex-guess-label-type)))
-        (setq cut (cdr type)
-              type (car type))
-      (setq type (reftex-query-label-type))))
-
-  (let* ((reftex-refstyle
-          (cond ((reftex-typekey-check type reftex-vref-is-default) "\\vref")
-                ((reftex-typekey-check type reftex-fref-is-default) "\\fref")
-                (t "\\ref")))
-         (reftex-format-ref-function reftex-format-ref-function)
-         (form "\\ref{%s}")
-         label labels sep sep1)
+  (let ((reftex-refstyle (when (and (boundp 'reftex-refstyle) reftex-refstyle)
+                   reftex-refstyle))
+       (reftex-format-ref-function reftex-format-ref-function)
+       (form "\\ref{%s}")
+       label labels sep sep1 style-alist)
+
+    (unless reftex-refstyle
+      (if reftex-ref-macro-prompt
+         (progn
+           ;; Build a temporary list which handles more easily.
+           (dolist (elt reftex-ref-style-alist)
+             (when (member (car elt) (reftex-ref-style-list))
+               (mapc (lambda (x)
+                       (add-to-list 'style-alist (cons (cadr x) (car x)) t))
+                     (nth 2 elt))))
+           ;; Prompt the user for the macro.
+           (let ((key (reftex-select-with-char
+                       "" (concat "SELECT A REFERENCE FORMAT\n\n"
+                                  (mapconcat
+                                   (lambda (x)
+                                     (format "[%c] %s  %s" (car x)
+                                             (if (> (car x) 31) " " "")
+                                             (cdr x)))
+                                   style-alist "\n")))))
+             (setq reftex-refstyle (cdr (assoc key style-alist)))
+             (unless reftex-refstyle
+               (error "No reference macro associated with key `%c'" key))))
+       ;; Get the first macro from `reftex-ref-style-alist' which
+       ;; matches the first entry in the list of active styles.
+       (setq reftex-refstyle
+             (or (caar (nth 2 (assoc (car (reftex-ref-style-list))
+                                     reftex-ref-style-alist)))
+                 ;; Use the first entry in r-r-s-a as a last resort.
+                 (caar (nth 2 (car reftex-ref-style-alist)))))))
+
+    (unless type
+      ;; Guess type from context
+      (if (and reftex-guess-label-type
+              (setq type (reftex-guess-label-type)))
+         (setq cut (cdr type)
+               type (car type))
+       (setq type (reftex-query-label-type))))
 
     ;; Have the user select a label
     (set-marker reftex-select-return-marker (point))
@@ -472,17 +496,13 @@
                    (member (preceding-char) '(?\ ?\t ?\n ?~)))
           (setq form (substring form 1)))
         ;; do we have a special format?
-        (setq reftex-format-ref-function
-              (cond
-               ((string= reftex-refstyle "\\vref") 'reftex-format-vref)
-               ((string= reftex-refstyle "\\fref") 'reftex-format-fref)
-               ((string= reftex-refstyle "\\Fref") 'reftex-format-Fref)
-               (t reftex-format-ref-function)))
+       (unless (string= reftex-refstyle "\\ref")
+         (setq reftex-format-ref-function 'reftex-format-special))
         ;; ok, insert the reference
         (if sep1 (insert sep1))
         (insert
          (if reftex-format-ref-function
-             (funcall reftex-format-ref-function label form)
+             (funcall reftex-format-ref-function label form reftex-refstyle)
            (format form label label)))
         ;; take out the initial ~ for good
         (and (= ?~ (string-to-char form))
@@ -791,34 +811,31 @@
         (run-hooks 'reftex-display-copied-context-hook)
         (setq buffer-read-only t))))))
 
-(defun reftex-varioref-vref ()
-  "Insert a reference using the `\\vref' macro from the varioref package."
-  (interactive)
-  (let ((reftex-format-ref-function 'reftex-format-vref))
-    (reftex-reference)))
-(defun reftex-fancyref-fref ()
-  "Insert a reference using the `\\fref' macro from the fancyref package."
-  (interactive)
-  (let ((reftex-format-ref-function 'reftex-format-fref)
-        ;;(reftex-guess-label-type nil) ;FIXME do we want this????
-        )
-    (reftex-reference)))
-(defun reftex-fancyref-Fref ()
-  "Insert a reference using the `\\Fref' macro from the fancyref package."
-  (interactive)
-  (let ((reftex-format-ref-function 'reftex-format-Fref)
-        ;;(reftex-guess-label-type nil) ;FIXME do we want this????
-        )
-    (reftex-reference)))
+;; Generate functions for direct insertion of specific referencing
+;; macros.  The functions are named `reftex-<package>-<macro>',
+;; e.g. `reftex-varioref-vref'.
+(dolist (elt reftex-ref-style-alist)
+  (when (stringp (nth 1 elt))
+    (dolist (item (nth 2 elt))
+      (let ((macro (car item))
+           (package (nth 1 elt)))
+       (eval `(defun ,(intern (format "reftex-%s-%s" package
+                                      (substring macro 1 (length macro)))) ()
+                ,(format "Insert a reference using the `%s' macro from the %s \
+package.\n\nThis is a generated function."
+                         macro package)
+                (interactive)
+                (let ((reftex-refstyle ,macro))
+                  (reftex-reference))))))))
 
-(defun reftex-format-vref (label fmt)
-  (while (string-match "\\\\ref{" fmt)
-    (setq fmt (replace-match "\\vref{" t t fmt)))
-  (format fmt label label))
-(defun reftex-format-Fref (label def-fmt)
-  (format "\\Fref{%s}" label))
-(defun reftex-format-fref (label def-fmt)
-  (format "\\fref{%s}" label))
+(defun reftex-format-special (label fmt refstyle)
+  "Apply selected reference style to format FMT and add LABEL.
+Replace any occurrences of \"\\ref\" with REFSTYLE."
+  ;; Replace instances of \ref in `fmt' with the special reference
+  ;; style selected by the user.
+  (while (string-match "\\(\\\\ref\\)[ \t]*{" fmt)
+    (setq fmt (replace-match refstyle t t fmt 1)))
+  (format fmt label))
 
 (defun reftex-goto-label (&optional other-window)
   "Prompt for a label (with completion) and jump to the location of this label.
@@ -847,5 +864,6 @@
       (goto-char where))
     (reftex-unhighlight 0)))
 
+(provide 'reftex-ref)
 
 ;;; reftex-ref.el ends here

=== modified file 'lisp/textmodes/reftex-sel.el'
--- a/lisp/textmodes/reftex-sel.el      2012-09-24 11:39:33 +0000
+++ b/lisp/textmodes/reftex-sel.el      2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -27,9 +25,8 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl))
-(provide 'reftex-sel)
+
 (require 'reftex)
-;;;
 
 ;; Common bindings in reftex-select-label-mode-map
 ;; and reftex-select-bib-mode-map.
@@ -86,8 +83,8 @@
     (loop for x in
           '(("b"        . reftex-select-jump-to-previous)
             ("z"        . reftex-select-jump)
-            ("v"        . reftex-select-toggle-varioref)
-            ("V"        . reftex-select-toggle-fancyref)
+            ("v"        . reftex-select-cycle-ref-style-forward)
+            ("V"        . reftex-select-cycle-ref-style-backward)
             ("m"        . reftex-select-mark)
             ("u"        . reftex-select-unmark)
             (","        . reftex-select-mark-comma)
@@ -511,6 +508,7 @@
 (defvar last-data)
 (defvar call-back)
 (defvar help-string)
+(defvar reftex-refstyle)
 
 ;; The selection commands
 
@@ -604,23 +602,28 @@
   (setq reftex-last-follow-point -1)
   (setq cb-flag (not cb-flag)))
 
-(defvar reftex-refstyle)                ; from reftex-reference
-
-(defun reftex-select-toggle-varioref ()
-  "Toggle the macro used for referencing the label between \\ref and \\vref."
-  (interactive)
-  (if (string= reftex-refstyle "\\ref")
-      (setq reftex-refstyle "\\vref")
-    (setq reftex-refstyle "\\ref"))
-  (force-mode-line-update))
-(defun reftex-select-toggle-fancyref ()
-  "Toggle the macro used for referencing the label between \\ref and \\vref."
-  (interactive)
-  (setq reftex-refstyle
-        (cond ((string= reftex-refstyle "\\ref") "\\fref")
-              ((string= reftex-refstyle "\\fref") "\\Fref")
-              (t "\\ref")))
-  (force-mode-line-update))
+(defun reftex-select-cycle-ref-style-internal (&optional reverse)
+  "Cycle through macros used for referencing.
+Cycle in reverse order if optional argument REVERSE is non-nil."
+  (let (list)
+    (dolist (style (reftex-ref-style-list))
+      (mapc (lambda (x) (add-to-list 'list (car x) t))
+           (nth 2 (assoc style reftex-ref-style-alist))))
+    (when reverse
+      (setq list (reverse list)))
+    (setq reftex-refstyle (or (cadr (member reftex-refstyle list)) (car 
list))))
+  (force-mode-line-update))
+
+(defun reftex-select-cycle-ref-style-forward ()
+  "Cycle forward through macros used for referencing."
+  (interactive)
+  (reftex-select-cycle-ref-style-internal))
+
+(defun reftex-select-cycle-ref-style-backward ()
+  "Cycle backward through macros used for referencing."
+  (interactive)
+  (reftex-select-cycle-ref-style-internal t))
+
 (defun reftex-select-show-insertion-point ()
   "Show the point from where selection was started in another window."
   (interactive)
@@ -721,7 +724,7 @@
                                 (if sep
                                     (format "*%c%d* " sep (decf cnt))
                                   (format "*%d*  " (decf cnt)))))
-            reftex-select-marked)
+          reftex-select-marked)
     (message "Entry no longer marked")))
 
 (defun reftex-select-help ()
@@ -731,4 +734,6 @@
     (princ help-string))
   (reftex-enlarge-to-fit "*RefTeX Help*" t))
 
+(provide 'reftex-sel)
+
 ;;; reftex-sel.el ends here

=== modified file 'lisp/textmodes/reftex-toc.el'
--- a/lisp/textmodes/reftex-toc.el      2012-05-13 03:05:06 +0000
+++ b/lisp/textmodes/reftex-toc.el      2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -372,14 +370,14 @@
            (error t)))))
 
 (defun reftex-re-enlarge ()
-  ;; Enlarge window to a remembered size.
-  (if reftex-toc-split-windows-horizontally
-      (enlarge-window-horizontally
-       (max 0 (- (or reftex-last-window-width (window-width))
-                 (window-width))))
-    (enlarge-window
-     (max 0 (- (or reftex-last-window-height (window-height))
-               (window-height))))))
+  "Enlarge window to a remembered size."
+  (let ((count (if reftex-toc-split-windows-horizontally
+                  (- (or reftex-last-window-width (window-width))
+                     (window-width))
+                (- (or reftex-last-window-height (window-height))
+                   (window-height)))))
+    (when (> count 0)
+      (enlarge-window count reftex-toc-split-windows-horizontally))))
 
 (defun reftex-toc-dframe-p (&optional frame error)
   ;; Check if FRAME is the dedicated TOC frame.

=== modified file 'lisp/textmodes/reftex-vars.el'
--- a/lisp/textmodes/reftex-vars.el     2012-08-02 18:54:36 +0000
+++ b/lisp/textmodes/reftex-vars.el     2012-09-30 20:30:13 +0000
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -207,6 +205,11 @@
       (?p    . "(%2a %y\\nocite{%l})")))
     (locally     "Full info in parenthesis"
      "(%2a %y, %j %v, %P, %e: %b, %u, %s %<)")
+    (context
+     "ConTeXt bib module"
+     ((?\C-m . "\\cite[%l]")
+      (?s    . "\\cite[][%l]")
+      (?n    . "\\nocite[%l]")))
     )
   "Builtin versions of the citation format.
 The following conventions are valid for all alist entries:
@@ -239,7 +242,7 @@
   "LaTeX label and citation support."
   :tag "RefTeX"
   :link '(url-link :tag "Home Page"
-                   "http://staff.science.uva.nl/~dominik/Tools/reftex/";)
+                   "http://www.gnu.org/software/auctex/reftex.html";)
   :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el")
   :link '(custom-manual "(reftex)Top")
   :prefix "reftex-"
@@ -261,8 +264,8 @@
 
 (defcustom reftex-max-section-depth 12
   "Maximum depth of section levels in document structure.
-Standard LaTeX needs default is 7, but there are packages for which this
-needs to be larger."
+The default in standard LaTeX is 7, but there are packages for
+which this needs to be larger."
   :group 'reftex-table-of-contents-browser
   :type 'integer)
 
@@ -329,7 +332,7 @@
 
 Value 'frame (the default) means, turn automatic recentering on only while the
 dedicated TOC frame does exist, and do the recentering only in that frame.  So
-when creating that frame (with \"d\" key in an ordinary TOC window), the
+when creating that frame (with `d' key in an ordinary TOC window), the
 automatic recentering is turned on.  When the frame gets destroyed, automatic
 recentering is turned off again.
 
@@ -383,8 +386,8 @@
 
 (defcustom reftex-toc-confirm-promotion 2
   "Non-nil means, promotion/demotion commands first prompt for confirmation.
-When nil, the command is executed immediately.  When this is an integer
-N, ask for confirmation only if N or more section commands are going to be
+If nil, the command is executed immediately.  If this is an integer N,
+ask for confirmation only if N or more section commands are going to be
 changed."
   :group 'reftex-table-of-contents-browser
   :type '(choice
@@ -408,7 +411,7 @@
 
 (defcustom reftex-revisit-to-follow nil
   "Non-nil means, follow-mode will revisit files if necessary.
-When nil, follow-mode will be suspended for stuff in unvisited files."
+If nil, follow-mode will be suspended for stuff in unvisited files."
   :group 'reftex-table-of-contents-browser
   :group 'reftex-referencing-labels
   :type 'boolean)
@@ -452,8 +455,8 @@
 (defcustom reftex-label-alist nil
   "Alist with information on environments for \\label-\\ref use.
 
-This docstring is easier to understand after reading the configuration
-examples in `reftex.el'.  Looking at the builtin defaults in the constant
+This doc string is easier to understand after reading the configuration
+examples in the manual.  Looking at the builtin defaults in the constant
 `reftex-label-alist-builtin' may also be instructive.
 
 Set this variable to define additions and changes to the default.  The only
@@ -481,12 +484,11 @@
     Special names: `section' for section labels, `any' to define a group
     which contains all labels.
 
-    This may also be a function to do local parsing and identify point
-    to be in a non-standard label environment.  The function must take
-    an argument BOUND and limit backward searches to this value.  It
-    should return either nil or a cons cell (FUNCTION . POSITION) with
-    the function symbol and the position where the special environment
-    starts.  See the Info documentation for an example.
+    This may also be a function to do local parsing and identify point to
+    be in a non-standard label environment.  The function must take an
+    argument BOUND and limit backward searches to this value.  It should
+    return either nil or the position where the special environment starts.
+    See the Info documentation for an example.
 
     Finally this may also be nil if the entry is only meant to change
     some settings associated with the type indicator character (see below).
@@ -500,7 +502,7 @@
     `equation' and `eqnarray').
     If the type indicator is nil and the macro has a label argument {*},
     the macro defines neutral labels just like \\label.  In this case
-    the reminder of this entry is ignored.
+    the remainder of this entry is ignored.
 
 LABEL-PREFIX
     Label prefix string, like \"tab:\".
@@ -516,8 +518,8 @@
     Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\").
 
 REFERENCE-FORMAT
-    Format string for reference insert in buffer.  `%s' will be replaced by
-    the label.
+    Format string for reference insertion in buffer.  `%s' will be replaced
+    by the label.
     When the format starts with `~', the `~' will only be inserted if
     there is not already a whitespace before point.
 
@@ -533,7 +535,7 @@
     - If an integer, use the nth argument of the macro.  As a special case,
       1000 means to get text after the last macro argument.
     - If a string, use as regexp to search *backward* from the label.  Context
-      is then the text following the end of the match.  E.g. putting this to
+      is then the text following the end of the match.  E.g. setting this to
       \"\\\\\\\\caption[[{]\" will use the caption in a figure or table
       environment.
       \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays.
@@ -755,8 +757,7 @@
 
 3. Tell RefTeX to use this function
 
-   (setq reftex-special-environment-functions '(my-detect-linguex-list))
-"
+   (setq reftex-special-environment-functions '(my-detect-linguex-list))"
   :group 'reftex-defining-label-environments
   :type 'hook)
 
@@ -820,11 +821,13 @@
   :type 'symbol)
 
 (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.  The intended application is to convert ISO or
-Mule characters into something valid 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'."
+  "Filter function to convert a string to ASCII.
+The function is used to process a context string before it is
+used to derive a label from it.  The intended application is to
+convert ISO or Mule characters into something valid 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)
 
@@ -947,28 +950,79 @@
   :group 'reftex-referencing-labels
   :type '(repeat (cons (character) (string))))
 
+(defcustom reftex-ref-style-alist
+  '(("Default" t
+     (("\\ref" ?\C-m) ("\\pageref" ?p)))
+    ("Varioref" "varioref"
+     (("\\vref" ?v) ("\\vpageref" ?g) ("\\Vref" ?V) ("\\Ref" ?R)))
+    ("Fancyref" "fancyref"
+     (("\\fref" ?f) ("\\Fref" ?F)))
+    ("Hyperref" "hyperref"
+     (("\\autoref" ?a) ("\\autopageref" ?u))))
+  "Alist of reference styles.
+Each element is a list of the style name, the name of the LaTeX
+package associated with the style or t for any package, and an
+alist of macros where the first entry of each item is the
+reference macro and the second a key for selecting the macro when
+the macro type is being prompted for.  (See also
+`reftex-ref-macro-prompt'.)  The keys, represented as characters,
+have to be unique."
+  :group 'reftex-referencing-labels
+  :type '(alist :key-type (string :tag "Style name")
+               :value-type (group (choice :tag "Package"
+                                          (const :tag "Any package" t)
+                                          (string :tag "Name"))
+                                  (repeat :tag "Macros"
+                                          (group (string :tag "Macro")
+                                                 (character :tag "Key"))))))
+
+(defcustom reftex-ref-macro-prompt t
+  "If non-nil, `reftex-reference' prompts for the reference macro."
+  :group 'reftex-referencing-labels
+  :type 'boolean)
+
 (defcustom reftex-vref-is-default nil
-  "Non-nil means, the varioref macro \\vref is used as default.
-In the selection buffer, the `v' key toggles the reference macro between
-`\\ref' and `\\vref'.  The value of this variable determines the default
-which is active when entering the selection process.
-Instead of nil or t, this may also be a string of type letters indicating
-the label types for which it should be true."
+  "Non-nil means, the varioref reference style is used as default.
+The value of this variable determines the default which is active
+when entering the selection process.  Instead of nil or t, this
+may also be a string of type letters indicating the label types
+for which it should be true.
+
+This variable is obsolete, use `reftex-ref-style-default-list'
+instead."
   :group  'reftex-referencing-labels
   :type `(choice :tag "\\vref is default macro" ,@reftex-tmp))
 ;;;###autoload(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) 
(or (stringp x) (symbolp x))))
 
 (defcustom reftex-fref-is-default nil
-  "Non-nil means, the fancyref macro \\fref is used as default.
-In the selection buffer, the `V' key toggles the reference macro between
-`\\ref', `\\fref' and `\\Fref'.  The value of this variable determines
-the default which is active when entering the selection process.
-Instead of nil or t, this may also be a string of type letters indicating
-the label types for which it should be true."
+  "Non-nil means, the fancyref reference style is used as default.
+The value of this variable determines the default which is active
+when entering the selection process.  Instead of nil or t, this
+may also be a string of type letters indicating the label types
+for which it should be true.
+
+This variable is obsolete, use `reftex-ref-style-default-list'
+instead."
   :group  'reftex-referencing-labels
   :type `(choice :tag "\\fref is default macro" ,@reftex-tmp))
 ;;;###autoload(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) 
(or (stringp x) (symbolp x))))
 
+(defcustom reftex-ref-style-default-list '("Default")
+  "List of reference styles to be activated by default.
+The order is significant and controls the order in which macros
+can be cycled in the buffer for selecting a label.  The entries
+in the list have to match the respective reference style names
+used in the variable `reftex-ref-style-alist'."
+  :group 'reftex-referencing-labels
+  :type `(set ,@(mapcar (lambda (x) (list 'const (car x)))
+                       reftex-ref-style-alist)))
+
+;; Compatibility with obsolete variables.
+(when reftex-vref-is-default
+  (add-to-list 'reftex-ref-style-default-list "Varioref"))
+(when reftex-fref-is-default
+  (add-to-list 'reftex-ref-style-default-list "Fancyref"))
+
 (defcustom reftex-level-indent 2
   "Number of spaces to be used for indentation per section level."
   :group 'reftex-referencing-labels
@@ -987,19 +1041,22 @@
 
 (defcustom reftex-format-ref-function nil
   "Function which produces the string to insert as a reference.
-Normally should be nil, because the format to insert a reference can
-already be specified in `reftex-label-alist'.
-This hook also is used by the special commands to insert `\\vref' and `\\fref'
-references, so even if you set this, your setting will be ignored by
-the special commands.
-The function will be called with two arguments, the LABEL and the DEFAULT
-FORMAT, which normally is `~\\ref{%s}'.  The function should return the
-string to insert into the buffer."
+Normally should be nil, because the format to insert a reference
+can already be specified in `reftex-label-alist'.
+
+This hook also is used by the special commands to insert
+e.g. `\\vref' and `\\fref' references, so even if you set this,
+your setting will be ignored by the special commands.
+
+The function will be called with three arguments, the LABEL, the
+DEFAULT FORMAT, which normally is `~\\ref{%s}' and the REFERENCE
+STYLE.  The function should return the string to insert into the
+buffer."
   :group 'reftex-referencing-labels
-  :type 'function)
+  :type '(choice (const nil) function))
 
 (defcustom reftex-select-label-mode-hook nil
-  "Mode hook for reftex-select-label-mode."
+  "Mode hook for `reftex-select-label-mode'."
   :group 'reftex-referencing-labels
   :type 'hook)
 
@@ -1009,7 +1066,8 @@
   "Support for referencing bibliographic data with BibTeX."
   :group 'reftex)
 
-(defcustom reftex-bibliography-commands '("bibliography" "nobibliography")
+(defcustom reftex-bibliography-commands
+  '("bibliography" "nobibliography" "setupbibtex\\[.*?database=")
   "LaTeX commands which specify the BibTeX databases to use with the document."
   :group 'reftex-citation-support
   :type '(repeat string))
@@ -1114,7 +1172,7 @@
 
 (defcustom reftex-cite-prompt-optional-args 'maybe
   "Non-nil means, prompt for empty optional arguments in cite macros.
-When an entry in `reftex-cite-format' ist given with square brackets to
+When an entry in `reftex-cite-format' is given with square brackets to
 indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
 prompt for values.  Possible values are:
 
@@ -1189,13 +1247,28 @@
 DEFAULT FORMAT, which is taken from `reftex-cite-format'.  The function
 should return the string to insert into the buffer."
   :group 'reftex-citation-support
-  :type 'function)
+  :type '(choice (const nil) function))
 
 (defcustom reftex-select-bib-mode-hook nil
   "Mode hook for reftex-select-bib-mode."
   :group 'reftex-citation-support
   :type 'hook)
 
+(defcustom reftex-cite-key-separator ","
+  "String to be used for separating several keys in a \\cite macro."
+  :group 'reftex-citation-support
+  :type 'string)
+
+(defcustom reftex-create-bibtex-header nil
+  "Header to insert in BibTeX files generated by RefTeX."
+  :group 'reftex-citation-support
+  :type 'string)
+
+(defcustom reftex-create-bibtex-footer nil
+  "Footer to insert in BibTeX files generated by RefTeX."
+  :group 'reftex-citation-support
+  :type 'string)
+
 ;; Index Support Configuration
 
 (defgroup reftex-index-support nil
@@ -1223,7 +1296,9 @@
           (string :tag "ESCAPE char     ")))
 
 (defcustom reftex-index-macros nil
-  "Macros which define index entries.  The structure is
+  "Macros which define index entries.
+
+The structure is
 
 \(MACRO INDEX-TAG KEY PREFIX EXCLUDE REPEAT)
 
@@ -1456,7 +1531,7 @@
 This is used when `reftex-view-crossref' is called with point in an
 argument of a macro.  Note that crossref viewing for citations,
 references (both ways) and index entries is hard-coded.  This variable
-is only to configure additional structures for which crossreference
+is only to configure additional structures for which cross-reference
 viewing can be useful.  Each entry has the structure
 
 \(MACRO-RE SEARCH-RE HIGHLIGHT).
@@ -1499,15 +1574,17 @@
   :type 'boolean)
 
 (defcustom reftex-cache-cite-echo t
-  "Non-nil means, the information displayed in the echo area for cite macros
-is cached and even saved along with the parsing information.  The cache
-survives document scans.  In order to clear it, use M-x reftex-reset-mode."
+  "Non-nil means, echoed information for cite macros is cached.
+The information displayed in the echo area for cite macros is
+cached and even saved along with the parsing information.  The
+cache survives document scans.  In order to clear it, use M-x
+reftex-reset-mode <RET>."
   :group 'reftex-viewing-cross-references
   :type 'boolean)
 
 (defcustom reftex-display-copied-context-hook nil
-  "Normal Hook which is run before context is displayed anywhere.  Designed
-for X-Symbol, but may have other uses as well."
+  "Normal hook which is run before context is displayed anywhere.
+Designed for X-Symbol, but may have other uses as well."
   :group 'reftex-viewing-cross-references
   :group 'reftex-referencing-labels
   :type 'hook)
@@ -1690,7 +1767,7 @@
 information.  When this variable is t,
 - accessing the parsing information for the first time in an editing session
   will read that file (if available) instead of parsing the document.
-- exiting Emacs or killing a buffer in reftex-mode will cause a new version
+- exiting Emacs or killing a buffer in `reftex-mode' will cause a new version
   of the file to be written."
   :group 'reftex-optimizations-for-large-documents
   :type 'boolean)
@@ -1855,22 +1932,13 @@
 
 (defcustom reftex-extra-bindings nil
   "Non-nil means, make additional key bindings on startup.
-These extra bindings are located in the
-`reftex-extra-bindings-map' map, bound to
-`reftex-extra-bindings-prefix'."
-  :group 'reftex-miscellaneous-configurations
-  :type 'boolean)
-
-;; below, default is C-c C-y because it is free in LaTeX mode.
-(defcustom reftex-extra-bindings-prefix "\C-c\C-y"
-  "When `reftex-extra-bindings' is set to non-nil, use extra
-bindings with this prefix bound to `reftex-extra-bindings-map'."
+These extra bindings are located in the users `C-c letter' map."
   :group 'reftex-miscellaneous-configurations
   :type 'boolean)
 
 (defcustom reftex-plug-into-AUCTeX nil
   "Plug-in flags for AUCTeX interface.
-This variable is a list of 4 boolean flags.  When a flag is non-nil,
+This variable is a list of 5 boolean flags.  When a flag is non-nil,
 RefTeX will
 
   - supply labels in new sections and environments  (flag 1)
@@ -1900,8 +1968,7 @@
            (boolean :tag "supply argument for macros like `\\label'     ")
            (boolean :tag "supply argument for macros like `\\ref'       ")
            (boolean :tag "supply argument for macros like `\\cite'      ")
-           (boolean :tag "supply argument for macros like `\\index'     ")
-           )))
+           (boolean :tag "supply argument for macros like `\\index'     "))))
 
 (defcustom reftex-allow-detached-macro-args nil
   "Non-nil means, allow arguments of macros to be detached by whitespace.

=== modified file 'lisp/textmodes/reftex.el'
--- a/lisp/textmodes/reftex.el  2012-09-24 11:39:33 +0000
+++ b/lisp/textmodes/reftex.el  2012-09-30 20:30:13 +0000
@@ -3,7 +3,6 @@
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
-;; Version: 4.31
 ;; Keywords: tex
 
 ;; This file is part of GNU Emacs.
@@ -21,10 +20,8 @@
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
-;;---------------------------------------------------------------------------
-;;
 ;;; Commentary:
-;;
+
 ;; RefTeX is a minor mode with distinct support for \ref, \label, \cite,
 ;; and \index commands in (multi-file) LaTeX documents.
 ;; - A table of contents provides easy access to any part of a document.
@@ -34,243 +31,23 @@
 ;; - Text phrases can be collected in a file, for later global indexing.
 ;; - The index preview buffer helps to check and edit index entries.
 ;;
-;;
-;; INSTALLATION
-;; ------------
-;;
-;; - If this file is part of an X/Emacs distribution, it is installed.
-;; - For XEmacs 21.x, you need to install the RefTeX plug-in package
-;;   available from the XEmacs distribution sites.
-;; - If you have downloaded this file from the maintainers webpage, follow
-;;   the instructions in the INSTALL file of the distribution.
-;;
-;; To turn RefTeX Mode on and off in a buffer, use `M-x reftex-mode'.
-;;
-;; To turn on RefTeX Mode for all LaTeX files, add the following lines
-;; to your init file:
-;;
-;;   (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; AUCTeX LaTeX mode
-;;   (add-hook 'latex-mode-hook 'turn-on-reftex)   ; Emacs latex mode
-;;
-;;
-;; DOCUMENTATION
-;; -------------
-;;
-;; See below for a short summary of how to use RefTeX.
-;;
-;; There is an extensive texinfo document describing RefTeX in detail.
+;; There is an extensive Texinfo document describing RefTeX in detail.
 ;; One way to view this documentation is `M-x reftex-info RET'.
 ;;
 ;; The documentation in various formats is also available at
 ;;
-;;     http://zon.astro.uva.nl/~dominik/Tools/
-;;
-;;---------------------------------------------------------------------------
-;;
-;; Introduction
-;; ************
-;;
-;; RefTeX is a specialized package for support of labels, references,
-;; citations, and the index in LaTeX.  RefTeX wraps itself round 4 LaTeX
-;; macros: `\label', `\ref', `\cite', and `\index'.  Using these macros
-;; usually requires looking up different parts of the document and
-;; searching through BibTeX database files.  RefTeX automates these
-;; time-consuming tasks almost entirely.  It also provides functions to
-;; display the structure of a document and to move around in this
-;; structure quickly.
-;;
-;;    *Note Imprint::, for information about who to contact for help, bug
-;; reports or suggestions.
-;;
-;; Environment
-;; ===========
-;;
-;; RefTeX needs to access all files which are part of a multifile
-;; document, and the BibTeX database files requested by the
-;; `\bibliography' command.  To find these files, RefTeX will require a
-;; search path, i.e. a list of directories to check.  Normally this list
-;; is stored in the environment variables `TEXINPUTS' and `BIBINPUTS'
-;; which are also used by RefTeX.  However, on some systems these
-;; variables do not contain the full search path.  If RefTeX does not work
-;; for you because it cannot find some files, read *Note Finding Files::.
-;;
-;; Entering RefTeX Mode
-;; ====================
-;;
-;; To turn RefTeX Mode on and off in a particular buffer, use `M-x
-;; reftex-mode'.  To turn on RefTeX Mode for all LaTeX files, add the
-;; following lines to your init file:
-;;
-;;      (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
-;;      (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
-;;
-;; RefTeX in a Nutshell
-;; ====================
-;;
-;;   1. Table of Contents
-;;      Typing `C-c =' (`reftex-toc') will show a table of contents of the
-;;      document.  This buffer can display sections, labels and index
-;;      entries defined in the document.  From the buffer, you can jump
-;;      quickly to every part of your document.  Press `?' to get help.
-;;
-;;   2. Labels and References
-;;      RefTeX helps to create unique labels and to find the correct key
-;;      for references quickly.  It distinguishes labels for different
-;;      environments, 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').
-;;
-;;         * Creating Labels
-;;           Type `C-c (' (`reftex-label') to insert a label at point.
-;;           RefTeX will either
-;;              - derive a label from context (default for section labels)
-;;              - prompt for a label string (default for figures and
-;;                tables) or
-;;              - insert a simple label made of a prefix and a number (all
-;;                other environments)
-;;
-;;           Which labels are created how is configurable with the variable
-;;           `reftex-insert-label-flags'.
-;;
-;;         * Referencing Labels
-;;           To make a reference, type `C-c )' (`reftex-reference').  This
-;;           shows an outline of the document with all labels of a certain
-;;           type (figure, equation,...) and some label context.
-;;           Selecting a label inserts a `\ref{LABEL}' macro into the
-;;           original buffer.
-;;
-;;   3. Citations
-;;      Typing `C-c [' (`reftex-citation') will let you specify a regular
-;;      expression to search in current BibTeX database files (as
-;;      specified in the `\bibliography' command) and pull out a list of
-;;      matches for you to choose from.  The list is _formatted_ and
-;;      sorted.  The selected article is referenced as `\cite{KEY}' (see
-;;      the variable `reftex-cite-format' if you want to insert different
-;;      macros).
-;;
-;;   4. Index Support
-;;      RefTeX helps to enter index entries.  It also compiles all entries
-;;      into an alphabetically sorted `*Index*' buffer which you can use
-;;      to check and edit the entries.  RefTeX knows about the standard
-;;      index macros and can be configured to recognize any additional
-;;      macros you have defined (`reftex-index-macros').  Multiple indices
-;;      are supported.
-;;
-;;         * Creating Index Entries
-;;           To index the current selection or the word at point, type
-;;           `C-c /' (`reftex-index-selection-or-word').  The default macro
-;;           `reftex-index-default-macro' will be used.  For a more
-;;           complex entry type `C-c <' (`reftex-index'), select any of
-;;           the index macros and enter the arguments with completion.
-;;
-;;         * The Index Phrases File (Delayed Indexing)
-;;           Type `C-c \' (`reftex-index-phrase-selection-or-word') to add
-;;           the current word or selection to a special _index phrase
-;;           file_.  RefTeX can later search the document for occurrences
-;;           of these phrases and let you interactively index the matches.
-;;
-;;         * Displaying and Editing the Index
-;;           To display the compiled index in a special buffer, type `C-c
-;;           >' (`reftex-display-index').  From that buffer you can check
-;;           and edit all entries.
-;;
-;;   5. Viewing Cross-References
-;;      When point is on the KEY argument of a cross-referencing macro
-;;      (`\label', `\ref', `\cite', `\bibitem', `\index', and variations)
-;;      or inside a BibTeX database entry, you can press `C-c &'
-;;      (`reftex-view-crossref') to display corresponding locations in the
-;;      document and associated BibTeX database files.
-;;      When the enclosing macro is `\cite' or `\ref' and no other message
-;;      occupies the echo area, information about the citation or label
-;;      will automatically be displayed in the echo area.
-;;
-;;   6. Multifile Documents
-;;      Multifile Documents are fully supported.  The included files must
-;;      have a file variable `TeX-master' or `tex-main-file' pointing to
-;;      the master file.  RefTeX provides cross-referencing information
-;;      from all parts of the document, and across document borders
-;;      (`xr.sty').
-;;
-;;   7. Document Parsing
-;;      RefTeX needs to parse the document in order to find labels and
-;;      other information.  It does it automatically once and updates its
-;;      list internally when `reftex-label' and `reftex-index' are used.
-;;      To enforce reparsing, call any of the commands described above
-;;      with a raw `C-u' prefix, or press the `r' key in the label
-;;      selection buffer, the table of contents buffer, or the index
-;;      buffer.
-;;
-;;   8. AUCTeX
-;;      If your major LaTeX mode is AUCTeX, RefTeX can cooperate with it
-;;      (see variable `reftex-plug-into-AUCTeX').  AUCTeX contains style
-;;      files which trigger appropriate settings in RefTeX, so that for
-;;      many of the popular LaTeX packages no additional customizations
-;;      will be necessary.
-;;
-;;   9. Useful Settings
-;;      To make RefTeX faster for large documents, try these:
-;;           (setq reftex-enable-partial-scans t)
-;;           (setq reftex-save-parse-info t)
-;;           (setq reftex-use-multiple-selection-buffers t)
-;;
-;;      To integrate with AUCTeX, use
-;;           (setq reftex-plug-into-AUCTeX t)
-;;
-;;      To make your own LaTeX macro definitions known to RefTeX,
-;;      customize the variables
-;;           `reftex-label-alist'          (for label macros/environments)
-;;           `reftex-section-levels'       (for sectioning commands)
-;;           `reftex-cite-format'          (for `\cite'-like macros)
-;;           `reftex-index-macros'         (for `\index'-like macros)
-;;           `reftex-index-default-macro'  (to set the default macro)
-;;      If you have a large number of macros defined, you may want to write
-;;      an AUCTeX style file to support them with both AUCTeX and RefTeX.
-;;
-;;  10. Where Next?
-;;      Go ahead and use RefTeX.  Use its menus until you have picked up
-;;      the key bindings.  For an overview of what you can do in each of
-;;      the different special buffers, press `?'.  Read the manual if you
-;;      get stuck, of if you are curious what else might be available.
-;;      The first part of the manual explains in a tutorial way how to use
-;;      and customize RefTeX.  The second part is a command and variable
-;;      reference.
-;;
-;;---------------------------------------------------------------------------
-;;
-;; AUTHOR
-;; ======
-;;
-;; Carsten Dominik <address@hidden>
-;;
-;;         with contributions from Stephen Eglen
+;;     http://www.gnu.org/software/auctex/manual/reftex.index.html
 ;;
 ;; RefTeX is bundled with Emacs and available as a plug-in package for
 ;; XEmacs 21.x.  If you need to install it yourself, you can find a
 ;; distribution at
 ;;
-;;    http://zon.astro.uva.nl/~dominik/Tools/
-;;
-;; THANKS TO:
-;; ---------
-;; Thanks to the people on the Net who have used RefTeX and helped
-;; developing it with their reports.  In particular thanks to
-;;
-;;    Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen,
-;;    Karl Eichwalder, Peter Galbraith, Dieter Kraft, Kai Grossjohann,
-;;    Frank Harrell, Adrian Lanz, Rory Molinari, Stefan Monnier,
-;;    Laurent Mugnier, Sudeep Kumar Palat, Daniel Polani, Robin Socha,
-;;    Richard Stanton, Allan Strand, Jan Vroonhof, 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).
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;;;;;
-
+;;    http://www.gnu.org/software/auctex/reftex.html
+;;
+;; RefTeX was written by Carsten Dominik <address@hidden> with
+;; contributions from Stephen Eglen.  It is currently maintained by
+;; the AUCTeX project.
+
 ;;; Code:
 
 (eval-when-compile (require 'cl))
@@ -289,52 +66,13 @@
     (set symbol value)))
 
 
-;;; =========================================================================
-;;;
-;;; Configuration variables
-
+;; Configuration variables
 (require 'reftex-vars)
 
 
-;;; =========================================================================
-;;;
-;;; Define the formal stuff for a minor mode named RefTeX.
-;;;
-
-(defconst reftex-version "RefTeX version 4.31"
-  "Version string for RefTeX.")
-
-(defvar reftex-mode-map (make-sparse-keymap)
-  "Keymap for RefTeX mode.")
-
-(defvar reftex-mode-menu nil)
-(defvar reftex-syntax-table nil)
-(defvar reftex-syntax-table-for-bib nil)
-
-(unless reftex-syntax-table
-  (setq reftex-syntax-table (copy-syntax-table))
-  (modify-syntax-entry ?\( "." reftex-syntax-table)
-  (modify-syntax-entry ?\) "." reftex-syntax-table))
-
-(unless reftex-syntax-table-for-bib
-  (setq reftex-syntax-table-for-bib
-        (copy-syntax-table reftex-syntax-table))
-  (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
-  (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
-  (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
-  (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
-
-;; The following definitions are out of place, but I need them here
-;; to make the compilation of reftex-mode not complain.
-(defvar reftex-auto-view-crossref-timer nil
-  "The timer used for auto-view-crossref.")
-(defvar reftex-toc-auto-recenter-timer nil
-  "The idle timer used to recenter the toc window.")
-
-;;; =========================================================================
-;;;
-;;; Parser functions
-
+;;; Autoloads
+
+;; Parser functions
 (autoload 'reftex-parse-one "reftex-parse"
   "Re-parse this file." t)
 (autoload 'reftex-parse-all "reftex-parse"
@@ -358,11 +96,7 @@
 (autoload 'reftex-ensure-index-support "reftex-parse")
 (autoload 'reftex-everything-regexp "reftex-parse")
 
-
-;;; =========================================================================
-;;;
-;;; Labels and References
-
+;; Labels and References
 (autoload 'reftex-label-location "reftex-ref")
 (autoload 'reftex-label-info-update "reftex-ref")
 (autoload 'reftex-label-info "reftex-ref")
@@ -381,10 +115,7 @@
 (autoload 'reftex-goto-label "reftex-ref"
   "Prompt for label name and go to that location." t)
 
-;;; =========================================================================
-;;;
-;;; Table of contents
-
+;; Table of contents
 (autoload 'reftex-toc "reftex-toc"
   "Show the table of contents for the current document." t)
 (autoload 'reftex-toc-recenter "reftex-toc"
@@ -392,10 +123,7 @@
 (autoload 'reftex-toggle-auto-toc-recenter "reftex-toc"
   "Toggle automatic recentering of TOC window." t)
 
-;;; =========================================================================
-;;;
-;;; BibTeX citations.
-
+;; BibTeX citations.
 (autoload 'reftex-citep "reftex-cite")
 (autoload 'reftex-citet "reftex-cite")
 (autoload 'reftex-make-cite-echo-string "reftex-cite")
@@ -409,10 +137,7 @@
 (autoload 'reftex-bib-or-thebib "reftex-cite")
 (autoload 'reftex-create-bibtex-file "reftex-cite")
 
-;;; =========================================================================
-;;;
-;;; Selection
-
+;; Selection
 (autoload 'reftex-select-label-mode "reftex-sel")
 (autoload 'reftex-select-bib-mode "reftex-sel")
 (autoload 'reftex-find-start-point "reftex-sel")
@@ -420,11 +145,7 @@
 (autoload 'reftex-get-offset "reftex-sel")
 (autoload 'reftex-select-item "reftex-sel")
 
-
-;;; =========================================================================
-;;;
-;;; Index support
-
+;; Index support
 (autoload 'reftex-index "reftex-index"
  "Query for an index macro and insert it along with its arguments." t)
 (autoload 'reftex-index-selection-or-word "reftex-index"
@@ -442,11 +163,7 @@
 (autoload 'reftex-index-show-entry "reftex-index")
 (autoload 'reftex-index-select-tag "reftex-index")
 
-
-;;; =========================================================================
-;;;
-;;; View cross references
-
+;; View cross references
 (autoload 'reftex-view-crossref "reftex-dcr"
  "View cross reference of \\ref or \\cite macro at point." t)
 (autoload 'reftex-mouse-view-crossref "reftex-dcr"
@@ -455,11 +172,7 @@
 (autoload 'reftex-view-crossref-from-bibtex "reftex-dcr"
  "View location in a LaTeX document which cites the BibTeX entry at point." t)
 
-
-;;; =========================================================================
-;;;
-;;; Operations on entire Multifile documents
-
+;; Operations on entire Multifile documents
 (autoload 'reftex-create-tags-file "reftex-global"
  "Create TAGS file by running `etags' on the current document." t)
 (autoload 'reftex-grep-document "reftex-global"
@@ -477,11 +190,7 @@
 (autoload 'reftex-save-all-document-buffers "reftex-global"
  "Save all documents associated with the current document." t)
 
-
-;;; =========================================================================
-;;;
-;;; AUCTeX Interface
-
+;; AUCTeX Interface
 (autoload 'reftex-arg-label "reftex-auc")
 (autoload 'reftex-arg-cite "reftex-auc")
 (autoload 'reftex-arg-index-tag "reftex-auc")
@@ -494,6 +203,41 @@
 (autoload 'reftex-add-section-levels "reftex-auc")
 (autoload 'reftex-notice-new-section "reftex-auc")
 
+
+;;; =========================================================================
+;;;
+;;; Define the formal stuff for a minor mode named RefTeX.
+;;;
+
+(defconst reftex-version emacs-version
+  "Version string for RefTeX.")
+
+(defvar reftex-mode-map (make-sparse-keymap)
+  "Keymap for RefTeX mode.")
+
+(defvar reftex-mode-menu nil)
+(defvar reftex-syntax-table nil)
+(defvar reftex-syntax-table-for-bib nil)
+
+(unless reftex-syntax-table
+  (setq reftex-syntax-table (copy-syntax-table))
+  (modify-syntax-entry ?\( "." reftex-syntax-table)
+  (modify-syntax-entry ?\) "." reftex-syntax-table))
+
+(unless reftex-syntax-table-for-bib
+  (setq reftex-syntax-table-for-bib (copy-syntax-table))
+  (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
+  (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
+  (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
+  (modify-syntax-entry ?\] "." reftex-syntax-table-for-bib))
+
+;; The following definitions are out of place, but I need them here
+;; to make the compilation of reftex-mode not complain.
+(defvar reftex-auto-view-crossref-timer nil
+  "The timer used for auto-view-crossref.")
+(defvar reftex-toc-auto-recenter-timer nil
+  "The idle timer used to recenter the toc window.")
+
 ;;;###autoload
 (defun turn-on-reftex ()
   "Turn on RefTeX mode."
@@ -503,13 +247,7 @@
 (put 'reftex-mode :menu-tag "RefTeX Mode")
 ;;;###autoload
 (define-minor-mode reftex-mode
-  "Toggle RefTeX mode.
-With a prefix argument ARG, enable RefTeX mode if ARG is
-positive, and disable it otherwise.  If called from Lisp, enable
-the mode if ARG is omitted or nil.
-
-RefTeX mode is a buffer-local minor mode with distinct support
-for \\label, \\ref and \\cite in LaTeX.
+  "Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
 
 \\<reftex-mode-map>A Table of Contents of the entire (multifile) document with 
browsing
 capabilities is available with `\\[reftex-toc]'.
@@ -559,8 +297,7 @@
         (modify-syntax-entry ?\( "." reftex-syntax-table)
         (modify-syntax-entry ?\) "." reftex-syntax-table)
 
-        (setq reftex-syntax-table-for-bib
-              (copy-syntax-table reftex-syntax-table))
+        (setq reftex-syntax-table-for-bib (copy-syntax-table))
         (modify-syntax-entry ?\' "." reftex-syntax-table-for-bib)
         (modify-syntax-entry ?\" "." reftex-syntax-table-for-bib)
         (modify-syntax-entry ?\[ "." reftex-syntax-table-for-bib)
@@ -635,16 +372,15 @@
   (incf reftex-multifile-index))
 
 (defun reftex-tie-multifile-symbols ()
-  ;; Tie the buffer-local symbols to globals connected with the master file.
-  ;; If the symbols for the current master file do not exist, they are created.
-
+  "Tie the buffer-local symbols to globals connected with the master file.
+If the symbols for the current master file do not exist, they are created."
   (let* ((master (file-truename (reftex-TeX-master-file)))
          (index (assoc master reftex-master-index-list))
          (symlist reftex-multifile-symbols)
          symbol symname newflag)
     ;; Find the correct index.
     (if index
-        ;; symbols do exist
+        ;; Symbols do exist
         (setq index (cdr index))
       ;; Get a new index and add info to the alist.
       (setq index (reftex-next-multifile-index)
@@ -661,13 +397,15 @@
       ;; Initialize if new symbols.
       (when newflag
         (set (symbol-value symbol) nil)
-        (put (symbol-value symbol) 'reftex-index-macros-style '(default))))
+        (put (symbol-value symbol) 'reftex-index-macros-style '(default))
+       (put (symbol-value symbol) 'reftex-ref-style-list
+            reftex-ref-style-default-list)))
 
     ;; Return t if the symbols did already exist, nil when we've made them.
     (not newflag)))
 
 (defun reftex-untie-multifile-symbols ()
-  ;; Remove ties from multifile symbols, so that next use makes new ones.
+  "Remove ties from multifile symbols, so that next use makes new ones."
   (let ((symlist reftex-multifile-symbols)
         (symbol nil))
     (while symlist
@@ -761,7 +499,7 @@
 This function makes it possible to support RefTeX from AUCTeX style files.
 The entries in ENTRY-LIST will be processed after the user settings in
 `reftex-index-entries', and before the defaults.  Any changes made to
-`reftex-label-alist-style' will raise a flag to the effect that
+`reftex-index-macros-style' will raise a flag to the effect that
 the label information is recompiled on next use."
   (unless reftex-docstruct-symbol
     (reftex-tie-multifile-symbols))
@@ -783,6 +521,52 @@
       (when changed
         (put reftex-docstruct-symbol 'reftex-index-macros-style list)))))
 
+(defun reftex-ref-style-activate (style)
+  "Activate the referencing style STYLE."
+  (reftex-ref-style-toggle style 'activate))
+
+(defun reftex-ref-style-toggle (style &optional action)
+  "Activate or deactivate the referencing style STYLE.
+With the optional argument ACTION a certain action can be forced.
+The symbol `activate' will activate the style and `deactivate'
+will deactivate it."
+  (unless reftex-docstruct-symbol
+    (reftex-tie-multifile-symbols))
+  (when (and reftex-docstruct-symbol
+             (symbolp reftex-docstruct-symbol))
+    (let ((list (get reftex-docstruct-symbol 'reftex-ref-style-list))
+          changed)
+      (cond ((eq action 'activate)
+            (unless (member style list)
+              (setq reftex-tables-dirty t
+                    changed t)
+              (add-to-list 'list style t)))
+           ((eq action 'deactivate)
+            (when (member style list)
+              (setq reftex-tables-dirty t
+                    changed t)
+              (delete style list)))
+           (t
+            (if (member style list)
+                (delete style list)
+              (add-to-list 'list style t))
+            (setq reftex-tables-dirty t
+                  changed t)))
+      (when changed
+        (put reftex-docstruct-symbol 'reftex-ref-style-list list)))))
+
+(defun reftex-ref-style-list ()
+  "Return the list of referencing styles to be active at the moment."
+  ;; Initialize the value of `reftex-ref-style-list' and tie it to the
+  ;; docstruct symbol if necessary.
+  (unless reftex-docstruct-symbol
+    (reftex-tie-multifile-symbols))
+  (if (and reftex-docstruct-symbol
+           (symbolp reftex-docstruct-symbol)
+           (get reftex-docstruct-symbol 'reftex-ref-style-list))
+      (get reftex-docstruct-symbol 'reftex-ref-style-list)
+    reftex-ref-style-default-list))
+
 ;;; =========================================================================
 ;;;
 ;;; Functions to compile the tables, reset the mode etc.
@@ -1282,8 +1066,8 @@
     ;; Calculate the regular expressions
     (let* (
 ;          (wbol "\\(\\`\\|[\n\r]\\)[ \t]*")
-           (wbol "\\(^\\)[ \t]*")  ; Need to keep the empty group because
-                                  ;;; because match number are hard coded
+           (wbol "\\(^\\)[ \t]*") ; Need to keep the empty group because
+                                  ; match numbers are hard coded
            (label-re (concat "\\(?:"
                             ;; Normal \label{...}
                             "\\\\label{\\([^}]*\\)}"
@@ -1299,10 +1083,16 @@
                                           reftex-include-file-commands "\\|")
                                "\\)[{ \t]+\\([^} \t\n\r]+\\)"))
            (section-re
+           ;; Including `\' as a character to be matched at the end
+           ;; of the regexp will allow stuff like
+           ;; \begin{foo}\label{bar} to be matched.  This will make
+           ;; the parser to advance one char too much.  Therefore
+           ;; `reftex-parse-from-file' will step one char back if a
+           ;; section is found.
             (concat wbol "\\\\\\("
                     (mapconcat (lambda (x) (regexp-quote (car x)))
                                reftex-section-levels-all "\\|")
-                    "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n]"))
+                    "\\)\\*?\\(\\[[^]]*\\]\\)?[[{ \t\r\n\\]"))
            (appendix-re (concat wbol "\\(\\\\appendix\\)"))
            (macro-re
             (if macros-with-labels
@@ -1780,9 +1570,18 @@
         "In unfinished selection process. Finish, or abort with 
\\[abort-recursive-edit]"))))
 
 (defun reftex-in-comment ()
+  "Return non-nil if point is in a comment."
   (save-excursion
-    (skip-chars-backward "^%\n\r")
-    (eq (preceding-char) ?%)))
+    (save-match-data
+      (let ((pos (point)))
+       (beginning-of-line)
+       (re-search-forward
+        (or comment-start-skip
+            ;; The parser may open files in fundamental mode if
+            ;; `reftex-initialize-temporary-buffers' is nil, so here
+            ;; is a default suitable for plain TeX and LaTeX.
+            "\\(\\(^\\|[^\\\n]\\)\\(\\\\\\\\\\)*\\)\\(%+[ \t]*\\)")
+        pos t)))))
 
 (defun reftex-no-props (string)
   ;; Return STRING with all text properties removed
@@ -1996,6 +1795,7 @@
                  (condition-case nil (scroll-down) (error nil))
                  (message "%s" prompt))
                 (t (message "")
+                  (reftex-kill-buffer "*RefTeX Select*")
                    (throw 'exit char)))
           (setq char (read-char-exclusive)))))))
 
@@ -2123,25 +1923,95 @@
       (setq list (cdr list)))
     (nreverse rtn)))
 
-(defun reftex-uniquify (list)
-  ;; Return a list of all elements in LIST, but each only once, keeping order
-  (let (new elm)
-    (while list
-      (setq elm (pop list))
-      (unless (member elm new)
-        (push elm new)))
-    (nreverse new)))
+(defun reftex-uniquify (list &optional sort)
+  ;; Return a list of all strings in LIST, but each only once, keeping order
+  ;; unless SORT is set (faster!).
+  (setq list (copy-sequence list))
+  (if sort
+      (progn
+       (setq list (sort list 'string<))
+       (let ((p list))
+         (while (cdr p)
+           (if (string= (car p) (car (cdr p)))
+               (setcdr p (cdr (cdr p)))
+             (setq p (cdr p)))))
+       list)
+    (let ((p list) lst elt)
+      ;; push all sublists into lst in reverse(!) order
+      (while p
+       (push p lst)
+       (setq p (cdr p)))
+      ;; sort all sublists
+      (setq lst (sort lst (lambda (x1 x2) (string< (car x1) (car x2)))))
+      (while (cdr lst)
+       (setq elt (car (car lst)))
+       ;; for equal elements in the sorted sublist, replace the
+       ;; last(!) original list member with nil
+       (when (string= elt (car (cadr lst)))
+         (setcar (pop lst) nil)
+         (while (and (cdr lst) (string= elt (car (cadr lst))))
+           (setcar (pop lst) nil)))
+       (pop lst)))
+    ;; weed out all nils and return.
+    (delq nil list)))
 
-(defun reftex-uniquify-by-car (alist &optional keep-list)
+(defun reftex-uniquify-by-car (alist &optional keep-list sort)
   ;; Return a list of all elements in ALIST, but each car only once.
   ;; Elements of KEEP-LIST are not removed even if duplicate.
-  (let (new elm)
-    (while alist
-      (setq elm (pop alist))
-      (if (or (member (car elm) keep-list)
-              (not (assoc (car elm) new)))
-          (push elm new)))
-    (nreverse new)))
+  ;; The order is kept unless SORT is set (faster!).
+  (setq keep-list (sort (copy-sequence keep-list) #'string<)
+       alist (copy-sequence alist))
+  (if sort
+      (let (lst elt)
+       (setq alist (sort alist (lambda(a b) (string< (car a) (car b)))))
+       (setq lst alist)
+       (while (cdr lst)
+         (setq elt (car (car lst)))
+         (when (string= elt (car (cadr lst)))
+           (while (and keep-list (string< (car keep-list) elt))
+             (pop keep-list))
+           (if (and keep-list (string= elt (car keep-list)))
+               (progn
+                 (pop lst)
+                 (while (and (cdr lst)
+                             (string= elt (car (cadr lst))))
+                   (pop lst)))
+             (setcdr lst (cdr (cdr lst)))
+             (while (and (cdr lst)
+                         (string= elt (car (cadr lst))))
+               (setcdr lst (cdr (cdr lst))))))
+         (pop lst))
+       alist)
+    (let ((p alist) lst elt)
+      (while p
+       (push p lst)
+       (setq p (cdr p)))
+      (setq lst (sort lst (lambda(a b) (string< (car (car a))
+                                               (car (car b))))))
+      (while (cdr lst)
+       (setq elt (car (car (car lst))))
+       (when (string= elt (car (car (cadr lst))))
+         (while (and keep-list (string< (car keep-list) elt))
+           (pop keep-list))
+         (if (and keep-list (string= elt (car keep-list)))
+             (progn
+               (pop lst)
+               (while (and (cdr lst)
+                           (string= elt (car (car (cadr lst)))))
+                 (pop lst)))
+           (setcar (pop lst) nil)
+           (while (and (cdr lst)
+                       (string= elt (car (car (cadr lst)))))
+             (setcar (pop lst) nil))))
+       (pop lst)))
+    (delq nil alist)))
+
+(defun reftex-remove-if (predicate list)
+  "Nondestructively remove all items from LIST which satisfy PREDICATE."
+  (let (result)
+    (dolist (elt list (nreverse result))
+      (unless (funcall predicate elt)
+       (push elt result)))))
 
 (defun reftex-abbreviate-title (string)
   (reftex-convert-string string "[-~ \t\n\r,;]" nil t t
@@ -2243,6 +2113,7 @@
    ((= (length text) 0) (make-string 1 ?\ ))
    (t text)))
 
+
 ;;; =========================================================================
 ;;;
 ;;; Fontification and Highlighting
@@ -2390,28 +2261,20 @@
  "bibtex"
  '(define-key bibtex-mode-map "\C-c&" 'reftex-view-crossref-from-bibtex))
 
-;; If the user requests so, she can have a few more bindings:
 ;; For most of these commands there are already bindings in place.
 ;; Setting `reftex-extra-bindings' really is only there to spare users
 ;; the hassle of defining bindings in the user space themselves.  This
 ;; is why they violate the key binding recommendations.
-(defvar reftex-extra-bindings-map
-  (let ((map (make-sparse-keymap)))
-    (define-key map "t" 'reftex-toc)
-    (define-key map "l" 'reftex-label)
-    (define-key map "r" 'reftex-reference)
-    (define-key map "c" 'reftex-citation)
-    (define-key map "v" 'reftex-view-crossref)
-    (define-key map "g" 'reftex-grep-document)
-    (define-key map "s" 'reftex-search-document)
-    map)
-  "Reftex extra bindings map")
-
 (when reftex-extra-bindings
-  (define-key reftex-mode-map
-    reftex-extra-bindings-prefix
-    reftex-extra-bindings-map))
-
+  (loop for x in
+        '(("\C-ct" . reftex-toc)
+          ("\C-cl" . reftex-label)
+          ("\C-cr" . reftex-reference)
+          ("\C-cc" . reftex-citation)
+          ("\C-cv" . reftex-view-crossref)
+          ("\C-cg" . reftex-grep-document)
+          ("\C-cs" . reftex-search-document))
+        do (define-key reftex-mode-map (car x) (cdr x))))
 
 ;;; =========================================================================
 ;;;
@@ -2488,21 +2351,22 @@
      :style radio :selected (eq reftex-auto-view-crossref 'window)]
     "--"
     "MISC"
-    ["AUC TeX Interface" reftex-toggle-plug-into-AUCTeX
+    ["AUCTeX Interface" reftex-toggle-plug-into-AUCTeX
      :style toggle :selected reftex-plug-into-AUCTeX]
     ["isearch whole document" reftex-isearch-minor-mode
      :style toggle :selected reftex-isearch-minor-mode])
    ("Reference Style"
-    ["Default" (setq reftex-vref-is-default nil
-                     reftex-fref-is-default nil)
-     :style radio :selected (not (or reftex-vref-is-default
-                                     reftex-fref-is-default))]
-    ["Varioref" (setq reftex-vref-is-default t
-                      reftex-fref-is-default nil)
-     :style radio :selected reftex-vref-is-default]
-    ["Fancyref" (setq reftex-fref-is-default t
-                      reftex-vref-is-default nil)
-     :style radio :selected reftex-fref-is-default])
+    ,@(let (list item)
+       (dolist (elt reftex-ref-style-alist)
+         (setq elt (car elt)
+               item (vector
+                     elt
+                     `(reftex-ref-style-toggle ,elt)
+                     :style 'toggle
+                     :selected `(member ,elt (reftex-ref-style-list))))
+         (unless (member item list)
+           (add-to-list 'list item t)))
+       list))
    ("Citation Style"
     ,@(mapcar
        (lambda (x)
@@ -2568,6 +2432,9 @@
         (message "\"Ref\"-menu now contains full customization menu"))
     (error "Cannot expand menu (outdated version of cus-edit.el)")))
 
+
+;;; Misc
+
 (defun reftex-show-commentary ()
   "Use the finder to view the file documentation from `reftex.el'."
   (interactive)
@@ -2579,6 +2446,36 @@
   (interactive)
   (info (format "(reftex)%s" (or node ""))))
 
+(defun reftex-report-bug ()
+  "Report a bug in RefTeX.
+
+Don't hesitate to report any problems or inaccurate documentation.
+
+If you don't have setup sending mail from (X)Emacs, please copy the
+output buffer into your mail program, as it gives us important
+information about your RefTeX version and configuration."
+  (interactive)
+  (require 'reporter)
+  (let ((reporter-prompt-for-summary-p "Bug report subject: "))
+    (reporter-submit-bug-report
+     "address@hidden"
+     reftex-version
+     (list 'window-system
+          'reftex-plug-into-AUCTeX)
+     nil nil
+     "Remember to cover the basics, that is, what you expected to happen and
+what in fact did happen.
+
+Check if the bug is reproducable with an up-to-date version of
+RefTeX available from http://www.gnu.org/software/auctex/.
+
+If the bug is triggered by a specific \(La\)TeX file, you should try
+to produce a minimal sample file showing the problem and include it
+in your report.
+
+Your bug report will be posted to the AUCTeX bug reporting list.
+------------------------------------------------------------------------")))
+
 ;;; Install the kill-buffer and kill-emacs hooks ------------------------------
 
 (add-hook 'kill-buffer-hook 'reftex-kill-buffer-hook)
@@ -2594,6 +2491,4 @@
 (setq reftex-tables-dirty t)  ; in case this file is evaluated by hand
 (provide 'reftex)
 
-;;;============================================================================
-
 ;;; reftex.el ends here


reply via email to

[Prev in Thread] Current Thread [Next in Thread]