changeset 26911:d7f536a01276

Update to reftex 4.9
author Carsten Dominik <dominik@science.uva.nl>
date Wed, 15 Dec 1999 17:27:40 +0000
parents 489a5439b988
children 3470e4fea708
files man/reftex.texi
diffstat 1 files changed, 554 insertions(+), 158 deletions(-) [+]
line wrap: on
line diff
--- a/man/reftex.texi	Wed Dec 15 17:02:38 1999 +0000
+++ b/man/reftex.texi	Wed Dec 15 17:27:40 1999 +0000
@@ -9,9 +9,9 @@
 @synindex ky cp
 @syncodeindex vr cp
 @syncodeindex fn cp
-@set VERSION 4.6
-@set EDITION 4.6
-@set DATE September 1999
+@set VERSION 4.9
+@set EDITION 4.9
+@set DATE December 1999
 @set AUTHOR Carsten Dominik
 @set AUTHOR-EMAIL dominik@@strw.leidenuniv.nl
 @set MAINTAINER Carsten Dominik
@@ -72,7 +72,7 @@
 
 @author by Carsten Dominik
 @page
-Copyright @copyright{} 1997, 1998 Free Software Foundation, Inc.
+Copyright @copyright{} 1997, 1998, 1999 Free Software Foundation, Inc.
 
 @sp 2
 This is edition @value{EDITION} of the @cite{Ref@TeX{} User Manual} for
@@ -178,11 +178,18 @@
 
 Index Support
 
-* Creating Index Entries::
-* Displaying and Editing the Index:: 
+* Creating Index Entries::           Macros and completion of entries.
+* The Index Phrases File::           A special file for global indexing.
+* Displaying and Editing the Index:: The index editor.
 * Builtin Index Macros::             The index macros RefTeX knows about.
 * Defining Index Macros::                ... and macros it  doesn't.
 
+The Index Phrases File
+
+* Collecting Phrases::               Collecting from document or external.
+* Consistency Checks::               Check for duplicates etc.
+* Global Indexing::                  The interactive indexing process.
+
 AUCTeX
 
 * AUCTeX-RefTeX Interface::          How both packages work together
@@ -356,22 +363,24 @@
 @itemize @bullet
 @item
 @b{Creating Index Entries}@*
-Type @kbd{C-c /} (@code{reftex-index-selection-or-word}) to index the
-current selection or the word at the cursor with the default macro (see
-the variable @code{reftex-index-default-macro}).@*
-Type @kbd{C-c <} (@code{reftex-index}) to insert a general index macro.
-@b{Ref@TeX{}} will offer a list of available macros and provide
-completion for the index tag (used to identify one of multiple indices)
-and for the entry itself (useful with subentries).
-
-@refill
-
-@item
-@b{Displaying the Index}@* To display the compiled index in a special
-buffer, type @kbd{C-c >} (@code{reftex-display-index}).  From that
-buffer you can check and edit all entries.  The index can be restricted
-to those entries defined in a single document section or in a user
-defined region.@refill
+To index the current selection or the word at point, type @kbd{C-c /}
+(@code{reftex-index-selection-or-word}).  The default macro
+@code{reftex-index-default-macro} will be used.  For a more complex entry
+type @kbd{C-c <} (@code{reftex-index}), select any of the index macros
+and enter the arguments with completion.@refill
+
+@item
+@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
+phrases and let you interactively index the matches.@refill
+
+@item
+@b{Displaying and Editing the Index}@*
+To display the compiled index in a special buffer, type @kbd{C-c >}
+(@code{reftex-display-index}).  From that buffer you can check and edit
+all entries.@refill
 @end itemize
 
 @page
@@ -381,10 +390,10 @@
 @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
-files.@refill @* When the enclosing macro is @code{\cite} or @code{\ref}
-and no other message occupies the echo area, information about the
-citation or label will automatically be displayed in the echo
-area.@refill
+files.@refill @*
+When the enclosing macro is @code{\cite} or @code{\ref} and no other
+message occupies the echo area, information about the citation or label
+will automatically be displayed in the echo area.@refill
 
 @item
 @b{Multifile Documents}@*
@@ -440,7 +449,8 @@
 @item @b{Where Next?}@* Go ahead and use @b{Ref@TeX{}}.  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.  The first part of the manual explains in
+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 @b{Ref@TeX{}}.  The second
 part is a command and variable reference.@refill  
 @end enumerate
@@ -541,6 +551,16 @@
 
 @tablesubheading{Controlling what gets displayed}
 
+@item t
+@vindex reftex-toc-max-level
+Change the maximum level of toc entries displayed in the @file{*toc*}
+buffer.  Without prefix arg, all levels will be included.  With prefix
+arg (e.g @kbd{3 t}), ignore all toc entries with level greater than
+@var{arg} (3 in this case).  Chapters are level 1, sections are level 2.
+The mode line @samp{T<>} indicator shows the current value.  The default
+depth can be configured with the variable
+@code{reftex-toc-max-level}.@refill
+
 @item F
 @vindex reftex-toc-include-file-boundaries
 Toggle the display of the file borders of a multifile document in the
@@ -602,12 +622,16 @@
 @cindex Sectioning commands
 @cindex KOMA-Script, LaTeX classes
 @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
 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}.
+@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.
 
 @node Labels and References, Citations, Table of Contents, Top
 @chapter Labels and References
@@ -882,7 +906,9 @@
 selection buffer.@refill
 
 @item t
