@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.
@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
@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.
* 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
* Index:: The full index.
@detailmenu
+ --- The Detailed Node Listing ---
Introduction
* 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
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
@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
@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
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
@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)
@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}@}}
@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.
@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
@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
@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
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)}
@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
@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
@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}.
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.
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.
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.
@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.
@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.
@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
* 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
@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
@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
@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
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
@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
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).
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}.
@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 - + ,
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}
@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.
@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}
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
@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
@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
@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}
@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
@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
* 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
@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
\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
@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.
@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
@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
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
@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:
\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.
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
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:
(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
@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
@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
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
(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
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}
@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:
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
@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
@samp{Einstein&&Bose} will match all articles which mention
Bose-Einstein condensation, or which are co-authored by Bose and
Einstein. When entering the regular expression, you can complete on
-known citation keys. RefTeX also offers a default when prompting for a
-regular expression. This default is the word before the cursor or the
+known citation keys. @RefTeX{} also offers a default when prompting for
+a regular expression. This default is the word before the cursor or the
word before the current @samp{\cite} command. Sometimes this may be a
good search key.
@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
@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}
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.
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
@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
@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
(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
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
@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
@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
@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
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
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
@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
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:
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
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
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
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
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
@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.
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
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}.
@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
@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,
@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
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,
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:
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)}).
@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}
@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
&}.
@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
@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
@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
@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}.
@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
@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.
@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: ***
%%% End: ***
@end example
-AUCTeX with the setting
+@AUCTeX{} with the setting
@lisp
(setq-default TeX-master nil)
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.
@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:
@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
@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}.
@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}.
@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
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"))
@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
@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.
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
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
@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
@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
@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
@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
(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.
@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
@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
@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
@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@}
@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
@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
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
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"
@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@}
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"
@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
@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).
@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
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
@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
@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
@end example
@noindent
-We need to trick @b{Ref@TeX{}} into swallowing this:
+We need to trick @RefTeX{} into swallowing this:
@lisp
@group
@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
@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
@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")
@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
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}.
@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
@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
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
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
@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
@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
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
@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.
@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
@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
@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:
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
@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.
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.
@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
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}
@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
@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
(@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
@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
@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
@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
@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
@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.}
@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
@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
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.
(@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
@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
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
@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
@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
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
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.
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
@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
@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
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
@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
@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
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
@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
@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
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
@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
@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
@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
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.
@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
@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}
@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
@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}
@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}
;; 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]'.
(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)
(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)
;; 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
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))
(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.
;; 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{\\([^}]*\\)}"
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
"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
(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)))))))
(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
((= (length text) 0) (make-string 1 ?\ ))
(t text)))
+
;;; =========================================================================
;;;
;;; Fontification and Highlighting
"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))))
;;; =========================================================================
;;;
: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)
(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)
(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)
(setq reftex-tables-dirty t) ; in case this file is evaluated by hand
(provide 'reftex)
-;;;============================================================================
-
;;; reftex.el ends here