]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from standalone RefTeX repository.
authorRalf Angeli <angeli@caeruleus.net>
Sun, 30 Sep 2012 20:30:13 +0000 (22:30 +0200)
committerRalf Angeli <angeli@caeruleus.net>
Sun, 30 Sep 2012 20:30:13 +0000 (22:30 +0200)
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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* lisp/reftex-cite.el
(reftex-extract-bib-entries-from-thebibliography): Use
`with-current-buffer'.

2010-09-14  Ralf Angeli  <angeli@caeruleus.net>

* lisp/reftex-cite.el (reftex-do-citation): Make it possible again
to insert non-existent entries.

2010-01-30  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* lisp/reftex-base.el (reftex-in-comment): Do not error out if
`comment-start-skip' is not set.

2009-03-01  Wolfgang Mayer  <wmayer7@gmail.com>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* lisp/reftex-base.el (reftex-in-comment): Deal correctly with
escaped comment characters.

2008-11-30  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* doc/reftex.texi (Referencing Labels, Reference Styles): Document
changes in the referencing functionality.

2008-10-15  Ralf Angeli  <angeli@caeruleus.net>

* 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  <dak@gnu.org>

* lisp/reftex-base.el (reftex-remove-if): Improve performance.

2008-06-07  Ralf Angeli  <angeli@caeruleus.net>

* 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  <wmayer7@gmail.com>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* lisp/reftex-vars.el: Some whitespace, doc and checkdoc fixes.

2008-03-16  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* doc/reftex.texi (Options (Defining Label Environments)): Fix
typo.

2007-07-22  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* doc/reftex.texi (Citation Styles): Correct some mistakes.

2007-04-03  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* doc/reftex.texi: Replace BibTeX by @BibTeX{} throughout the
file.

2007-03-12  John Paul Wallington  <jpw@pobox.com>

* lisp/reftex-vars.el (reftex-format-ref-function)
(reftex-format-cite-function): Fix custom type.

2007-03-10  Ralf Angeli  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* 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  <dak@gnu.org>

* 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  <angeli@caeruleus.net>

* 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  <angeli@caeruleus.net>

* doc/reftex.texi: Set correct filename for standalone
distribution.

2007-02-07  Ralf Angeli  <angeli@caeruleus.net>