-Toggle the display of the table of contents in the selection buffer.@refill
+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.@refill
 
 @item #
 Toggle the display of a label counter in the selection buffer.@refill
@@ -1095,8 +1121,8 @@
 
 @lisp
 (setq reftex-label-alist
-   '(("axiom"   ?a "ax:"  "~\\ref@{%s@}" nil ("axiom"   "ax."))
-     ("theorem" ?h "thr:" "~\\ref@{%s@}" t   ("theorem" "theor." "th."))))
+   '(("axiom"   ?a "ax:"  "~\\ref@{%s@}" nil ("axiom"   "ax.") -2)
+     ("theorem" ?h "thr:" "~\\ref@{%s@}" t   ("theorem" "th.") -3)))
 @end lisp
 
 The type indicator characters @code{?a} and @code{?h} are used for
@@ -1130,11 +1156,19 @@
 Environments)}).@refill
 @end itemize
 
-The strings at the end of each entry are used to guess the correct label
-type from the word before point when creating a reference.  E.g. if you
+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
 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 restrict
-the menu to only these labels without even asking.@refill
+@b{Ref@TeX{}} will know that you are looking for a theorem label and
+restrict the menu to only these labels without even asking.@refill
+
+The final item in each entry is the level at which the environment
+should produce entries in the table of context buffer.  If the number is
+positive, the environment will produce numbered entries (like
+@code{\section}), if it is negative the entries will be unnumbered (like
+@code{\section*}).  Use this only for environments which structure the
+document similar to sectioning commands.  For everything else, omit the
+item.@refill
 
 To do the same configuration with @code{customize}, you need to click on
 the @code{[INS]} button twice to create two templates and fill them in
@@ -1152,6 +1186,7 @@
               [INS] [DEL] String: axiom
               [INS] [DEL] String: ax.
               [INS]
+            [X] Make TOC entry    : [Value Menu] Level: -2
 [INS] [DEL] Package or Detailed   : [Value Menu] Detailed:
             Environment or \macro : [Value Menu] String: theorem
             Type specification    : [Value Menu] Char  : h
@@ -1163,6 +1198,7 @@
               [INS] [DEL] String: theor.
               [INS] [DEL] String: th.
               [INS]
+            [X] Make TOC entry    : [Value Menu] Level: -3
 @end example
 
 @vindex reftex-insert-label-flags
@@ -1220,6 +1256,7 @@
             Context method        : [Value Menu] Macro arg nr: 1
             Magic words:
               [INS]
+            [ ] Make TOC entry    : [Value Menu] No entry
 @end example
 
 @node Figure Wrapper, Adding Magic Words, Quick Equation, Defining Label Environments
@@ -1279,6 +1316,7 @@
             Context method        : [Value Menu] Macro arg nr: 3
             Magic words:
               [INS]
+            [ ] Make TOC entry    : [Value Menu] No entry
 @end example
 
 @node Adding Magic Words, Using \eqref, Figure Wrapper, Defining Label Environments
@@ -1443,8 +1481,8 @@
 
 @lisp
 (setq reftex-label-alist
-  '(("axiom"   ?a "ax:"  "~\\ref@{%s@}" nil ("axiom"   "ax."))
-    ("theorem" ?h "thr:" "~\\ref@{%s@}" t   ("theorem" "theor." "th."))
+  '(("axiom"   ?a "ax:"  "~\\ref@{%s@}" nil ("axiom"   "ax.") -2)
+    ("theorem" ?h "thr:" "~\\ref@{%s@}" t   ("theorem" "theor." "th.") -3)
     ("\\quickeq@{@}" ?e nil nil 1 nil)
     AMSTeX
     ("\\myfig[]@{@}@{@}@{*@}@{@}" ?f nil nil 3)
@@ -1801,15 +1839,12 @@
 binding for @code{reftex-cite-format}.@refill
 
 @lisp
-(add-hook
- 'mail-setup-hook
- (lambda ()
-   (define-key mail-mode-map "\C-c["
-     (lambda ()
-       (interactive)
-       (require 'reftex)
-       (let ((reftex-cite-format 'locally))
-         (reftex-citation))))))
+(add-hook 'mail-setup-hook
+          (lambda () (define-key mail-mode-map "\C-c["
+                       (lambda () (interactive)
+                         (require 'reftex)
+                         (let ((reftex-cite-format 'locally))
+                           (reftex-citation))))))
 @end lisp
 
 @node Index Support, Viewing Cross-References, Citations, Top
@@ -1828,44 +1863,63 @@
 nicely formatted index.  Tools used with LaTeX include @code{MakeIndex}
 and @code{xindy}.@refill
 
-Indexing is a lot of work and must follow strict conventions, so that
-the same word looks the same in all index entries referencing it, and in
-order to avoid spurious multiple entries.  Therefore, the author of a
-document will most likely define special macros to make this easier.  To
-make @b{Ref@TeX{}} support for indexing possible, these special macros
-must be added to @b{Ref@TeX{}}'s configuration (@pxref{Defining Index
-Macros}).@refill
+Indexing is a very difficult task.  It must follow strict conventions to
+make the index consistent and complete.  There are basically two
+approaches one can follow, and both have their merits.
+
+@enumerate
+@item
+Part of the indexing should already be done with the markup.  The
+document structure should be reflected in the index, so when starting
+new sections, the basic topics of the section should be indexed.  If the
+document contains definitions, theorems or the like, these should all
+correspond to appropriate index entries.  This part of the index can
+very well be developed along with the document.  Often it is worthwhile
+to define special purpose macros which define an item and at the same
+time make an index entry, possibly with special formatting to make the
+reference page in the index bold or underlined.  To make @b{Ref@TeX{}}
+support for indexing possible, these special macros must be added to
+@b{Ref@TeX{}}'s configuration (@pxref{Defining Index Macros}).@refill
+
+@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}
+which collects phrases and helps indexing the phrases globally.@refill
+@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
+builtin support for the default @code{\index} and @code{\glossary}
+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
+configuration needs to be done by hand with the menu (@code{Ref->Index
+Style}), or globally for all your documents with@refill
+
+@lisp
+(setq reftex-index-macros '(multind))     @r{or}
+(setq reftex-index-macros '(index))
+@end lisp
 
 @menu
-* Creating Index Entries::
-* Displaying and Editing the Index:: 
+* Creating Index Entries::           Macros and completion of entries.
+* The Index Phrases File::           A special file for global indexing.
+* Displaying and Editing the Index:: The index editor.
 * Builtin Index Macros::             The index macros RefTeX knows about.
 * Defining Index Macros::                ... and macros it  doesn't.
 @end menu
 
-@node Creating Index Entries, Displaying and Editing the Index, , Index Support
+@node Creating Index Entries, The Index Phrases File, , Index Support
 @section Creating Index Entries
 @cindex Creating index entries
 @cindex Index entries, creating
 @kindex C-c <
 @findex reftex-index
-
-First you need to make sure that @b{Ref@TeX{}} knows about the index
-style being used in the current document.  @b{Ref@TeX{}} has builtin
-support for the default @code{\index} and @code{\glossary} 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 configuration needs to be
-done by hand with the menu (@code{Ref->Index Style}), or globally for
-all your documents with
-
-@lisp
-(setq reftex-index-macros '((multind))     @r{or}
-(setq reftex-index-macros '((index))
-@end lisp
-
 @kindex C-c /
 @findex reftex-index-selection-or-word
 
@@ -1891,20 +1945,235 @@
 @file{multind} and @file{index} packages, this tag is the first argument
 to the redefined @code{\index} macro.@refill
 
-@findex reftex-index-globally
-
-There is also a command @code{reftex-index-globally}@footnote{This
-function is still experimentally and may change or go away.} which
-copies an index entry near point to other occurrences of the same word
-in the document.  @b{Ref@TeX{}} assumes that the word you want to index
-is in direct contact with the index macro, e.g.
-@samp{\index@{@var{word}@}@var{word}} or
-@samp{@var{word}\index@{@var{word}@}}.  If there is no such word, it
-uses the key argument of the index macro.  After making you confirm the
-precise search and replace strings, a query-replace over the entire
-document will be launched.
-
-@node Displaying and Editing the Index, Builtin Index Macros, Creating Index Entries, Index Support
+@node The Index Phrases File, Displaying and Editing the Index, Creating Index Entries, Index Support
+@section The Index Phrases File
+@cindex Index phrase file
+@cindex Phrase file
+@kindex C-c |
+@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
+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
+|} (@code{reftex-index-visit-phrases-buffer}).  If the file is empty it
+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,
+don't forget to add them to @code{reftex-index-macros} as well.  Here is
+a phrase file header example:@refill
+
+@example
+% -*- mode: reftex-index-phrases -*-
+%                           Key   Macro Format       Repeat
+%----------------------------------------------------------
+>>>INDEX_MACRO_DEFINITION:   i    \index@{%s@}          t
+>>>INDEX_MACRO_DEFINITION:   I    \index*@{%s@}         nil
+>>>INDEX_MACRO_DEFINITION:   g    \glossary@{%s@}       t
+>>>INDEX_MACRO_DEFINITION:   n    \index*[name]@{%s@}   nil
+%----------------------------------------------------------
+@end example
+
+The macro definition lines consist of a unique letter identifying a
+macro, a format string and the @var{repeat} flag, all separated by
+@key{TAB}.  The format string shows how the macro is to be applied, the
+@samp{%s} will be replaced with the index entry.  The repeat flag
+indicates if @var{word} is indexed by the macro as
+@samp{\index@{@var{word}@}} (@var{repeat} = @code{nil}) or as
+@samp{\index@{@var{word}@}@var{word}} (@var{repeat} = @code{t}).  In the
+above example it is assumed that the macro @code{\index*@{@var{word}@}}
+already typesets its argument in the text, so that it is unnecessary to
+repeat @var{word} outside the macro.@refill
+
+@menu
+* Collecting Phrases::               Collecting from document or external.
+* Consistency Checks::               Check for duplicates etc.
+* Global Indexing::                  The interactive indexing process.
+@end menu
+
+@node Collecting Phrases, Consistency Checks, , The Index Phrases File
+@subsection Collecting Phrases
+@cindex Collecting index phrases
+@cindex Index phrases, collection
+@cindex Phrases, collecting
+
+Phrases for indexing can be collected while writing the document.  The
+command @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word})
+copies the current selection (if active) or the word near point into the 
+phrases buffer.  It then selects this buffer, so that the phrase line
+can be edited.  To return to the LaTeX document, press @kbd{C-c C-c}
+(@code{reftex-index-phrases-save-and-return}).
+
+You can also prepare the list of index phrases in a different way and
+copy it into the phrases file.  For example you might want to start from 
+a word list of the document and remove all words which should not be
+indexed.
+
+The phrase lines in the phrase buffer must have a specific format.
+@b{Ref@TeX{}} will use font-lock to indicate if a line has the proper
+format.  A phrase line looks like this:
+
+@example
+[@var{key}] <TABs> @var{phrase} [<TABs> @var{arg}[&&@var{arg}]... [ || @var{arg}]...] 
+@end example
+
+@code{<TABs>} stands for white space containing at least one @key{TAB}.
+@var{key} must be at the start of the line and is the character
+identifying one of the macros defined in the file header.  It is
+optional - when omitted, the first macro definition line in the file
+will be used for this phrase.  The @var{phrase} is the phrase to be
+searched for when indexing.  It may contain several words separated by
+spaces.  By default the search phrase is also the text entered as
+argument of the index macro.  If you want the index entry to be
+different from the search phrase, enter another @key{TAB} and the index
+argument @var{arg}.  If you want to have each match produce several
+index entries, separate the different index arguments with @samp{ &&
+}@footnote{@samp{&&} with optional spaces, see
+@code{reftex-index-phrases-logical-and-regexp}.}.  If you want to be
+able to choose at each match between several different index arguments,
+separate them with @samp{ || }@footnote{@samp{||} with optional spaces,
+see @code{reftex-index-phrases-logical-or-regexp}.}.  Here is an
+example:@refill
+
+@example
+%--------------------------------------------------------------------
+I     Sun
+i     Planet         Planets
+i     Vega           Stars!Vega
+      Jupiter        Planets!Jupiter
+i     Mars           Planets!Mars || Gods!Mars || Chocolate Bars!Mars
+i     Pluto          Planets!Pluto && Kuiper Belt Objects!Pluto
+@end example
+
+
+So @samp{Sun} will be indexed directly as @samp{\index*@{Sun@}}, while
+@samp{Planet} will be indexed as @samp{\index@{Planets@}Planet}.
+@samp{Vega} will be indexed as a subitem of @samp{Stars}.  The
+@samp{Jupiter} line will also use the @samp{i} macro as it was the first
+macro definition in the file header (see above example).  At each
+occurrence of @samp{Mars} you will be able choose between indexing it as
+a subitem of @samp{Planets}, @samp{Gods} or @samp{Chocolate Bars}.
+Finally, every occurrence of @samp{Pluto} will be indexed as
+@samp{\index@{Planets!Pluto@}\index@{Kuiper Belt Objects!Pluto@}Pluto}
+and will therefore create two different index entries.@refill
+
+@node Consistency Checks, Global Indexing, Collecting Phrases, The Index Phrases File
+@subsection Consistency Checks
+@cindex Index phrases, consistency checks
+@cindex Phrases, consistency checks
+@cindex Consistency check for index phrases
+
+@kindex C-c C-s
+Before indexing the phrases in the phrases buffer, they should be
+checked carefully for consistency.  A first step is to sort the phrases
+alphabetically - this is done with the command @kbd{C-c C-s}
+(@code{reftex-index-sort-phrases}).  It will sort all phrases in the
+buffer alphabetically by search phrase.  If you want to group certain
+phrases and only sort within the groups, insert empty lines between the
+groups.  Sorting will only change the sequence of phrases within each
+group (see the variable @code{reftex-index-phrases-sort-in-blocks}).@refill
+
+@kindex C-c C-i
+A useful command is @kbd{C-c C-i} (@code{reftex-index-phrases-info})
+which lists information about the phrase at point, including an example
+of how the index entry will look like and the number of expected matches
+in the document.@refill
+
+@kindex C-c C-t
+Another important check is to find out if there are double or
+overlapping entries in the buffer.  For example if you are first
+searching and indexing @samp{Mars} and then @samp{Planet Mars}, the
+second phrase will not match because of the index macro inserted before
+@samp{Mars} earlier.  The command @kbd{C-c C-t}
+(@code{reftex-index-find-next-conflict-phrase}) finds the next phrase in
+the buffer which is either duplicate or a subphrase of another phrase.
+In order to check the whole buffer like this, start at the beginning and
+execute this command repeatedly.@refill
+
+@node Global Indexing, , Consistency Checks, The Index Phrases File
+@subsection Global Indexing
+@cindex Global indexing
+@cindex Indexing, global
+@cindex Indexing, from @file{phrases} buffer
+
+Once the index phrases have been collected and organized, you are set
+for global indexing.  I recommend to do this only on an otherwise
+finished document.  Global indexing starts from the phrases buffer.
+There are several commands which start indexing: @kbd{C-c C-x} acts on
+the current phrase line, @kbd{C-c C-r} on all lines in the current
+region and @kbd{C-c C-a} on all phrase lines in the buffer.  It is
+probably good to do indexing in small chunks since your concentration
+may not last long enough to do everything in one go.@refill
+
+@b{Ref@TeX{}} 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 
+@key{Help} at the indexing prompt can apparently hang Emacs.}:@refill
+
+@table @kbd
+@item y
+Replace this match with the proposed string.
+@item n
+Skip this match.
+@item !
+Replace this and all further matches in this file.
+@item q
+Skip this match, start with next file.
+@item Q
+Skip this match, start with next phrase.
+@item o
+Select a different indexing macro for this match.
+@item 1-9
+Select one of multiple index keys (those separated with @samp{||}).
+@item e
+Edit the replacement text.
+@item C-r
+Recursive edit.  Use @kbd{M-C-c} to return to the indexing process.
+@item s
+Save this buffer and ask again about the current match.
+@item S
+Save all document buffers and ask again about the current match.
+@item C-g
+Abort the indexing process.
+@end table
+
+The @samp{Find and Index in Document} menu in the phrases buffer also
+lists a few options for the indexing process.  The options have
+associated customization variables to set the defaults (@pxref{Options
+(Index Support)}).  Here is a short explanation of what the options do:
+
+@table @i
+@item Match Whole Words
+When searching for index phrases, make sure whole words are matched.
+This should probably always be on.
+@item Case Sensitive Search
+Search case sensitively for phrases.  I recommend to have this setting
+off, in order to match the capitalized words at the beginning of a
+sentence, and even typos.  You can always say @emph{no} at a match you
+do not like.
+@item Wrap Long Lines
+Inserting index macros increases the line length.  Turn this option on
+to allow @b{Ref@TeX{}} to wrap long lines.
+@item Skip Indexed Matches
+When this is on, @b{Ref@TeX{}} 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 those configured in @code{reftex-index-macros}.  Intended for
+re-indexing a documents after changes have been made.@refill
+@end table
+
+Even though indexing should be the last thing you do to a document, you
+are bound to make changes afterwards.  Indexing then has to be applied
+to the changed regions.  The command
+@code{reftex-index-phrases-apply-to-region} is designed for this
+purpose.  When called from a LaTeX document with active region, it will
+apply @code{reftex-index-all-phrases} to the current region.@refill
+
+@node Displaying and Editing the Index, Builtin Index Macros, The Index Phrases File, Index Support
 @section Displaying and Editing the Index
 @cindex Displaying the Index
 @cindex Editing the Index
@@ -1926,8 +2195,8 @@
 @samp{2}, thus press @kbd{C-u 2 C-c >}.  To restrict to the current
 region, make the region active and use a numeric prefix @samp{3} (press
 @kbd{C-u 3 C-c >}).  From within the @file{*Index*} buffer the
-restriction can be moved from one section to the next with the @kbd{<}
-and @kbd{>} keys.@refill
+restriction can be moved from one section to the next by pressing the
+@kbd{<} and @kbd{>} keys.@refill
 
 One caveat: @b{Ref@TeX{}} finds the definition point of an index entry
 by searching near the buffer position where it had found to macro during
@@ -1973,7 +2242,7 @@
 
 @item @key{RET}
 Go to the definition of the current index entry and hide the
-@file{*Index*} buffer.@refill
+@file{*Index*} buffer window.@refill
 
 @item f
 @vindex reftex-index-follow-mode
@@ -2030,13 +2299,6 @@
 subitem (@samp{aaa!bbb!ccc}), this function moves it up the hierarchy
 (@samp{bbb!ccc}).@refill 
 
-@item &
-Globalize the current entry.  This runs a search-and-replace through the
-entire document in order to index the same word at other places.  Rescan 
-the document in order to get the new entries into the index buffer. For
-details, see the command @code{reftex-index-globally},
-@ref{Commands}.@refill
-
 @tablesubheading{Exiting}
 @item q
 Hide the @file{*Index*} buffer.@refill
@@ -2056,7 +2318,7 @@
 
 @item @}
 Restrict the index to a single document section.  The corresponding
-section number will be displayed in the @code{R<>} indication in the
+section number will be displayed in the @code{R<>} indicator in the
 mode line and in the header of the @file{*Index*} buffer.@refill
 
 @item @{
@@ -2104,8 +2366,8 @@
 
 @b{Ref@TeX{}} 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 the @code{\index}
-macro of the @file{multind} and @file{index} packages.  However, since
+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,
 you will have to explicitly specify the index style used.
 @xref{Creating Index Entries}, for information on how to do that.
@@ -2137,9 +2399,9 @@
 
 @lisp
 (setq reftex-index-macros
-      '(("\\ix@{*@}" "idx" ?x "" nil)
-        ("\\nindex@{*@}" "name" ?n "" nil)
-        ("\\astobj@{*@}" "idx" ?o "Astronomical Objects!" nil)))
+      '(("\\ix@{*@}" "idx" ?x "" nil nil)
+        ("\\nindex@{*@}" "name" ?n "" nil nil)
+        ("\\astobj@{*@}" "idx" ?o "Astronomical Objects!" nil t)))
 @end lisp
 
 Note that the index tag is @samp{idx} for the main index, and
@@ -2156,6 +2418,15 @@
 The following string is empty unless your macro adds a superordinate
 entry to the index key - this is the case for the @code{\astobj} macro.
 
+The next entry can be a hook function to exclude certain matches, it
+almost always can be @code{nil}.
+
+The final element in the list indicates if the text being indexed needs
+to be repeated outside the macro.  For the normal index macros, this
+should be @code{t}.  Only if the macro typesets the entry in the text
+(like @code{\ix} and @code{\nindex} in the example do), this should be
+@code{nil}.
+
 To do the same thing with customize, you need to fill in the templates
 like this:
 
@@ -2167,18 +2438,21 @@
             Access Key     : x
             Key Prefix     : 
             Exclusion hook : nil
+            Repeat Outside : [Toggle]  off (nil)
 [INS] [DEL] List:
             Macro with args: \nindex@{*@}
             Index Tag      : [Value Menu] String: name
             Access Key     : n
             Key Prefix     : 
             Exclusion hook : nil
+            Repeat Outside : [Toggle]  off (nil)
 [INS] [DEL] List:
             Macro with args: \astobj@{*@}
             Index Tag      : [Value Menu] String: idx
             Access Key     : o
             Key Prefix     : Astronomical Objects!
             Exclusion hook : nil
+            Repeat Outside : [Toggle]  on (non-nil)
 [INS]
 @end example
 
@@ -2187,15 +2461,13 @@
 This would be done like this
 
 @lisp
-(setq reftex-index-default-macro '(?x "idx" nil))
+(setq reftex-index-default-macro '(?x "idx"))
 @end lisp
 
 which specifies that the macro identified with the character @code{?x} (the
 @code{\ix} macro) should be used for indexing phrases and words already
 in the buffer with @kbd{C-c /} (@code{reftex-index-selection-or-word}).
-The index tag is "idx", and the final @code{nil} means that it is not
-necessary to repeat the phrase outside the macro, because the macro
-indexes @emph{and} typesets is argument.
+The index tag is "idx".@refill
 
 @node Viewing Cross-References, RefTeXs Menu, Index Support, Top
 @chapter Viewing Cross--References
@@ -2301,6 +2573,8 @@
 @kindex C-c &
 @kindex S-mouse-2
 @kindex C-c /
+@kindex C-c \
+@kindex C-c |
 @kindex C-c <
 @kindex C-c >
 @example
@@ -2311,6 +2585,8 @@
 @kbd{C-c &}      @code{reftex-view-crossref}
 @kbd{S-mouse-2}  @code{reftex-mouse-view-crossref}
 @kbd{C-c /}      @code{reftex-index-selection-or-word}
+@kbd{C-c \}      @code{reftex-index-phrase-selection-or-word}
+@kbd{C-c |}      @code{reftex-index-visit-phrases-buffer}
 @kbd{C-c <}      @code{reftex-index}
 @kbd{C-c >}      @code{reftex-display-index}
 @end example
@@ -2795,7 +3071,7 @@
      (if (fboundp 'reftex-add-label-environments)
          (reftex-add-label-environments
           '(("proposition" ?p "prop:" "~\\ref@{%s@}" t
-                           ("Proposition" "Prop.")))))))
+                           ("Proposition" "Prop.") -3))))))
 @end group
 @end lisp
 