Create `reftex' module.

14 files changed:
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

index 2e48b61def9aa79aa1a3d1f89c0fff88acec3b5f..c30e2282fce71d990591e3e1e666f1d3480ff144 100644 (file)
@@ -1,3 +1,34 @@
+2012-09-30  Ralf Angeli  <angeli@caeruleus.net>
+
+       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  <Stromeko@Stromeko.DE>
 
        * org.texi: Add description of ORG_ADD_CONTRIB to info
index 69092093af8c7bd84d7958bb1961a364277c8978..c7efa875dc7647a022d4fae4b1c711bbcc4236fe 100644 (file)
@@ -6,26 +6,44 @@
 @syncodeindex vr cp
 @syncodeindex fn cp
 
-@c Version and Contact Info
-@set VERSION 4.31
-@set EDITION 4.31
-@set DATE February 2006
-@set AUCTEXSITE @uref{http://www.gnu.org/software/auctex/,AUCTeX distribution site}
-@set MAINTAINERSITE @uref{http://www.gnu.org/software/auctex/reftex.html,Ref@TeX{} web page}
+@ifnottex
+@macro RefTeX {}
+Ref@TeX{}
+@end macro
+@macro AUCTeX {}
+AUC@TeX{}
+@end macro
+@macro BibTeX {}
+Bib@TeX{}
+@end macro
+@macro ConTeXt {}
+Con@TeX{}t
+@end macro
+@end ifnottex
+@tex
+\gdef\RefTeX{Ref\TeX}
+\gdef\AUCTeX{AUC\TeX}
+\gdef\BibTeX{Bib\TeX}
+\gdef\ConTeXt{Con\TeX t}
+@end tex
+
+@include ../emacs/emacsver.texi
+
+@set VERSION @value{EMACSVER}
+@set AUCTEXSITE @uref{http://www.gnu.org/software/auctex/,@AUCTeX{} web site}
+@set MAINTAINERSITE @uref{http://www.gnu.org/software/auctex/reftex.html,@RefTeX{} web page}
 @set MAINTAINERCONTACT @uref{mailto:auctex-devel@@gnu.org,contact the maintainers}
-@set MAINTAINER the AUC@TeX{} project
-@set SUPPORTADDRESS AUC@TeX{} user mailing list (@email{auctex@@gnu.org})
-@set DEVELADDRESS AUC@TeX{} developer mailing list (@email{auctex-devel@@gnu.org})
-@set BUGADDRESS AUC@TeX{} bug mailing list (@email{bug-auctex@@gnu.org})
-@set XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs ftp site}
+@set MAINTAINER the @AUCTeX{} project
+@set SUPPORTADDRESS @AUCTeX{} user mailing list (@email{auctex@@gnu.org})
+@set DEVELADDRESS @AUCTeX{} developer mailing list (@email{auctex-devel@@gnu.org})
+@set BUGADDRESS @AUCTeX{} bug mailing list (@email{bug-auctex@@gnu.org})
+@set XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs FTP site}
 @c %**end of header
 
 @copying
-This file documents @b{Ref@TeX{}}, a package to do labels, references,
-citations and indices for LaTeX documents with Emacs.
-
-This is edition @value{EDITION} of the @b{Ref@TeX{}} User Manual for
-@b{Ref@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 @@ developing GNU and promoting software freedom.''
 @end macro
 
 @titlepage
-@title Ref@TeX{} User Manual
-@subtitle Support for LaTeX labels, references, citations and index entries with GNU Emacs
-@subtitle Edition @value{EDITION}, @value{DATE}
+@title @RefTeX{} User Manual
+@subtitle Support for @LaTeX{} labels, references, citations and index entries with GNU Emacs
+@subtitle Version @value{VERSION}
 
 @author by Carsten Dominik
 @page
@@ -79,18 +97,17 @@ developing GNU and promoting software freedom.''
 
 @ifnottex
 @node Top,,,(dir)
-@top RefTeX
+@top @RefTeX{}
 
-@b{Ref@TeX{}} is a package for managing Labels, References,
-Citations and index entries with GNU Emacs.
+@RefTeX{} 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
-@b{Ref@TeX{}} in great depth.  All you need to know to use
-@b{Ref@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.
+This manual documents @RefTeX{} version @value{VERSION}.
 
-@insertcopying
+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 @@ needed.
 * 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 @@ The Index
 * Index::                            The full index.
 
 @detailmenu
+ --- The Detailed Node Listing ---
 
 Introduction
 
@@ -136,9 +154,8 @@ Labels and References
 * 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 @@ The Index Phrases File
 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 @@ Options, Keymaps, Hooks
 @chapter Introduction
 @cindex Introduction
 
-@b{Ref@TeX{}} is a specialized package for support of labels,
-references, citations, and the index in LaTeX.  @b{Ref@TeX{}} 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.  @b{Ref@TeX{}} 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.
+@RefTeX{} is a specialized package for support of labels, references,
+citations, and the index in @LaTeX{}.  @RefTeX{} wraps itself round four
+@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.
+@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.
 
 @iftex
-Don't be discouraged by the size of this manual, which covers @b{Ref@TeX{}}
-in great depth.  All you need to know to use @b{Ref@TeX{}} 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 @@ reports or suggestions.
 @section Installation
 @cindex Installation
 
-@b{Ref@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.
+@RefTeX{} 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) can get a copy
-of the @b{Ref@TeX{}} distribution from the maintainers web-page.
-@xref{Imprint}, for more information.
+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.
 
-@section 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
+@subsection Building and Installing
 
-@b{Ref@TeX{}} needs to access all files which are part of a multifile
-document, and the BibTeX database files requested by the
-@code{\bibliography} command.  To find these files, @b{Ref@TeX{}} 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
-@code{BIBINPUTS} which are also used by @b{Ref@TeX{}}.  However, on some
-systems these variables do not contain the full search path.  If
-@b{Ref@TeX{}} does not work for you because it cannot find some files,
-read @ref{Finding Files}.
+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.
+
+@subsubheading 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 
+
+@example
+make
+make install
+@end 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.
+
+@example
+(add-to-list 'load-path "/path/to/reftex")
+@end example
 
-@section Entering @b{Ref@TeX{}} Mode
+Put this command into your init file before other @RefTeX{}-related
+settings.
+
+@subsubheading Installation by Hand
+
+If you want to get your hands dirty, there is also the possibility to
+install by manually copying files.
+
+@enumerate a
+@item
+Copy the reftex*.el lisp files to a directory on your load path.  Make
+sure that no old copy of @RefTeX{} shadows these files.
+@item
+Byte compile the files.  The sequence of compiling should be:
+reftex-var.el, reftex.el, and then all the others.
+@item
+Copy the info file reftex.info to the info directory.
+@end enumerate
+
+@subsection Loading @RefTeX{}
+
+In order to make the most important functions for entering @RefTeX{}
+mode available add the following line to your init file.
+
+@example
+(require 'reftex)
+@end example
+
+@subsection Entering @RefTeX{} Mode
 
 @findex turn-on-reftex
 @findex reftex-mode
 @vindex LaTeX-mode-hook
 @vindex latex-mode-hook
-To turn @b{Ref@TeX{}} Mode on and off in a particular buffer, use
-@kbd{M-x reftex-mode}.  To turn on @b{Ref@TeX{}} Mode for all LaTeX
-files, add the following lines to your @file{.emacs} file:
+To turn @RefTeX{} Mode on and off in a particular buffer, use
+@kbd{M-x reftex-mode @key{RET}}.  To turn on @RefTeX{} Mode for all
+LaTeX files, add the following lines to your @file{.emacs} file:
 
 @example
 (add-hook 'LaTeX-mode-hook 'turn-on-reftex)   ; with AUCTeX LaTeX mode
 (add-hook 'latex-mode-hook 'turn-on-reftex)   ; with Emacs latex mode
 @end 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
+@code{make 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.
+
+@subsection 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
+
+@RefTeX{} needs to access all files which are part of a multifile
+document, and the BibTeX database files requested by the
+@code{\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 @code{TEXINPUTS} and
+@code{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,
+@xref{Finding Files}.
+
 @page
 @node RefTeX in a Nutshell, , Installation, Introduction
-@section @b{Ref@TeX{}} in a Nutshell
+@section @RefTeX{} in a Nutshell
 @cindex Quick-Start
 @cindex Getting Started
 @cindex RefTeX in a Nutshell
@@ -289,7 +377,7 @@ can jump quickly to every part of your document.  Press @kbd{?} to get
 help.
 
 @item
-@b{Labels and References}@* @b{Ref@TeX{}} helps to create unique labels
+@b{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
@@ -300,7 +388,7 @@ additional labeled environments you have defined yourself (variable
 @item
 @b{Creating Labels}@*
 Type @kbd{C-c (} (@code{reftex-label}) to insert a label at point.
-@b{Ref@TeX{}} will either
+@RefTeX{} will either
 @itemize @minus
 @item
 derive a label from context (default for section labels)
@@ -325,7 +413,7 @@ into the original buffer.
 @item
 @b{Citations}@*
 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 @samp{\cite@{@var{key}@}}
@@ -334,9 +422,9 @@ different macros).
 
 @item
 @b{Index Support}@*
-@b{Ref@TeX{}} helps to enter index entries.  It also compiles all
+@RefTeX{} 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.  @b{Ref@TeX{}} 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 @@ and enter the arguments with completion.
 @b{The Index Phrases File (Delayed Indexing)}@*
 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}.
-@b{Ref@TeX{}} can later search the document for occurrences of these
+@RefTeX{} can later search the document for occurrences of these
 phrases and let you interactively index the matches.
 
 @item
@@ -366,11 +454,11 @@ all entries.
 
 @page
 @item @b{Viewing Cross-References}@*
-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},
-@code{\index}, and variations) or inside a BibTeX database entry, you
+@code{\index}, 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 @@ will automatically be displayed in the echo area.
 @b{Multifile Documents}@*
 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.  @b{Ref@TeX{}} 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
-@b{Document Parsing}@* @b{Ref@TeX{}} needs to parse the document in
+@b{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 @code{reftex-label} and
 @code{reftex-index} are used.  To enforce reparsing, call any of the
@@ -394,20 +482,20 @@ commands described above with a raw @kbd{C-u} prefix, or press the
 buffer, or the index buffer.
 
 @item
-@b{AUCTeX} @* If your major LaTeX mode is AUCTeX, @b{Ref@TeX{}} can
-cooperate with it (see variable @code{reftex-plug-into-AUCTeX}).  AUCTeX
+@b{@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
-@b{Ref@TeX{}}, so that for many of the popular LaTeX packages no
+@RefTeX{}, so that for many of the popular @LaTeX{} packages no
 additional customizations will be necessary.
 
 @item
 @b{Useful Settings}@*
-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 @b{Ref@TeX{}},
+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 @@ customize the variables
 @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
-@b{Ref@TeX{}}.
+an @AUCTeX{} style file to support them with both @AUCTeX{} and
+@RefTeX{}.
 
-@item @b{Where Next?}@* Go ahead and use @b{Ref@TeX{}}.  Use its menus
+@item @b{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 @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 @b{Ref@TeX{}}.  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 @@ Prefix argument.
 
 @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 @@ always show the location corresponding to the line at point in the
 @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.  @b{Ref@TeX{}} 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 @@ Show calling point in another window.  This is the point from where
 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, @b{Ref@TeX{}} 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 @@ variable @code{reftex-toc-include-file-boundaries}.
 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,
-@b{Ref@TeX{}} will prompt for a label type and include only labels of
+@RefTeX{} 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 @@ indicator shows which labels are included.
 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, @b{Ref@TeX{}} 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 @@ document.
 
 @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 non-@code{nil}, 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)}), @b{Ref@TeX{}} will switch to one of the external
+package)}), @RefTeX{} will switch to one of the external
 documents.
 
 
@@ -669,11 +757,11 @@ recentering of the TOC window on the current frame with
 @cindex LaTeX classes, KOMA-Script
 @cindex TOC entries for environments
 @vindex reftex-section-levels
-The section macros recognized by @b{Ref@TeX{}} 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
-@code{reftex-section-levels}.  It is also possible to add certain LaTeX
+@code{reftex-section-levels}.  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 @@ example.
 @cindex Label environment
 @cindex @code{\label}
 
-LaTeX provides a powerful mechanism to deal with cross--references in a
+@LaTeX{} 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 @samp{\label@{mark@}}.  LaTeX records the current value of a
+label, like @samp{\label@{mark@}}.  @LaTeX{} records the current value of a
 certain counter when a label is defined.  Later references to this label
 (like @samp{\ref@{mark@}}) 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
-@code{eqnarray} environments record the value of the same counter - the
+a common label category.  For example labels in both @code{equation} and
+@code{eqnarray} environments record the value of the same counter -- the
 equation counter.
 
 @menu
@@ -709,9 +797,8 @@ equation counter.
 * 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 @@ equation counter.
 @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, @b{Ref@TeX{}} 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.  @b{Ref@TeX{}} 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 @@ indicating the type of the label and a unique mark.  @b{Ref@TeX{}} has
 @vindex reftex-derive-label-parameters
 @vindex reftex-label-illegal-re
 @vindex reftex-abbrev-parameters
-A label can be derived from context.  This means, @b{Ref@TeX{}} takes
+A label can be derived from context.  This means, @RefTeX{} takes
 the context of the label definition and constructs a label from
 that@footnote{Note that the context may contain constructs which are
-invalid in labels.  @b{Ref@TeX{}} 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 @@ change things: @code{reftex-translate-to-ascii-function},
 @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,
-@b{Ref@TeX{}}'s default settings use this method only for section
+@RefTeX{}'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.  @b{Ref@TeX{}}'s default settings use this method
-for equations, enumerate items and footnotes.  The author of @b{Ref@TeX{}}
+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 @b{Ref@TeX{}} 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.  @b{Ref@TeX{}} 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
 @samp{\label@{mark@}}.  The advantage of using @code{reftex-label}
-anyway is that @b{Ref@TeX{}} 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 @@ If you want to change the way certain labels are created, check out the
 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
-@b{Ref@TeX{}}. @xref{AUCTeX}, for more information.
+@RefTeX{}. @xref{AUCTeX}, for more information.
 
 @node Referencing Labels, Builtin Label Environments, Creating Labels, Labels and References
 @section Referencing Labels
@@ -792,24 +879,31 @@ set it up to delegate the creation of labels to
 @findex reftex-reference
 
 @vindex reftex-trust-label-prefix
-@b{Ref@TeX{}} scans the document in order to find all labels.  To make
+@RefTeX{} 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 @b{Ref@TeX{}}.  Press @kbd{C-c
-)} in order to reference a label (reftex-reference).  This will start a
-selection process and finally insert the complete @samp{\ref@{label@}}
-into the buffer.
+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
+@samp{\ref@{label@}} into the buffer.
+
+@vindex 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}.
 
-First, @b{Ref@TeX{}} 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 )}, @b{Ref@TeX{}} 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.
+Then, @RefTeX{} 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 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 @@ sufficient to identify the label.  If you are unsure about a certain
 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 @@ window.  See also the @kbd{f} key.
 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 @@ references all marked labels.
 @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},
+@ref{Options (Misc)}.
 
 @vindex reftex-multiref-punctuation
 @item m - + ,
@@ -923,26 +1017,15 @@ Enter a label with completion.  This may also be a label which does not
 yet exist in the document.
 
 @item v
-@cindex @code{varioref}, LaTeX package
-@cindex @code{\vref}
-@cindex LaTeX packages, @code{varioref}
-Toggle between @code{\ref} and @code{\vref} macro for references.  The
-@code{\vref} macro is defined in the @code{varioref} LaTeX package.
-With this key you can force @b{Ref@TeX{}} 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
+@LaTeX{} packages like @code{varioref} or @code{fancyref} and want to
+use the special referencing macros they provide (e.g. @code{\vref} or
+@code{\fref}) instead of @code{\ref}.
 
 @item V
-@cindex @code{fancyref}, LaTeX package
-@cindex @code{\fref}
-@cindex @code{\Fref}
-@cindex LaTeX packages, @code{fancyref}
-Cycle between @code{\ref}, @code{\fref} and @code{\Fref}.  The
-@code{\fref} and @code{\Fref} macros are defined in the @code{fancyref}
-LaTeX package.  With this key you can force @b{Ref@TeX{}} to insert a
-@code{\fref} 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 @@ selection buffer.
 @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 @@ Toggle the display of a label counter in the selection buffer.
 @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, @b{Ref@TeX{}} 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 @@ Switch the label category.  After prompting for another label category,
 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 @@ keymap @code{reftex-select-label-map} may be used.
 @vindex reftex-label-alist
 @vindex reftex-label-alist-builtin
 
-@b{Ref@TeX{}} needs to be aware of the environments which can be referenced
-with a label (i.e. which carry their own counters).  By default, @b{Ref@TeX{}}
+@RefTeX{} 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
+@LaTeX{} Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
 1994.}.  These are:
 
 @itemize @minus
@@ -1038,7 +1121,7 @@ LaTeX Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
 @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 @@ the LaTeX core stuff)
 @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 AMS-@LaTeX{}'s @file{amsmath.sty} package)
 @item
 @cindex @code{endnote}, LaTeX package
 @cindex LaTeX packages, @code{endnote}
@@ -1112,7 +1195,7 @@ the @code{\endnote} macro (from @file{endnotes.sty})
 @end itemize
 
 If you want to use other labeled environments, defined with
-@code{\newtheorem}, @b{Ref@TeX{}} needs to be configured to recognize
+@code{\newtheorem}, @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 @@ them (@pxref{Defining Label Environments}).
 @cindex Label environments, defining
 
 @vindex reftex-label-alist
-@b{Ref@TeX{}} can be configured to recognize additional labeled
+@RefTeX{} 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 @@ Environments}).
 * 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 AMS-@LaTeX{} macro.
 * Non-Standard Environments::        Environments without \begin and \end
 * Putting it Together::              How to combine many entries.
 @end menu
@@ -1154,7 +1237,7 @@ Environments}).
 @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 @@ to be used like this:
 \end@{axiom@}
 @end example
 
-So we need to tell @b{Ref@TeX{}} 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 @@ library.  With Lisp it would look like this
 @end lisp
 
 The type indicator characters @code{?a} and @code{?h} are used for
-prompts when @b{Ref@TeX{}} 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 @@ was chosen for @code{theorem} since @code{?t} is already taken by
 @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.
+@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.
 
 @lisp
 (add-hook 'LaTeX-mode-hook
@@ -1226,9 +1309,9 @@ Environments)}).
 @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 )},
-@b{Ref@TeX{}} will know that you are looking for a theorem label and
+@RefTeX{} 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 @@ and used like this:
 Einstein's equation is \quickeq@{E=mc^2 \label@{eq:einstein@}@}.
 @end example
 
-We need to tell @b{Ref@TeX{}} 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 @@ The first element in this list is now the macro with empty braces as an
 @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 @@ which would be called like
 \myfig[htp]@{filename@}@{caption text@}@{label@}@{1@}
 @end example
 
-Now we need to tell @b{Ref@TeX{}} 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 @@ The empty pairs of brackets indicate the different arguments of the
 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 @@ predefined label categories.
 
 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 AMS-@LaTeX{}, you might
 prefer @code{\eqref} for doing equation references.  Here is how to
 do this:
 
@@ -1428,7 +1511,7 @@ do this:
 (setq reftex-label-alist '((nil ?e nil "~\\eqref@{%s@}" nil nil)))
 @end lisp
 
-@b{Ref@TeX{}} has also a predefined symbol for this special purpose.  The
+@RefTeX{} has also a predefined symbol for this special purpose.  The
 following is equivalent to the line above.
 
 @lisp
@@ -1436,7 +1519,7 @@ following is equivalent to the line above.
 @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 @@ this configuration will not be necessary.
 @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.  @b{Ref@TeX{}} 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 @@ terminated by @samp{\z.} or by an empty line.
 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 @b{Ref@TeX{}}.
+for @RefTeX{}.
 
 @lisp
 (setq reftex-label-alist
@@ -1558,7 +1641,7 @@ the entries described above:
     (detect-linguex ?x "ex:" "~\\ref@{%s@}" nil ("Example" "Ex."))))
 @end lisp
 
-@node Reference Info, xr (LaTeX package), Defining Label Environments, Labels and References
+@node 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 @@ information about the label referenced there.  Note that the information
 is only displayed if the echo area is not occupied by a different
 message.
 
-@b{Ref@TeX{}} can also display the label definition corresponding to a
+@RefTeX{} 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.
 
-@node xr (LaTeX package), varioref (LaTeX package), Reference Info, Labels and References
+@node Reference Styles, xr (LaTeX package), Reference Info, Labels and References
+@section Reference Styles
+
+In case you defined your own macros for referencing or you are using
+@LaTeX{} packages providing specialized macros to be used instead of
+@code{\ref}, @RefTeX{} provides ways to select and insert them in a
+convenient way.
+
+@RefTeX{} comes equipped with a set of so-called reference styles where
+each relates to one or more reference macros.  The standard macros
+@samp{\ref} 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},
+@samp{\Fref}) and ``Hyperref'' for the @samp{hyperref} package
+(@samp{\autoref}, @samp{\autopageref}).
+
+@vindex reftex-ref-style-default-list
+A style can be toggled by selecting the respective entry in the
+@samp{Reference 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.
+
+@vindex 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.
+
+@vindex 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
+@code{reftex-ref-style-alist} to fit your liking.
+
+For each entry in @code{reftex-ref-style-alist} a function with the name
+@code{reftex-<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 you.@footnote{You could e.g. bind
+@code{reftex-varioref-vref} to @kbd{C-c v} and
+@code{reftex-fancyref-fref} to @kbd{C-c f}.}
+
+@cindex @code{varioref}, LaTeX package
+@cindex LaTeX packages, @code{varioref}
+@cindex @code{fancyref}, LaTeX package
+@cindex LaTeX packages, @code{fancyref}
+@vindex reftex-vref-is-default (deprecated)
+@vindex reftex-fref-is-default (deprecated)
+In former versions of @RefTeX{} only support for @code{varioref} and
+@code{fancyref} 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 @code{\fref@{@var{fig:map-of-germany}@}}
+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.
+
+@node 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 @@ information.
 @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 @@ and we can make references to any labels defined in these
 external documents by using the prefixes @samp{V1-} and @samp{V3-},
 respectively.
 
-@b{Ref@TeX{}} can be used to create such references as well.  Start the
+@RefTeX{} 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 @b{Ref@TeX{}} 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}).
 
-@node varioref (LaTeX package), fancyref (LaTeX package), xr (LaTeX package), Labels and References
-@section @code{varioref}: Variable Page References
-@cindex @code{varioref}, LaTeX package
-@cindex @code{\vref}
-@cindex LaTeX packages, @code{varioref}
-@vindex reftex-vref-is-default
-@code{varioref} 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
-@code{reftex-varioref-vref}@footnote{bind it to @kbd{C-c v}.}.
-Or use AUCTeX to create your macros (@pxref{AUCTeX}).
-
-@node fancyref (LaTeX package), , varioref (LaTeX package), Labels and References
-@section @code{fancyref}: Fancy Cross References
-@cindex @code{fancyref}, LaTeX package
-@cindex @code{\fref}
-@cindex @code{\Fref}
-@cindex LaTeX packages, @code{fancyref}
-@vindex reftex-fref-is-default
-@code{fancyref} is a LaTeX package where a macro call like
-@code{\fref@{@var{fig:map-of-germany}@}} 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
-@b{Ref@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 @code{reftex-fancyref-Fref}@footnote{bind 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
-@code{thebibliography} environment in the document.  @b{Ref@TeX{}}'s
+article or book in either a @BibTeX{} database file or in an explicit
+@code{thebibliography} environment in the document.  @RefTeX{}'s
 support for citations helps to select the correct key quickly.
 
 @menu
@@ -1684,7 +1815,7 @@ support for citations helps to select the correct key quickly.
 @cindex Selection buffer, citations
 @cindex Selection process
 
-In order to create a citation, press @kbd{C-c [}.  @b{Ref@TeX{}} 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 @@ logic @code{and} for regular expressions. For example
 @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
+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 @@ good search key.
 @cindex @code{thebibliography}, LaTeX environment
 @cindex @code{BIBINPUTS}, environment variable
 @cindex @code{TEXBIB}, environment variable
-@b{Ref@TeX{}} prefers to use BibTeX database files specified with a
+@RefTeX{} 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
+@BibTeX{}, it will search for the specified files in the current directory
 and along the path given in the environment variable @code{BIBINPUTS}.
-If you do not use BibTeX, but the document contains an explicit
-@code{thebibliography} environment, @b{Ref@TeX{}} will collect its
+If you do not use @BibTeX{}, but the document contains an explicit
+@code{thebibliography} 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.
+@BibTeX{} database files.
 
 @kindex ?
 In the selection buffer, the following keys provide special commands.  A
@@ -1743,7 +1874,7 @@ another window.  See also the @kbd{f} key.
 @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 @@ Accept all (marked) entries in the selection buffer and create a
 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 @@ entries.
 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,
+@RefTeX{} 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:
+
+@lisp
+(add-hook 'bibtex-mode-hook 'turn-on-auto-revert-mode)
+@end lisp
+
+
 @node Citation Styles, Citation Info, Creating Citations, Citations
 @section Citation Styles
 @cindex Citation styles
@@ -1821,20 +1963,22 @@ keymap @code{reftex-select-bib-map} may be used.
 @cindex Citation styles, @code{harvard}
 @cindex Citation styles, @code{chicago}
 @cindex Citation styles, @code{jurabib}
+@cindex Citation styles, @ConTeXt{}
 @cindex @code{natbib}, citation style
 @cindex @code{harvard}, citation style
 @cindex @code{chicago}, citation style
 @cindex @code{jurabib}, citation style
+@cindex @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.
-@b{Ref@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},
-@code{jurabib}) this may be done from the menu, under
+@RefTeX{} 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},
+@code{jurabib}) 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 @@ SELECT A CITATION FORMAT
 @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 @@ To make one of these styles the default, customize the variable
 (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.
 
-@node Citation Info, Chapterbib and Bibunits, Citation Styles, Citations, Top
+@node Citation Info, Chapterbib and Bibunits, Citation Styles, Citations
 @section Citation Info
 @cindex Displaying citations
 @cindex Citations, displaying
@@ -1893,9 +2037,9 @@ argument of a @code{\cite} macro, the echo area will display some
 information about the article cited there.  Note that the information is
 only displayed if the echo area is not occupied by a different message.
 
-@b{Ref@TeX{}} can also display the @code{\bibitem} or BibTeX database
+@RefTeX{} 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 @@ corresponding to a @code{\bibitem} or BibTeX database entry.
 @cindex @code{bibunits}, LaTeX package
 @cindex Bibliographies, multiple
 
-@code{chapterbib} and @code{bibunits} are two LaTeX packages which
+@code{chapterbib} and @code{bibunits} are two @LaTeX{} packages which
 produce multiple bibliographies in a document.  This is no problem for
-@b{Ref@TeX{}} as long as all bibliographies use the same BibTeX database
+@RefTeX{} 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
-@b{Ref@TeX{}} will still scan the locally relevant databases correctly.  If
+@RefTeX{} 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
-@section Citations outside LaTeX
+@section 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 @@ binding for @code{reftex-cite-format}.
 @cindex BibTeX database subsets
 @findex reftex-create-bibtex-file
 
-@b{Ref@TeX{}} offers two ways to create a new BibTeX database file.
+@RefTeX{} 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 @@ either the @i{marked} entries (with the @kbd{e} key) or the
 @cindex Index Support
 @cindex @code{\index}
 
-LaTeX has builtin support for creating an Index.  The LaTeX core
+@LaTeX{} 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 @code{\index@{@var{entry}@}} 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 @@ correspond to appropriate index entries.  This part of the index can
 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 @b{Ref@TeX{}}
+reference page in the index bold or underlined.  To make @RefTeX{}
 support for indexing possible, these special macros must be added to
-@b{Ref@TeX{}}'s configuration (@pxref{Defining Index Macros}).
+@RefTeX{}'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.  @b{Ref@TeX{}} 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 @b{Ref@TeX{}} knows about
-the index style being used in the current document.  @b{Ref@TeX{}} 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 @b{Ref@TeX{}} 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 @@ When there is nothing selected and no word at point, this command will
 just call @code{reftex-index}, described below.
 
 In order to create a general index entry, press @kbd{C-c <}
-(@code{reftex-index}).  @b{Ref@TeX{}} 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 @@ to the redefined @code{\index} macro.
 @findex reftex-index-visit-phrases-buffer
 @cindex Macro definition lines, in phrase buffer
 
-@b{Ref@TeX{}} maintains a file in which phrases can be collected for
+@RefTeX{} 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 @@ file of the document and has the extension @file{.rip} (@b{R}eftex
 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 @@ Phrases for indexing can be collected while writing the document.  The
 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 @@ a word list of the document and remove all words which should not be
 indexed.
 
 The phrase lines in the phrase buffer must have a specific format.
-@b{Ref@TeX{}} will use font-lock to indicate if a line has the proper
+@RefTeX{} will use font-lock to indicate if a line has the proper
 format.  A phrase line looks like this:
 
 @example
@@ -2226,7 +2370,7 @@ region and @kbd{C-c C-a} on all phrase lines in the buffer.  It is
 probably good to do indexing in small chunks since your concentration
 may not last long enough to do everything in one go.
 
-@b{Ref@TeX{}} will start at the first phrase line and search the phrase
+@RefTeX{} 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 choices@footnote{Windows
 users: Restrict yourself to the described keys during indexing.  Pressing
@@ -2275,9 +2419,9 @@ sentence, and even typos.  You can always say @emph{no} at a match you
 do not like.
 @item Wrap Long Lines
 Inserting index macros increases the line length.  Turn this option on
-to allow @b{Ref@TeX{}} to wrap long lines.
+to allow @RefTeX{} to wrap long lines.
 @item Skip Indexed Matches
-When this is on, @b{Ref@TeX{}} 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 @@ Even though indexing should be the last thing you do to a document, you
 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 @@ apply @code{reftex-index-all-phrases} to the current region.
 @findex reftex-display-index
 
 In order to compile and display the index, press @kbd{C-c >}.  If the
-document uses multiple indices, @b{Ref@TeX{}} 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 @@ region, make the region active and use a numeric prefix @samp{3} (press
 restriction can be moved from one section to the next by pressing the
 @kbd{<} and @kbd{>} keys.
 
-One caveat: @b{Ref@TeX{}} 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 @@ always show the location corresponding to the line in the @file{*Index*}
 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.  @b{Ref@TeX{}} 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 @@ will move to the correct position.
 
 @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 non-@code{nil}, 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 @@ indices).
 @cindex LaTeX packages, @code{multind}
 @cindex LaTeX packages, @code{index}
 
-@b{Ref@TeX{}} by default recognizes the @code{\index} and
-@code{\glossary} macros which are defined in the LaTeX core.  It has
+@RefTeX{} by default recognizes the @code{\index} and
+@code{\glossary} 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 @@ argument in the text and places it into a separate index with the tag
 @samp{name}@footnote{We 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 @b{Ref@TeX{}} 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 @@ Note that the index tag is @samp{idx} for the main index, and
 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 @b{Ref@TeX{}} 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 @@ in the buffer with @kbd{C-c /} (@code{reftex-index-selection-or-word}).
 The index tag is "idx".
 
 @node Viewing Cross-References, RefTeXs Menu, Index Support, Top
-@chapter Viewing Cross--References
+@chapter Viewing Cross-References
 @findex reftex-view-crossref
 @findex reftex-mouse-view-crossref
 @kindex C-c &
 @kindex S-mouse-2
 
-@b{Ref@TeX{}} can display cross--referencing information.  This means,
-if two document locations are linked, @b{Ref@TeX{}} can display the
+@RefTeX{} 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 @@ individual classes of macros:
 Display the corresponding label definition.  All usual
 variants@footnote{all 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 @@ Display a document location which references this label.  Pressing
 @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 variants@footnote{all macros that either start or end with
-@samp{cite}} of the @code{\cite} macro are active for cross--reference
+@samp{cite}} of the @code{\cite} macro are active for cross-reference
 display.
 
 @item @code{\bibitem}
@@ -2641,12 +2785,12 @@ Display a document location which cites this article. Pressing
 @kbd{C-c &} several times moves through the entire document and finds
 all locations.
 
-@item BibTeX
+@item @BibTeX{}
 @cindex BibTeX buffer, viewing cite locations from
 @cindex Viewing cite locations from BibTeX buffer
-@kbd{C-c &} is also active in BibTeX buffers.  All locations in a
+@kbd{C-c &} 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, @b{Ref@TeX{}} 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 @@ and @code{\glossary} macros, all macros configured in
 
 @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 @@ in the variable @code{reftex-view-crossref-extra}.
 @end iftex
 
 @node RefTeXs Menu, Key Bindings, Viewing Cross-References, Top
-@section @b{Ref@TeX{}}'s Menu
+@section @RefTeX{}'s Menu
 @cindex RefTeXs Menu
 @cindex Menu, in the menu bar
 
-@b{Ref@TeX{}} installs a @code{Ref} menu in the menu bar on systems
+@RefTeX{} installs a @code{Ref} menu in the menu bar on systems
 which support this.  From this menu you can access all of
-@b{Ref@TeX{}}'s commands and a few of its options.  There is also a
-@code{Customize} submenu which can be used to access @b{Ref@TeX{}}'s
+@RefTeX{}'s commands and a few of its options.  There is also a
+@code{Customize} submenu which can be used to access @RefTeX{}'s
 entire set of options.
 
 @node Key Bindings, Faces, RefTeXs Menu, Top
@@ -2713,7 +2857,7 @@ Here is a summary of the available key bindings.
 @end example
 
 Note that the @kbd{S-mouse-2} binding is only provided if this key is
-not already used by some other package.  @b{Ref@TeX{}} 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 @@ default.  If you want to have these key bindings available, set in your
 @end lisp
 
 @vindex reftex-load-hook
-Changing and adding to @b{Ref@TeX{}}'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 @@ which should be used to add keys, see @ref{Keymaps and Hooks}.
 @section Faces
 @cindex Faces
 
-@b{Ref@TeX{}} uses faces when available to structure the selection and
+@RefTeX{} 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, @b{Ref@TeX{}} 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 @@ files:
 
 @itemize @bullet
 @item
-@b{Ref@TeX{}} has full support for multifile documents.  You can edit parts of
+@RefTeX{} has full support for multifile documents.  You can edit parts of
 several (multifile) documents at the same time without conflicts.
-@b{Ref@TeX{}} provides functions to run @code{grep}, @code{search} and
+@RefTeX{} 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 @@ document.
 @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 @@ like the following at the end of each TeX file:
 %%% End: ***
 @end example
 
-AUCTeX with the setting
+@AUCTeX{} with the setting
 
 @lisp
 (setq-default TeX-master nil)
@@ -2805,14 +2949,14 @@ AUCTeX with the setting
 
 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 @b{Ref@TeX{}}.  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 @@ context.
 @section Language Support
 @cindex Language support
 
-Some parts of @b{Ref@TeX{}} 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 @@ to be changed for other languages.  See the variables
 @item
 @vindex reftex-translate-to-ascii-function
 @vindex reftex-label-illegal-re
-Also, when a label is derived from context, @b{Ref@TeX{}} 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 @@ variables @code{reftex-translate-to-ascii-function} and
 @code{reftex-label-illegal-re}.
 
 @item
-When a label is referenced, @b{Ref@TeX{}} 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 @@ see @ref{Adding Magic Words}.
 @vindex reftex-multiref-punctuation
 @vindex reftex-cite-punctuation
 @item
-@b{Ref@TeX{}} inserts ``punctuation'' for multiple references and
+@RefTeX{} 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 @@ dependent.  See the variables @code{reftex-multiref-punctuation} and
 @cindex Finding files
 
 In order to find files included in a document via @code{\input} or
-@code{\include}, @b{Ref@TeX{}} searches all directories specified in the
+@code{\include}, @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.
+@BibTeX{} database files.
 
-When searching, @b{Ref@TeX{}} 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 @b{Ref@TeX{}} 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, @b{Ref@TeX{}} 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 @@ There are three ways to solve this problem:
 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 @b{Ref@TeX{}} to use them instead:
+variables and configure @RefTeX{} to use them instead:
 
 @lisp
 (setq reftex-texpath-environment-variables '("MYTEXINPUTS"))
@@ -2904,7 +3048,7 @@ variables and configure @b{Ref@TeX{}} to use them instead:
 @end lisp
 
 @item
-Specify the full search path directly in @b{Ref@TeX{}}'s variables.
+Specify the full search path directly in @RefTeX{}'s variables.
 
 @lisp
 (setq reftex-texpath-environment-variables
@@ -2914,10 +3058,10 @@ Specify the full search path directly in @b{Ref@TeX{}}'s variables.
 @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.  @b{Ref@TeX{}} 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 @@ command depends upon the version of that program.
 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
-@code{reftex-file-extensions}.  When working with AUCTeX as major mode,
-the new extension must also be known to AUCTeX via the variable
+@code{reftex-file-extensions}.  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 @@ am leaving this stuff in the manual for people who want to write thick
 books, where some of it still might be useful.}
 
 Implementing the principle of least surprises, the default settings of
-@b{Ref@TeX{}} ensure a safe ride for beginners and casual users.  However,
-when using @b{Ref@TeX{}} for a large project and/or on a small computer,
+@RefTeX{} 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 Buffers}@*
 @cindex Removing lookup buffers
-@b{Ref@TeX{}} will load other parts of a multifile document as well as BibTeX
+@RefTeX{} 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 @@ these buffers around, and if you can live with a speed penalty, try
 @b{Partial Document Scans}@*
 @cindex Partial documents scans
 @cindex Document scanning, partial
-A @kbd{C-u} prefix on the major @b{Ref@TeX{}} 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.  @b{Ref@TeX{}} 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 @@ try
 @cindex Saving parser information
 @cindex Parse information, saving to a file
 @vindex reftex-parse-file-extension
-Even with partial scans enabled, @b{Ref@TeX{}} 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 @@ session.  To use this feature, put into @file{.emacs}:
 @b{Identifying label types by prefix}@*
 @cindex Parse information, saving to a file
 @vindex reftex-trust-label-prefix
-@b{Ref@TeX{}} normally parses around each label to check in which
+@RefTeX{} 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 @b{Ref@TeX{}} 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 @@ equation labels, use
 @b{Automatic Document Scans}@*
 @cindex Automatic document scans
 @cindex Document scanning, automatic
-At rare occasions, @b{Ref@TeX{}} 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 @@ document.  If this gets into your way, it can be turned off with
 (setq reftex-allow-automatic-rescan nil)
 @end lisp
 
-@b{Ref@TeX{}} will then occasionally annotate new labels in the selection
+@RefTeX{} 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 @@ manual document scan will fix this.
 @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.  @b{Ref@TeX{}} 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 @@ with the @kbd{g} key.  To get this behavior, use instead
 @need 2000
 @noindent
 @b{As a summary}, here are the settings I recommend for heavy use of
-@b{Ref@TeX{}} with large documents:
+@RefTeX{} with large documents:
 
 @lisp
 @group
@@ -3100,30 +3244,30 @@ with the @kbd{g} key.  To get this behavior, use instead
 @end lisp
 
 @node AUCTeX, Multifile Documents, Faces, Top
-@section AUC@TeX{}
+@section @AUCTeX{}
 @cindex @code{AUCTeX}, Emacs package
 @cindex Emacs packages, @code{AUCTeX}
 
-AUCTeX is without doubt the best major mode for editing TeX and LaTeX
+@AUCTeX{} 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
 it@footnote{XEmacs 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
-@subsection The AUC@TeX{}-@b{Ref@TeX{}} Interface
+@subsection The @AUCTeX{}-@RefTeX{} Interface
 
-@b{Ref@TeX{}} contains code to interface with AUCTeX.  When this
+@RefTeX{} contains code to interface with @AUCTeX{}.  When this
 interface is turned on, both packages will interact closely.  Instead of
-using @b{Ref@TeX{}}'s commands directly, you can then also use them
-indirectly as part of the AUCTeX
-environment@footnote{@b{Ref@TeX{}} 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{}
+environment@footnote{@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 @@ The following list describes the individual parts of the interface.
 @kindex C-c C-s
 @findex LaTeX-section, @r{AUCTeX}
 @findex TeX-insert-macro, @r{AUCTeX}
-@b{AUCTeX calls @code{reftex-label} to insert labels}@*
+@b{@AUCTeX{} calls @code{reftex-label} to insert labels}@*
 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
-@b{Ref@TeX{}} will insert
+For example, if you type @kbd{C-c C-e equation @key{RET}}, @AUCTeX{} and
+@RefTeX{} will insert
 
 @example
 \begin@{equation@}
@@ -3163,12 +3307,12 @@ For example, if you type @kbd{C-c C-e equation @key{RET}}, AUCTeX and
 @noindent
 without further prompts.
 
-Similarly, when you type @kbd{C-c C-s section @key{RET}}, @b{Ref@TeX{}}
+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
-@b{AUCTeX tells @b{Ref@TeX{}} about new sections}@*
-When creating a new section with @kbd{C-c C-s}, @b{Ref@TeX{}} will not
+@b{@AUCTeX{} tells @RefTeX{} about new sections}@*
+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 @@ have to rescan the buffer in order to see it.
 @findex TeX-arg-index, @r{AUCTeX function}
 @findex TeX-insert-macro, @r{AUCTeX function}
 @kindex C-c @key{RET}
-@b{@b{Ref@TeX{}} supplies macro arguments}@* When you insert a macro
-interactively with @kbd{C-c @key{RET}}, AUCTeX normally prompts for
+@b{@RefTeX{} supplies macro arguments}@* 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 functions@footnote{@code{fset} is used to
-do this, which is not reversible.  However, @b{Ref@TeX{}} 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 @b{Ref@TeX{}'s} mechanisms.  For
-example, when you type @kbd{C-c @key{RET} ref @key{RET}}, @b{Ref@TeX{}}
+supplies the macro arguments with @b{@RefTeX{}'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
-@b{@b{Ref@TeX{}} tells AUCTeX about new labels, citation-- and index keys}@*
-@b{Ref@TeX{}} will add all newly created labels to AUCTeX's completion list.
+@b{@RefTeX{} tells @AUCTeX{} about new labels, citation and index keys}@*
+@RefTeX{} 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
-@b{Ref@TeX{}} in such a style file is useful when the LaTeX style
+@RefTeX{} 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 @b{Ref@TeX{}} in this
+distributed with @AUCTeX{} already support @RefTeX{} in this
 way.
 
-Before calling a @b{Ref@TeX{}} 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 @b{Ref@TeX{}}.
+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 @b{Ref@TeX{}} 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 @@ function @code{reftex-add-to-label-alist} which is still available as an
 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 @@ with @code{\newtheorem} might use
 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
-@b{Ref@TeX{}}'s citation format like this:
+@RefTeX{}'s citation format like this:
 
 @lisp
 (TeX-add-style-hook "natbib"
@@ -3286,7 +3430,7 @@ the style @file{multind.el} contains
 @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
 \newcommand@{\molec@}[1]@{#1\index@{Molecules!#1@}@}
 \newcommand@{\aindex@}[1]@{#1\index[author]@{#1@}
@@ -3310,7 +3454,7 @@ you could write this in the style file @file{myindex.el}:
 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 @b{Ref@TeX{}} 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 @@ is a style file @file{foils.el} that will inform @b{Ref@TeX{}} about these:
 @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.  @b{Ref@TeX{}} 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 @b{Ref@TeX{}}.  Bib-cite.el comes bundled with
-AUCTeX.
+Bib-cite and @RefTeX{}.  Bib-cite.el comes bundled with
+@AUCTeX{}.
 
 Bib-cite version 3.06 and later can be configured so that bib-cite's
-mouse functions use @b{Ref@TeX{}} 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 @b{Ref@TeX{}} 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 @@ make use of this feature, try
 
 @itemize @bullet
 @item
-@b{LaTeX commands}@*
+@b{@LaTeX{} commands}@*
 @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 @@ have to be first on a line (except for white space).
 @item
 @b{Commented regions}@*
 @cindex Labels, commented out
-@b{Ref@TeX{}} sees also labels in regions commented out and will refuse to
+@RefTeX{} 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 @@ scan will fix this.
 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 @@ document. @xref{AUCTeX}.
 @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 @b{Ref@TeX{}}'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 @b{Ref@TeX{}} 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 @@ this:
 @item
 @vindex reftex-keep-temporary-buffers
 @code{(setq reftex-keep-temporary-buffers t)}@*
-This implies that @b{Ref@TeX{}} 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 @@ to specify a label.  E.g. Lamport's @file{pf.sty} uses both
 @end example
 
 @noindent
-We need to trick @b{Ref@TeX{}} into swallowing this:
+We need to trick @RefTeX{} into swallowing this:
 
 @lisp
 @group
@@ -3450,7 +3594,7 @@ We need to trick @b{Ref@TeX{}} into swallowing this:
 
 @noindent
 The first line is just a normal configuration for a macro.  For the
-@code{step+} environment we actually tell @b{Ref@TeX{}} to look for the
+@code{step+} environment we actually tell @RefTeX{} to look for the
 @emph{macro} @samp{\begin@{step+@}} 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 @@ context.
 @cindex Idle timer restart
 @vindex reftex-use-itimer-in-xemacs
 In XEmacs, idle timer restart does not work reliably after fast
-keystrokes.  Therefore @b{Ref@TeX{}} 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 @@ this bug gets fixed, a real idle timer can be requested with
 @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
-@b{Ref@TeX{}}'s keymaps with
+@RefTeX{}'s keymaps with
 
 @lisp
 (viper-harness-minor-mode "reftex")
@@ -3491,15 +3635,15 @@ With @i{Viper} mode prior to Vipers version 3.01, you need to protect
 @cindex Acknowledgments
 @cindex Thanks
 @cindex Bug reports
-@cindex @code{http}, @b{Ref@TeX{}} home page
-@cindex @code{ftp}, @b{Ref@TeX{}} site
+@cindex @code{http}, @RefTeX{} home page
+@cindex @code{ftp}, @RefTeX{} site
 
-Ref@TeX{} was written by @i{Carsten Dominik}
+@RefTeX{} was written by @i{Carsten Dominik}
 @email{dominik@@science.uva.nl}, with contributions by @i{Stephen
-Eglen}.  Ref@TeX{} 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 Ref@TeX{}, 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 @@ There are also several Usenet groups which have competent readers who
 might be able to help: @code{comp.emacs}, @code{gnu.emacs.help},
 @code{comp.emacs.xemacs}, and @code{comp.text.tex}.
 
-@b{Ref@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
-@b{Ref@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 @b{Ref@TeX{}} 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 @b{Ref@TeX{}}'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
+@LaTeX{} 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 @@ it.  With one or two @kbd{C-u} prefixes, enforce document rescan first.
 @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 @@ expression to match all entries in all files.
 @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.  @b{Ref@TeX{}} 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 @@ to make an index entry.  The phrase indexed is the current selection or
 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 @@ Add current selection or the word at point to the phrases buffer.
 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 @@ the command @code{reftex-view-crossref-from-bibtex}.  With one or two
 @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 @b{Ref@TeX{}} 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 @@ active TAGS table is required.
 
 @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 @@ Renumber all simple labels in the document to make them sequentially.
 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, @b{Ref@TeX{}} 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 @@ Produce a list of all duplicate labels in the document.
 @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.
+@vindex reftex-create-bibtex-header
+@vindex 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
+@code{reftex-create-bibtex-footer} respectively.
 @end deffn
 
 @deffn Command reftex-customize
-Run the customize browser on the @b{Ref@TeX{}} 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 @b{Ref@TeX{}} 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 @@ removes the parse file associated with the current document.
 @chapter Options, Keymaps, Hooks
 @cindex Options, list of
 
-Here is a complete list of @b{Ref@TeX{}}'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 @@ reftex-customize} will get you there.
 @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 @@ itself and has the following structure:
 @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 @@ list, to cover cases in which different environments carry the same
 label type (like @code{equation} and @code{eqnarray}).  If the type
 indicator is @code{nil} and the macro has a label argument @samp{@{*@}},
 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 @@ Example: In a file @file{intro.tex}, @samp{eq:%f:} will become
 @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 @@ If an integer, use the nth argument of the macro.  As a special case,
 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 @samp{\\caption[[@{]} will use the caption in a figure or table
 environment.  @samp{\\begin@{eqnarray@}\|\\\\} works for
 eqnarrays.
@@ -4021,7 +4163,7 @@ context:
 @end example
 @end itemize
 
-Label context is used in two ways by @b{Ref@TeX{}}: 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 @@ List of magic words which identify a reference to be of this type.  If
 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 @@ made.
 @end table
 
 If the type indicator characters of two or more entries are the same,
-@b{Ref@TeX{}} will use
+@RefTeX{} will use
 @itemize @minus
 @item
 the first non-@code{nil} format and prefix
@@ -4081,7 +4223,7 @@ replaced with the environment or macro.
 @defopt reftex-trust-label-prefix
 Non-@code{nil} 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 @@ Flags governing label insertion.  The value has the form
 (@var{derive} @var{prompt})
 @end example
 
-If @var{derive} is @code{t}, @b{Ref@TeX{}} 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 @@ buffer.
 
 @deffn Hook reftex-string-to-label-function
 Function to turn an arbitrary string into a valid label.
-@b{Ref@TeX{}}'s default function uses the variable
+@RefTeX{}'s default function uses the variable
 @code{reftex-derive-label-parameters}.
 @end deffn
 
@@ -4278,35 +4420,38 @@ This is used to string together whole reference sets, like
 @code{reftex-reference}.
 @end defopt
 
-@defopt reftex-vref-is-default
-Non-@code{nil} 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.
+@defopt 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
+@code{reftex-ref-macro-prompt}.)  The keys, represented as characters,
+have to be unique.
 @end defopt
 
-@defopt reftex-fref-is-default
-Non-@code{nil} 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.
+@defopt 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
+@code{reftex-ref-style-alist}.
+@end defopt
+
+@defopt reftex-ref-macro-prompt
+Controls if @code{reftex-reference} prompts for the reference macro.
 @end defopt
 
 @deffn Hook reftex-format-ref-function
 If non-@code{nil}, 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
-@var{label} and the @var{default-format} (usually @samp{~\ref@{%s@}}).
-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
+@var{label}, the @var{default format} which normally is
+@samp{~\ref@{%s@}} 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 @@ Number of spaces to be used for indentation per section level.
 
 @defopt reftex-guess-label-type
 Non-@code{nil} means, @code{reftex-reference} will try to guess the
-label type.  To do that, @b{Ref@TeX{}} 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
-@code{reftex-label-alist}.  When it finds a match, @b{Ref@TeX{}} will
+@code{reftex-label-alist}.  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}, @b{Ref@TeX{}}
+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 @@ The keymap which is active in the labels selection process
 @cindex Creating citations, options
 
 @defopt reftex-bibliography-commands
-LaTeX commands which specify the BibTeX databases to use with the document.
+@LaTeX{} commands which specify the @BibTeX{} databases to use with the document.
 @end defopt
 
 @defopt reftex-bibfile-ignore-regexps
@@ -4359,20 +4504,20 @@ List of regular expressions to exclude files in
 @code{\\bibliography@{..@}}.  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
-@b{Ref@TeX{}} anyway.
+@RefTeX{} 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 @samp{\bibliography@{...@}} statement nor a @code{thebibliography}
-environment, @b{Ref@TeX{}} 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 non-@LaTeX{} 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 @@ In the format, the following percent escapes will be expanded.
 
 @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 @@ Works like @samp{%a}, but on list of editor names. (@samp{%2e} and
 @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 @@ after the string has been formatted.
 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 @@ The keymap which is active in the citation-key selection process
 (@pxref{Creating Citations}).
 @end deffn
 
+@defopt 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{", "}.
+@end defopt
+
+@defopt reftex-create-bibtex-header
+Header to insert in BibTeX files generated by
+@code{reftex-create-bibtex-file}.
+@end defopt
+
+@defopt reftex-create-bibtex-footer
+Footer to insert in BibTeX files generated by
+@code{reftex-create-bibtex-file}.
+@end defopt
+
+
 @node Options (Index Support), Options (Viewing Cross-References), Options (Creating Citations),  Options
 @section Index Support
 @cindex Options, Index support
@@ -4553,7 +4716,7 @@ should be @samp{Molecules!}.
 @var{exclude} can be a function.  If this function exists and returns a
 non-@code{nil} 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 non-@code{nil}, 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 final entry may also be a symbol.  It must have an association in
 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 @b{Ref@TeX{}} 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 @@ This is a list with @code{(@var{macro-key} @var{default-tag})}.
 
 @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,
-@b{Ref@TeX{}} will ask for it.  When this is the empty string and the
+@RefTeX{} 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 @@ last       @r{The last used index tag will be offered as default}
 
 @defopt reftex-index-math-format
 Format of index entries when copied from inside math mode.  When
-@code{reftex-index-selection-or-word} is executed inside TeX math mode,
+@code{reftex-index-selection-or-word} 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
-@file{texmathp.el} library which is part of AUCTeX.
+@file{texmathp.el} library which is part of @AUCTeX{}.
 @end defopt
 
 @defopt reftex-index-phrase-file-extension
@@ -4660,7 +4823,7 @@ When doing global indexing from the phrases buffer, searches for some
 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 non-@code{nil},
-@b{Ref@TeX{}} checks if the match is an index macro argument, or if an
+@RefTeX{} 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 @@ Normal hook which is run when a buffer is put into
 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, @b{Ref@TeX{}} 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 @@ escapes.
 Non-@code{nil} 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
+@BibTeX{} database files which are already visited by a live associated
 buffers.
 @end defopt
 
@@ -4790,7 +4953,7 @@ scans.  In order to clear it, use @kbd{M-x reftex-reset-mode}.
 @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 @@ be expanded recursively.  See also @code{reftex-use-external-file-finders}.
 @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 @@ then @samp{/tex/}, and then all subdirectories of @samp{./}.  If this
 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 @b{Ref@TeX{}} 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
 Non-@code{nil} means, use external programs to find files.  Normally,
-@b{Ref@TeX{}} searches the paths given in the environment variables
-@code{TEXINPUTS} and @code{BIBINPUTS} to find TeX files and BibTeX
+@RefTeX{} searches the paths given in the environment variables
+@code{TEXINPUTS} 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 @@ non-@code{nil}.
 
 @defopt reftex-keep-temporary-buffers
 Non-@code{nil} means, keep buffers created for parsing and lookup.
-@b{Ref@TeX{}} sometimes needs to visit files related to the current
+@RefTeX{} 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
+@BibTeX{} 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 @@ away, the initialization of the buffer depends upon the variable
 
 @defopt reftex-initialize-temporary-buffers
 Non-@code{nil} means do initializations even when visiting file
-temporarily.  When @code{nil}, @b{Ref@TeX{}} 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 @@ functions to do a minimal initialization.
 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 @b{Ref@TeX{}}.
+parsed by @RefTeX{}.
 @end defopt
 
 @defopt reftex-enable-partial-scans
 Non-@code{nil} means, re-parse only 1 file when asked to re-parse.
-Re-parsing is normally requested with a @kbd{C-u} prefix to many @b{Ref@TeX{}}
+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 @@ This extension is added to the base name of the master file.
 @end defopt
 
 @defopt reftex-allow-automatic-rescan
-Non-@code{nil} means, @b{Ref@TeX{}} may rescan the document when this seems
+Non-@code{nil} 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 @@ map.  @xref{Key Bindings}.
 @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 non-@code{nil}, @b{Ref@TeX{}}
+Plug-in flags for @AUCTeX{} interface.  This variable is a list of
+5 boolean flags.  When a flag is non-@code{nil}, @RefTeX{}
 will
 
 @example
@@ -5110,7 +5273,7 @@ Supplying labels in new sections and environments applies when creating
 sections with @kbd{C-c C-s} and environments with @kbd{C-c C-e}.@*
 Supplying macro arguments applies when you insert such a macro
 interactively with @kbd{C-c @key{RET}}.@*
-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 @@ argument.
 @section Keymaps and Hooks
 @cindex Keymaps
 
-@b{Ref@TeX{}} has the usual general keymap and load-- and mode-hook.
+@RefTeX{} has the usual general keymap, load hook and mode hook.
 
 @deffn Keymap reftex-mode-map
-The keymap for @b{Ref@TeX{}} mode.
+The keymap for @RefTeX{} mode.
 @end deffn
 
 @deffn {Normal Hook} reftex-load-hook
@@ -5141,20 +5304,54 @@ Normal hook which is being run when loading @file{reftex.el}.
 @end deffn
 
 @deffn {Normal Hook} reftex-mode-hook
-Normal hook which is being run when turning on @b{Ref@TeX{}} 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 @b{Ref@TeX{}}.
+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 @b{Ref@TeX{}}.
+Here is a list of recent changes to @RefTeX{}.
+
+@noindent @b{Version 4.33}
+
+@itemize @bullet
+@item
+Update to GPLv3.
+@item
+Parse files are created in a way that does not interfere with recentf
+mode.
+@end itemize
+
+@noindent @b{Version 4.32}
+
+@itemize @bullet
+@item
+First release by @AUCTeX{} project.
+@item
+Installation routine rewritten after structure of source package
+changed.
+@item
+Activation of @RefTeX{} changed, so make sure you read the installation
+instructions and remove obsolete cruft related to @RefTeX{} from your
+init file.
+@item
+Fixed bug where point would end up in the wrong buffer when jumping
+between several @LaTeX{} and phrases buffers.
+@item
+Fixed bug where @BibTeX{} keys with hyphens were parsed incorrectly.
+@item
+Some performance improvements.
+@item
+The separator used between multiple citations in a \cite macro can now
+be changed by customizing the variable @code{reftex-cite-key-separator}.
+@end itemize
 
 @noindent @b{Version 4.28}
 @itemize @bullet
@@ -5504,7 +5701,7 @@ Option @code{reftex-bibfile-ignore-list} renamed to @code{-regexps}.
 @item
 Expansion of recursive tex and bib path rewritten.
 @item
-Fixed problem where @b{Ref@TeX{}} 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 @@ variable @code{reftex-auto-view-crossref}.
 AUCTeX interface updates:
 @itemize @minus
 @item
-AUCTeX 9.9c and later notifies @b{Ref@TeX{}} about new sections.
+AUCTeX 9.9c and later notifies @RefTeX{} about new sections.
 @item
-@b{Ref@TeX{}} notifies AUCTeX about new labels.
+@RefTeX{} 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 @b{Ref@TeX{}} 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 @@ Fixed bug with empty context strings.
 @noindent @b{Version 3.21}
 @itemize @bullet
 @item
-New options for all faces used by @b{Ref@TeX{}}. 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 @@ Fixed some problems regarding the interaction with VIPER mode.
 @item
 Follow-mode is now only used after point motion.
 @item
-@b{Ref@TeX{}} now finally does not fontify temporary files anymore.
+@RefTeX{} now finally does not fontify temporary files anymore.
 @end itemize
 
 @noindent @b{Version 3.17}
@@ -5740,7 +5937,7 @@ Search for input and @file{.bib} files with recursive path definitions.
 @noindent @b{Version 3.00}
 @itemize @bullet
 @item
-@b{Ref@TeX{}} should work better for very large projects:
+@RefTeX{} should work better for very large projects:
 @item
 The new parser works without creating a master buffer.
 @item
@@ -5748,19 +5945,19 @@ Rescanning can be limited to a part of a multifile document.
 @item
 Information from the parser can be stored in a file.
 @item
-@b{Ref@TeX{}} can deal with macros having a naked label as an argument.
+@RefTeX{} 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
-@b{Ref@TeX{}} should work correctly in combination with buffer-altering
+@RefTeX{} 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
-@b{Ref@TeX{}}'s defaults.
+@RefTeX{}'s defaults.
 @end itemize
 
 @noindent @b{Version 2.17}
@@ -5858,7 +6055,7 @@ MS-DOS support.
 @noindent @b{Version 1.07}
 @itemize @bullet
 @item
-@b{Ref@TeX{}} gets its own menu.
+@RefTeX{} gets its own menu.
 @end itemize
 
 @noindent @b{Version 1.05}
index 38dacef1fd80038854eba5db91cd3c4645e1ade3..902bf63be7218e5bc9c5e3894ef49c586dc6e791 100644 (file)
@@ -1,3 +1,146 @@
+2012-09-30  Ralf Angeli  <angeli@caeruleus.net>
+
+       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  <fgallina@cuca>
 
        Enhancements for triple-quote string syntax.
index 3a875f0dfa389285c57de2d054144ed26329b288..72013c5b2412cedbcfbfc9766a9bd64a0676a668 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
 ;;; 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 LaTeX-add-index-entries "ext:tex" (&rest entries) t)
+
+(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-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 @@ What is being used depends upon `reftex-plug-into-AUCTeX'."
   (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 @@ of ENTRY-LIST is a list of cons cells (\"MACRONAME\" . LEVEL).  See
 (defun reftex-notice-new-section ()
   (reftex-notice-new 1 'force))
 
+(provide 'reftex-auc)
+
 ;;; reftex-auc.el ends here
index 229d12b290658a09296266d570062fb47634b2de..52fa6dbf9d2eb433abc0b86a7755ba0c4f640f56 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
 
   (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)
 
                            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
              (while (re-search-forward first-re nil t)
                (catch 'search-again
                  (setq key-point (point))
-                 (unless (re-search-backward
-                          "\\(\\`\\|[\n\r]\\)[ \t]*@\\([a-zA-Z]+\\)[ \t\n\r]*[{(]" nil t)
+                 (unless (re-search-backward "\\(\\`\\|[\n\r]\\)[ \t]*\
+@\\(\\(?:\\w\\|\\s_\\)+\\)[ \t\n\r]*[{(]" nil t)
                    (throw 'search-again nil))
                  (setq start-point (point))
                  (goto-char (match-end 0))
       (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
               (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 @@ While entering the regexp, completion on knows citation keys is possible.
          (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 @@ While entering the regexp, completion on knows citation keys is possible.
       ;; 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 @@ While entering the regexp, completion on knows citation keys is possible.
                        (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 @@ While entering the regexp, completion on knows citation keys is possible.
         (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 @@ While entering the regexp, completion on knows citation keys is possible.
       (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 @@ While entering the regexp, completion on knows citation keys is possible.
           (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 @@ While entering the regexp, completion on knows citation keys is possible.
     (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 @@ The sequence in the new file is the same as it was in the old database."
                (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
+                         "^[ \t]*@[Ss][Tt][Rr][Ii][Nn][Gg][ \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"
index b1e426c55663847075d513efbd6ae8ecfb50e84e..7d102e5a802ca4f1690ee5294615836d3937b3ff 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
 ;;; 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 it is a \\cite, show the BibTeX database entry.
 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 @@ will display info in the echo area."
     (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 @@ Calling this function several times find successive citation locations."
       (move-marker reftex-global-search-marker nil)
       (error "All files processed"))))
 
+(provide 'reftex-dcr)
+
 ;;; reftex-dcr.el ends here
index d836bbb6cb824ef2ddf2f72b0eda0890ac43a3c6..ebe0aae73f860d5e362da3d711164dd35b830e58 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -407,7 +405,7 @@ Also checks if buffers visiting the files are in read-only mode."
     (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 no argument, this command toggles
              (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)
index 1d15dfbed7ecd61a0b4b9d5518f7cc8c5f92e4cb..5b884dd8480cddad877a1d485a63d8b429296020 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; 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 @@ which is part of AUCTeX, the string is first processed with the
   (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 @@ This gets refreshed in every phrases command.")
 
     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 @@ You get a chance to edit the entry in the phrases buffer - finish with
   "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 @@ For more information see the RefTeX User Manual.
 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 @@ Does not do a save-excursion."
                                   reftex-index-phrases-macro-data "\n"))))
     (reftex-select-with-char prompt help delay)))
 
+(provide 'reftex-index)
 
 ;;; reftex-index.el ends here
index c6526d1b6ce536de89255761a726f7e686f32ff4..791b5d7b94577ef0c5854dbc4dc75e2893b7c558 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; 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 @@ of master file."
 
                 ((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 @@ of master file."
               nrest (- nrest i))))
     string))
 
+(provide 'reftex-parse)
+
 ;;; reftex-parse.el ends here
index 1882e7dde5636282ad4e42b85b29bc2de6d25bd7..9b9f1a0f68fb9cab6d11336ecb9128388cde13f6 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
 ;;; 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 @@ When called with 2 C-u prefix args, disable magic word recognition."
 
   (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 @@ When called with 2 C-u prefix args, disable magic word recognition."
                    (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 @@ When called with 2 C-u prefix args, disable magic word recognition."
         (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)))
-
-(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))
+;; 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-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 @@ Optional prefix argument OTHER-WINDOW goes to the label in another window."
       (goto-char where))
     (reftex-unhighlight 0)))
 
+(provide 'reftex-ref)
 
 ;;; reftex-ref.el ends here
index 1a4004363119092a70658e586f41ad056f7c2e71..68355f9b16f932db848b21f3ddfcc1f971ccdee0 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; 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 @@ During a selection process, these are the local bindings.
 (defvar last-data)
 (defvar call-back)
 (defvar help-string)
+(defvar reftex-refstyle)
 
 ;; The selection commands
 
@@ -604,23 +602,28 @@ Useful for large TOC's."
   (setq reftex-last-follow-point -1)
   (setq cb-flag (not cb-flag)))
 
-(defvar reftex-refstyle)                ; from reftex-reference
+(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-toggle-varioref ()
-  "Toggle the macro used for referencing the label between \\ref and \\vref."
+(defun reftex-select-cycle-ref-style-forward ()
+  "Cycle forward through macros used for referencing."
   (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."
+  (reftex-select-cycle-ref-style-internal))
+
+(defun reftex-select-cycle-ref-style-backward ()
+  "Cycle backward through macros used for referencing."
   (interactive)
-  (setq reftex-refstyle
-        (cond ((string= reftex-refstyle "\\ref") "\\fref")
-              ((string= reftex-refstyle "\\fref") "\\Fref")
-              (t "\\ref")))
-  (force-mode-line-update))
+  (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 @@ Useful for large TOC's."
                                 (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 @@ Useful for large TOC's."
     (princ help-string))
   (reftex-enlarge-to-fit "*RefTeX Help*" t))
 
+(provide 'reftex-sel)
+
 ;;; reftex-sel.el ends here
index 519236a362128d1f2076b49d06625595e2678f35..4f73322d3f5d312efbc48dd6e088201bf4f8b50f 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -372,14 +370,14 @@ SPC=view TAB=goto RET=goto+hide [q]uit [r]escan [l]abels [f]ollow [x]r [?]Help
            (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.
index 3470ef9f3c1e1948c3c4ec2441ea922f6f0257d7..df3d729adca5e3764a761d176b13ae34f7756ae9 100644 (file)
@@ -4,8 +4,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
-;; Package: reftex
 
 ;; This file is part of GNU Emacs.
 
@@ -207,6 +205,11 @@ distribution.  Mixed-case symbols are convenience aliases.")
       (?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 @@ distribution.  Mixed-case symbols are convenience aliases.")
   "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 @@ by whitespace."
 
 (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 @@ recentering will work for any TOC window created during the session.
 
 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 @@ This flag can be toggled from within the *toc* buffer with the `i' key."
 
 (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 @@ This flag can be toggled from within the *toc* buffer with the `f' key."
 
 (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 @@ of options."
 (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 @@ ENV-OR-MACRO
     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 @@ TYPE-KEY
     `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 @@ LABEL-PREFIX
     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 @@ CONTEXT-METHOD
     - 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 @@ And here is the setup for RefTeX:
 
 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 @@ RefTeX's default function uses the variable `reftex-derive-label-parameters'."
   :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 @@ This is used to string together whole reference sets, like
   :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 @@ a label type.  If you set this variable to nil, RefTeX will always prompt."
 
 (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 @@ string to insert into the buffer."
   "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 @@ E.g.: (setq reftex-cite-format 'natbib)"
 
 (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 @@ The function will be called with two arguments, the CITATION KEY and the
 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 @@ These correspond to the makeindex keywords LEVEL ENCAP ACTUAL QUOTE ESCAPE."
           (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 flag can be toggled from within the *Index* buffer with the `f' key."
 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 @@ entries and for BibTeX database files with live associated buffers."
   :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 @@ The file MASTER.rel in the same directory as MASTER.tex is used to save the
 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 @@ symbol indicating in what context the hook is called."
 
 (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 @@ may require a restart of Emacs in order to become effective."
            (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.
index 8318dc0d5f3ee58762793faf6677858a51e40327..7052dcf473e59617a2bdb5978ae82c26015ea3ea 100644 (file)
@@ -3,7 +3,6 @@
 
 ;; Author: Carsten Dominik <dominik@science.uva.nl>
 ;; Maintainer: auctex-devel@gnu.org
-;; Version: 4.31
 ;; Keywords: tex
 
 ;; This file is part of GNU Emacs.
 ;; 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.
 ;; - 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 <dominik@science.uva.nl>
-;;
-;;         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/
+;;    http://www.gnu.org/software/auctex/reftex.html
 ;;
-;; 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).
-;;
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;;
-;;;;;;
-\f
+;; RefTeX was written by Carsten Dominik <dominik@science.uva.nl> with
+;; contributions from Stephen Eglen.  It is currently maintained by
+;; the AUCTeX project.
+
 ;;; Code:
 
 (eval-when-compile (require 'cl))
     (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"
 (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")
 (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"
 (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")
 (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")
 (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"
 (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"
 (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"
 (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")
 (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."
 (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 @@ on the menu bar.
         (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 @@ on the menu bar.
   (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 @@ on the menu bar.
       ;; 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 @@ for details.
 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 @@ the label information is recompiled on next use."
       (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 @@ This enforces rescanning the buffer on next use."
     ;; 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 @@ This enforces rescanning the buffer on next use."
                                           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 @@ When DIE is non-nil, throw an error if file not found."
         "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 @@ When DIE is non-nil, throw an error if file not found."
                  (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 @@ When DIE is non-nil, throw an error if file not found."
       (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-by-car (alist &optional keep-list)
+(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 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 @@ IGNORE-WORDS List of words which should be removed from the string."
    ((= (length text) 0) (make-string 1 ?\ ))
    (t text)))
 
+
 ;;; =========================================================================
 ;;;
 ;;; Fontification and Highlighting
@@ -2390,28 +2261,20 @@ IGNORE-WORDS List of words which should be removed from the string."
  "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 @@ IGNORE-WORDS List of words which should be removed from the string."
      :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 @@ IGNORE-WORDS List of words which should be removed from the string."
         (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 @@ With optional NODE, go directly to that node."
   (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
+     "bug-auctex@gnu.org"
+     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 @@ With optional NODE, go directly to that node."
 (setq reftex-tables-dirty t)  ; in case this file is evaluated by hand
 (provide 'reftex)
 
-;;;============================================================================
-
 ;;; reftex.el ends here