@@ -2843,8 +3119,8 @@
       '("aindex" TeX-arg-index))
      (if (fboundp 'reftex-add-index-macros)
          (reftex-add-index-macros
-          '(("molec@{*@}" "idx" ?m "Molecules!" nil)
-            ("aindex@{*@}" "author" ?a "" nil))))))
+          '(("molec@{*@}" "idx" ?m "Molecules!" nil nil)
+            ("aindex@{*@}" "author" ?a "" nil nil))))))
 @end lisp
 
 @findex reftex-add-section-levels
@@ -2868,7 +3144,7 @@
 
 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
-some support for that: @code{reftex-view-crossref} (bound to @kbd{C-c
+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
@@ -2984,8 +3260,8 @@
 @group
 ;; Configuration for Lamport's pf.sty
 (setq reftex-label-alist
-    '(("\\step@{*@}@{@}"       ?p "st:" "~\\stepref@{%s@}" 2 ("Step" "St."))
-      ("\\begin@{step+@}@{*@}" ?p "st:" "~\\stepref@{%s@}" 1000)))
+  '(("\\step@{*@}@{@}"       ?p "st:" "~\\stepref@{%s@}" 2 ("Step" "St."))
+    ("\\begin@{step+@}@{*@}" ?p "st:" "~\\stepref@{%s@}" 1000)))
 @end group
 @end lisp
 
@@ -3068,12 +3344,12 @@
 features described in this manual.@refill
 
 Thanks to the people on the Net who have used @b{Ref@TeX{}} and helped
-developing it with their reports.  In particular thanks to
-@i{Fran Burstall, Alastair Burt, Soren Dayton, Stephen Eglen, Karl
-Eichwalder, Peter Galbraith, Kai Grossjohann, Dieter Kraft, 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}.@refill
+developing it with their reports.  In particular thanks to @i{Fran
+Burstall, Alastair Burt, Soren Dayton, Stephen Eglen, Karl Eichwalder,
+Peter Galbraith, Kai Grossjohann, Frank Harrell, Dieter Kraft, 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}.@refill
 
 The @code{view-crossref} feature was inspired by @i{Peter Galbraith's}
 @file{bib-cite.el}.@refill
@@ -3086,8 +3362,10 @@
 @chapter Commands
 @cindex Commands, list of
 
-Here is a summary of @b{Ref@TeX{}}'s commands.  All commands are available
-from the @code{Ref} menu.  For keybindings, @pxref{Keybindings}.
+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
+not described here.  All commands are available from the @code{Ref}
+menu.  For keybindings, @pxref{Keybindings}.
 
 @deffn Command reftex-toc
 Show the table of contents for the current document.  When called with
@@ -3143,6 +3421,24 @@
 @code{reftex-index-math-format}, which see.@refill
 @end deffn
 
+@deffn Command reftex-index-phrase-selection-or-word
+Add current selection or the word at point to the phrases buffer.
+When you are in transient-mark-mode and the region is active, the
+selection will be used - otherwise the word at point.
+You get a chance to edit the entry in the phrases buffer - to save the
+buffer and return to the LaTeX document, finish with @kbd{C-c C-c}.
+@end deffn
+
+@deffn Command reftex-index-visit-phrases-buffer
+Switch to the phrases buffer, initialize if empty.
+@end deffn
+
+@deffn Command reftex-index-phrases-apply-to-region
+Index all index phrases in the current region.
+This works exactly like global indexing from the index phrases buffer,
+but operation is restricted to the current region.
+@end deffn
+
 @deffn Command reftex-display-index
 Display a buffer with an index compiled from the current document.
 When the document has multiple indices, first prompts for the correct one.
@@ -3152,21 +3448,6 @@
 With prefix 3, restrict index to active region.@refill
 @end deffn
 
-@deffn Command reftex-index-globally
-Index a word with a global search and replace.  This works very much
-like @code{reftex-query-replace-document}, but the defaults for the
-search and replace strings are derived from local context.  When there
-is an index entry, we try to index similar words.  The word to search
-for is the word in direct contact with the index macro (like
-@samp{\index@{@var{word}@}@var{word}} or
-@samp{@var{word}\index@{@var{word}@}}).  If there is no such word, we
-use the the index key.  The replacement text is the index macro with all
-its arguments and the attached word.  When there is no index entry at
-point, we search for the word near point and propose to index it like
-this: @samp{\index@{@var{word}@}@var{word}}.  You get a chance to edit
-the search and replacement strings.@refill
-@end deffn
-
 @deffn Command reftex-view-crossref
 View cross reference of macro at point.  Point must be on the @var{key}
 argument.  Works with the macros @code{\label}, @code{\ref},
@@ -3278,6 +3559,13 @@
 @cindex Options, table of contents
 @cindex Table of contents, options
 
+@defopt reftex-toc-max-level
+The maximum level of toc entries which will be included in the TOC.
+Section headings with a bigger level will be ignored.  In RefTeX,
+chapters are level 1, sections level 2 etc.  This variable can be
+changed from within the @file{*toc*} buffer with the @kbd{t} key.@refill
+@end defopt
+
 @defopt reftex-toc-keep-other-windows
 Non-@code{nil} means, split the selected window to display the
 @file{*toc*} buffer.  This helps to keep the window configuration, but
@@ -3352,7 +3640,7 @@
 
 @example
  (@var{env-or-macro}  @var{type-key}  @var{label-prefix}  @var{reference-format}
-    @var{context-method}  (@var{magic-word} ... ))
+    @var{context-method}  (@var{magic-word} ... )  @var{toc-level})
 @end example
 
 Each list entry describes either an environment carrying a counter for
@@ -3478,8 +3766,16 @@
 @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
-expressions@footnote{Careful:  @b{Ref@TeX{}} will add stuff to the
-beginning and end of these regular expressions.}.@refill
+expressions.@refill
+
+@item @var{toc-level}
+The integer level at which this environment should be added to the table
+of contents.  See also @code{reftex-section-levels}.  A positive value
+will number the entries mixed with the sectioning commands of the same
+level.  A negative value will make unnumbered entries.  Useful only for
+theorem-like environments which structure the document.  Will be ignored
+for macros.  When omitted or @code{nil}, no TOC entries will be
+made.@refill
 @end table
 
 If the type indicator characters of two or more entries are the same,
@@ -3507,7 +3803,7 @@
 @code{car} of each cons cell is the name of the section macro.  The
 @code{cdr} is a number indicating its level.  A negative level means the
 same as the positive value, but the section will never get a
-number.  The @code{cdr} amy also be a function which then has to return
+number.  The @code{cdr} may also be a function which then has to return
 the level.@refill
 @end defopt
 
@@ -3923,7 +4219,7 @@
 List of macros which define index entries.  The structure of each entry
 is
 @lisp
-(@var{macro} @var{index-tag} @var{key} @var{prefix} @var{exclude})
+(@var{macro} @var{index-tag} @var{key} @var{prefix} @var{exclude} @var{repeat})
 @end lisp
 
 @var{macro} is the macro.  Arguments should be denoted by empty braces,
@@ -3949,6 +4245,11 @@
 implemented to support the (deprecated) @samp{^} and @samp{_} shortcuts
 in the LaTeX2e @code{index} package.@refill
 
+@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
+index macro.  Needed for @code{reftex-index-selection-or-word} and for
+indexing from the phrase buffer.@refill
+
 The final entry may also be a symbol.  It must have an association in
 the variable @code{reftex-index-macros-builtin} to specify the main
 indexing package you are using.  Legal values are currently@refill
@@ -3966,7 +4267,7 @@
 
 @defopt reftex-index-default-macro
 The default index macro for @code{reftex-index-selection-or-word}.
-This is a list with @code{(@var{macro-key} @var{default-tag} @var{repeat-word})}.
+This is a list with @code{(@var{macro-key} @var{default-tag})}.
 
 @var{macro-key} is a character identifying an index macro - see
 @code{reftex-index-macros}.
@@ -3975,11 +4276,7 @@
 @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
 TAG argument of the index macro is optional, the TAG argument will be
-omitted.
-
-@var{repeat-word}, when 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 index macro.
+omitted.@refill
 @end defopt
 
 @defopt reftex-index-default-tag
@@ -4004,14 +4301,90 @@
 @file{texmathp.el} library which is part of AUCTeX.@refill
 @end defopt
 
+@defopt reftex-index-phrases-logical-and-regexp
+Regexp matching the @samp{and} operator for index arguments in phrases
+file.  When several index arguments in a phrase line are separated by
+this operator, each part will generate an index macro.  So each match of
+the search phrase will produce @emph{several} different index entries.
+Make sure this does no match things which are not separators.  This
+logical @samp{and} has higher priority than the logical @samp{or}
+specified in @code{reftex-index-phrases-logical-or-regexp}.@refill
+@end defopt
+
+@defopt reftex-index-phrases-logical-or-regexp
+Regexp matching the @samp{or} operator for index arguments in phrases
+file.  When several index arguments in a phrase line are separated by
+this operator, the user will be asked to select one of them at each
+match of the search phrase.  The first index arg will be the default.  A
+number key @kbd{1}--@kbd{9} must be pressed to switch to another.  Make
+sure this does no match things which are not separators.  The logical
+@samp{and} specified in @code{reftex-index-phrases-logical-or-regexp}
+has higher priority than this logical @samp{or}.@refill
+@end defopt
+
+@defopt reftex-index-phrases-search-whole-words
+Non-@code{nil} means phrases search will look for whole words, not subwords.
+This works by requiring word boundaries at the beginning and end of
+the search string.  When the search phrase already has a non-word-char
+at one of these points, no word boundary is required there.
+@end defopt
+
+@defopt reftex-index-phrases-case-fold-search
+Non-@code{nil} means, searching for index phrases will ignore
+case.@refill
+@end defopt
+
+@defopt reftex-index-phrases-skip-indexed-matches
+Non-@code{nil} means, skip matches which appear to be indexed already.
+When doing global indexing from the phrases buffer, searches for some
+phrases may match at places where that phrase was already indexed.  In
+particular when indexing an already processed document again, this
+will even be the norm.  When this variable is non-@code{nil},
+@b{Ref@TeX{}} checks if the match is an index macro argument, or if an
+index macro is directly before or after the phrase.  If that is the
+case, that match will be ignored.@refill
+@end defopt
+
+@defopt reftex-index-phrases-wrap-long-lines
+Non-@code{nil} means, when indexing from the phrases buffer, wrap lines.
+Inserting indexing commands in a line makes the line longer - often
+so long that it does not fit onto the screen.  When this variable is
+non-@code{nil}, newlines will be added as necessary before and/or after the
+indexing command to keep lines short.  However, the matched text
+phrase and its index command will always end up on a single line.@refill
+@end defopt
+
+@defopt reftex-index-phrases-sort-prefers-entry
+Non-@code{nil} means when sorting phrase lines, the explicit index entry
+is used. Phrase lines in the phrases buffer contain a search phrase, and
+sorting is normally based on these.  Some phrase lines also have
+an explicit index argument specified.  When this variable is
+non-@code{nil}, the index argument will be used for sorting.@refill
+@end defopt
+
+@defopt reftex-index-phrases-sort-in-blocks
+Non-@code{nil} means, empty and comment lines separate phrase buffer
+into blocks.  Sorting will then preserve blocks, so that lines are
+re-arranged only within blocks.
+@end defopt
+
+@defopt reftex-index-phrases-map
+Keymap for the Index Phrases buffer.
+@end defopt
+
+@defopt reftex-index-phrases-mode-hook
+Normal hook which is run when a buffer is put into
+@code{reftex-index-phrases-mode}.@refill
+@end defopt
+
 @defopt reftex-index-section-letters
 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, 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.@refill
+thinks is correct.  In addition to these letters, @b{Ref@TeX{}} 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.@refill
 @end defopt
 
 @defopt reftex-index-include-context
@@ -4445,11 +4818,11 @@
 Normal hook which is being run when turning on @b{Ref@TeX{}} mode.@refill
 @end deffn
 
-Furthermore, the 3 modes used for referencing labels, creating citations
-and for the table of contents 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{}}.@refill
+Furthermore, the 4 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{}}.@refill
 
 @node Changes, , Keymaps and Hooks, Top
 @chapter Changes
@@ -4903,7 +5276,6 @@
 @emph{kpathsearch} support.  See new options and
 @code{reftex-bibpath-environment-variables}.
 @end itemize
-@end ignore
 @noindent @b{Version 3.42}
 @itemize @bullet
 @item
@@ -4932,6 +5304,7 @@
 @item
 Reading a parse file now checks consistency.
 @end itemize
+@end ignore
 @noindent @b{Version 4.00}
 @itemize @bullet
 @item
@@ -4980,7 +5353,30 @@
 @item
 Multiple @code{thebibliography} environments recognized.
 @end itemize
-
+@noindent @b{Version 4.09}
+@itemize @bullet
+@item
+New option @code{reftex-toc-max-level} to limit the depth of the toc.
+New keybinding @kbd{t} in the @file{*toc*} buffer to change this
+setting.@refill 
+@item
+RefTeX maintaines an @file{Index Phrases} file in which phrases can be 
+collected.  When the document is ready, RefTeX can search all
+these phrases and assist indexing all matches.@refill
+@item
+The variables @code{reftex-index-macros} and
+@code{reftex-index-default-macro} have changed their syntax slightly.
+The @var{repeat} parameter has move from the latter to the former.
+Also calls to @code{reftex-add-index-macros} from AUCTeX style files
+need to be adapted.@refill
+@item
+The variable @code{reftex-section-levels} no longer contains the
+default stuff which has been moved to a constant.@refill
+@item
+Environments like theorems can be placed into the TOC by putting
+entries for @samp{"begin@{theorem@}"} in
+@code{reftex-setion-levels}.@refill 
+@end itemize
 
 @node Index,  , , Top
 @unnumbered Index