]> code.delx.au - gnu-emacs/blob - doc/misc/reftex.texi
Merge from trunk.
[gnu-emacs] / doc / misc / reftex.texi
1 \input texinfo @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename ../../info/reftex
4 @settitle RefTeX User Manual
5 @synindex ky cp
6 @syncodeindex vr cp
7 @syncodeindex fn cp
8
9 @ifnottex
10 @macro RefTeX {}
11 Ref@TeX{}
12 @end macro
13 @macro AUCTeX {}
14 AUC@TeX{}
15 @end macro
16 @macro BibTeX {}
17 Bib@TeX{}
18 @end macro
19 @macro ConTeXt {}
20 Con@TeX{}t
21 @end macro
22 @end ifnottex
23 @tex
24 \gdef\RefTeX{Ref\TeX}
25 \gdef\AUCTeX{AUC\TeX}
26 \gdef\BibTeX{Bib\TeX}
27 \gdef\ConTeXt{Con\TeX t}
28 @end tex
29
30 @include emacsver.texi
31
32 @set VERSION @value{EMACSVER}
33 @set AUCTEXSITE @uref{http://www.gnu.org/software/auctex/,@AUCTeX{} web site}
34 @set MAINTAINERSITE @uref{http://www.gnu.org/software/auctex/reftex.html,@RefTeX{} web page}
35 @set MAINTAINERCONTACT @uref{mailto:auctex-devel@@gnu.org,contact the maintainers}
36 @set MAINTAINER the @AUCTeX{} project
37 @set SUPPORTADDRESS @AUCTeX{} user mailing list (@email{auctex@@gnu.org})
38 @set DEVELADDRESS @AUCTeX{} developer mailing list (@email{auctex-devel@@gnu.org})
39 @set BUGADDRESS @AUCTeX{} bug mailing list (@email{bug-auctex@@gnu.org})
40 @set XEMACSFTP @uref{ftp://ftp.xemacs.org/pub/xemacs/packages/,XEmacs FTP site}
41 @c %**end of header
42
43 @copying
44 This manual documents @RefTeX{} (version @value{VERSION}), a package
45 to do labels, references, citations and indices for LaTeX documents
46 with Emacs.
47
48 Copyright @copyright{} 1997--2013 Free Software Foundation, Inc.
49
50 @quotation
51 Permission is granted to copy, distribute and/or modify this document
52 under the terms of the GNU Free Documentation License, Version 1.3 or
53 any later version published by the Free Software Foundation; with no
54 Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
55 and with the Back-Cover Texts as in (a) below. A copy of the license
56 is included in the section entitled ``GNU Free Documentation License''.
57
58 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
59 modify this GNU manual.''
60 @end quotation
61 @end copying
62
63 @dircategory Emacs misc features
64 @direntry
65 * RefTeX: (reftex). Emacs support for LaTeX cross-references
66 and citations.
67 @end direntry
68
69 @finalout
70
71 @c Macro definitions
72
73 @c Subheadings inside a table. Need a difference between info and the rest.
74 @macro tablesubheading{text}
75 @ifinfo
76 @subsubheading \text\
77 @end ifinfo
78 @ifnotinfo
79 @item @b{\text\}
80 @end ifnotinfo
81 @end macro
82
83 @titlepage
84 @title @RefTeX{} User Manual
85 @subtitle Support for @LaTeX{} labels, references, citations and index entries with GNU Emacs
86 @subtitle Version @value{VERSION}
87
88 @author by Carsten Dominik
89 @page
90 @vskip 0pt plus 1filll
91 @insertcopying
92 @end titlepage
93
94 @summarycontents
95 @contents
96
97 @ifnottex
98 @node Top
99 @top @RefTeX{}
100
101 @RefTeX{} is a package for managing Labels, References, Citations and
102 index entries with GNU Emacs.
103
104 This manual documents @RefTeX{} version @value{VERSION}.
105
106 Don't be discouraged by the size of this manual, which covers @RefTeX{}
107 in great depth. All you need to know to use @RefTeX{} can be summarized
108 on two pages (@pxref{RefTeX in a Nutshell}). You can go back later to
109 other parts of this document when needed.
110
111 @menu
112 * Introduction:: Quick-Start information.
113
114 * Table of Contents:: A Tool to move around quickly.
115 * Labels and References:: Creating and referencing labels.
116 * Citations:: Creating Citations.
117 * Index Support:: Creating and Checking Index Entries.
118 * Viewing Cross-References:: Who references or cites what?
119
120 * RefTeXs Menu:: The Ref menu in the menubar.
121 * Key Bindings:: The default key bindings.
122 * Faces:: Fontification of RefTeX's buffers.
123 * Multifile Documents:: Document spread over many files.
124 * Language Support:: How to support other languages.
125 * Finding Files:: Included @TeX{} files and @BibTeX{} .bib files.
126 * Optimizations:: When RefTeX is too slow.
127 * AUCTeX:: Cooperation with @AUCTeX{}.
128 * Problems and Work-Arounds:: First Aid.
129 * Imprint:: Author, Web-site, Thanks
130
131 * Commands:: Which are the available commands.
132 * Options:: How to extend and configure RefTeX.
133 * Changes:: A List of recent changes to RefTeX.
134 * GNU Free Documentation License:: The license for this documentation.
135
136 The Index
137
138 * Index:: The full index.
139
140 @detailmenu
141 --- The Detailed Node Listing ---
142
143 Introduction
144
145 * Installation:: How to install and activate RefTeX.
146 * RefTeX in a Nutshell:: A brief summary and quick guide.
147
148 Labels and References
149
150 * Creating Labels::
151 * Referencing Labels::
152 * Builtin Label Environments:: The environments RefTeX knows about.
153 * Defining Label Environments:: ... and environments it doesn't.
154 * Reference Info:: View the label corresponding to a \ref.
155 * Reference Styles:: Macros to be used instead of \ref.
156 * LaTeX xr Package:: References to external documents.
157
158 Defining Label Environments
159
160 * Theorem and Axiom:: Defined with @code{\newenvironment}.
161 * Quick Equation:: When a macro sets the label type.
162 * Figure Wrapper:: When a macro argument is a label.
163 * Adding Magic Words:: Other words for other languages.
164 * Using \eqref:: How to switch to this AMS-LaTeX macro.
165 * Non-Standard Environments:: Environments without \begin and \end
166 * Putting it Together:: How to combine many entries.
167
168 Citations
169
170 * Creating Citations:: How to create them.
171 * Citation Styles:: Natbib, Harvard, Chicago and Co.
172 * Citation Info:: View the corresponding database entry.
173 * Chapterbib and Bibunits:: Multiple bibliographies in a Document.
174 * Citations Outside LaTeX:: How to make citations in Emails etc.
175 * BibTeX Database Subsets:: Extract parts of a big database.
176
177 Index Support
178
179 * Creating Index Entries:: Macros and completion of entries.
180 * The Index Phrases File:: A special file for global indexing.
181 * Displaying and Editing the Index:: The index editor.
182 * Builtin Index Macros:: The index macros RefTeX knows about.
183 * Defining Index Macros:: ... and macros it doesn't.
184
185 The Index Phrases File
186
187 * Collecting Phrases:: Collecting from document or external.
188 * Consistency Checks:: Check for duplicates etc.
189 * Global Indexing:: The interactive indexing process.
190
191 AUCTeX
192
193 * AUCTeX-RefTeX Interface:: How both packages work together
194 * Style Files:: @AUCTeX{}'s style files can support RefTeX
195 * Bib-Cite:: Hypertext reading of a document
196
197 Options, Keymaps, Hooks
198
199 * Options - Table of Contents::
200 * Options - Defining Label Environments::
201 * Options - Creating Labels::
202 * Options - Referencing Labels::
203 * Options - Creating Citations::
204 * Options - Index Support::
205 * Options - Viewing Cross-References::
206 * Options - Finding Files::
207 * Options - Optimizations::
208 * Options - Fontification::
209 * Options - Misc::
210
211 @end detailmenu
212 @end menu
213
214 @end ifnottex
215
216 @node Introduction
217 @chapter Introduction
218 @cindex Introduction
219
220 @RefTeX{} is a specialized package for support of labels, references,
221 citations, and the index in @LaTeX{}. @RefTeX{} wraps itself round four
222 @LaTeX{} macros: @code{\label}, @code{\ref}, @code{\cite}, and
223 @code{\index}. Using these macros usually requires looking up different
224 parts of the document and searching through @BibTeX{} database files.
225 @RefTeX{} automates these time-consuming tasks almost entirely. It also
226 provides functions to display the structure of a document and to move
227 around in this structure quickly.
228
229 @iftex
230 Don't be discouraged by the size of this manual, which covers @RefTeX{}
231 in great depth. All you need to know to use @RefTeX{} can be
232 summarized on two pages (@pxref{RefTeX in a Nutshell}). You can go
233 back later to other parts of this document when needed.
234 @end iftex
235
236 @xref{Imprint}, for information about who to contact for help, bug
237 reports or suggestions.
238
239 @menu
240 * Installation:: How to install and activate RefTeX.
241 * RefTeX in a Nutshell:: A brief summary and quick guide.
242 @end menu
243
244 @node Installation
245 @section Installation
246 @cindex Installation
247
248 @RefTeX{} has been bundled and pre-installed with Emacs since
249 version 20.2. It has also been bundled and pre-installed with XEmacs
250 19.16--20.x. XEmacs 21.x users want to install the corresponding
251 plug-in package which is available from the @value{XEMACSFTP}. See the
252 XEmacs 21.x documentation on package installation for details.
253
254 Users of earlier Emacs distributions (including Emacs 19) or people
255 craving for new features and bugs can get a copy of the @RefTeX{}
256 distribution from the maintainer's web page. @xref{Imprint}, for more
257 information. The following instructions will guide you through the
258 process of installing such a distribution.
259
260 @subsection Building and Installing
261
262 Note: Currently installation is supported for Emacs only. XEmacs users
263 might want to refer to the @RefTeX{} package available through the
264 package system of XEmacs.
265
266 @subsubheading Installation with make
267
268 In order to install RefTeX, unpack the distribution and edit the header
269 of the Makefile. Basically, you need to change the path specifications
270 for Emacs Lisp files and info files. Also, enter the name of your Emacs
271 executable (usually either @samp{emacs} or @samp{xemacs}).
272
273 Then, type
274
275 @example
276 make
277 make install
278 @end example
279
280 to compile and install the code and documentation.
281
282 Per default @RefTeX{} is installed in its own subdirectory which might
283 not be on your load path. In this case, add it to load path with a
284 command like the following, replacing the sample directory with the one
285 where @RefTeX{} is installed in your case.
286
287 @example
288 (add-to-list 'load-path "/path/to/reftex")
289 @end example
290
291 Put this command into your init file before other @RefTeX{}-related
292 settings.
293
294 @subsubheading Installation by Hand
295
296 If you want to get your hands dirty, there is also the possibility to
297 install by manually copying files.
298
299 @enumerate a
300 @item
301 Copy the reftex*.el lisp files to a directory on your load path. Make
302 sure that no old copy of @RefTeX{} shadows these files.
303 @item
304 Byte compile the files. The sequence of compiling should be:
305 reftex-var.el, reftex.el, and then all the others.
306 @item
307 Copy the info file reftex.info to the info directory.
308 @end enumerate
309
310 @subsection Loading @RefTeX{}
311
312 In order to make the most important functions for entering @RefTeX{}
313 mode available add the following line to your init file.
314
315 @example
316 (require 'reftex)
317 @end example
318
319 @subsection Entering @RefTeX{} Mode
320
321 @findex turn-on-reftex
322 @findex reftex-mode
323 @vindex LaTeX-mode-hook
324 @vindex latex-mode-hook
325 To turn @RefTeX{} Mode on and off in a particular buffer, use
326 @kbd{M-x reftex-mode @key{RET}}. To turn on @RefTeX{} Mode for all
327 LaTeX files, add the following lines to your @file{.emacs} file:
328
329 @example
330 (add-hook 'LaTeX-mode-hook 'turn-on-reftex) ; with AUCTeX LaTeX mode
331 (add-hook 'latex-mode-hook 'turn-on-reftex) ; with Emacs latex mode
332 @end example
333
334 That's all!
335
336 To get started, read the documentation, in particular the
337 summary. (@pxref{RefTeX in a Nutshell})
338
339 In order to produce a printed version of the documentation, use
340 @code{make pdf} to produce a reftex.pdf file. Analogously you can use
341 the @code{dvi}, @code{ps}, or @code{html} targets to create DVI,
342 PostScript or HTML files.
343
344 @subsection Environment
345 @cindex Finding files
346 @cindex BibTeX database files, not found
347 @cindex TeX files, not found
348 @cindex @code{TEXINPUTS}, environment variable
349 @cindex @code{BIBINPUTS}, environment variable
350
351 @RefTeX{} needs to access all files which are part of a multifile
352 document, and the BibTeX database files requested by the
353 @code{\bibliography} command. To find these files, @RefTeX{} will
354 require a search path, i.e., a list of directories to check. Normally
355 this list is stored in the environment variables @code{TEXINPUTS} and
356 @code{BIBINPUTS} which are also used by @RefTeX{}. However, on some
357 systems these variables do not contain the full search path. If
358 @RefTeX{} does not work for you because it cannot find some files,
359 @xref{Finding Files}.
360
361 @page
362 @node RefTeX in a Nutshell
363 @section @RefTeX{} in a Nutshell
364 @cindex Quick-Start
365 @cindex Getting Started
366 @cindex RefTeX in a Nutshell
367 @cindex Nutshell, RefTeX in a
368
369 @enumerate
370 @item
371 @b{Table of Contents}@* Typing @kbd{C-c =} (@code{reftex-toc}) will show
372 a table of contents of the document. This buffer can display sections,
373 labels and index entries defined in the document. From the buffer, you
374 can jump quickly to every part of your document. Press @kbd{?} to get
375 help.
376
377 @item
378 @b{Labels and References}@* @RefTeX{} helps to create unique labels
379 and to find the correct key for references quickly. It distinguishes
380 labels for different environments, knows about all standard
381 environments (and many others), and can be configured to recognize any
382 additional labeled environments you have defined yourself (variable
383 @code{reftex-label-alist}).
384
385 @itemize @bullet
386 @item
387 @b{Creating Labels}@*
388 Type @kbd{C-c (} (@code{reftex-label}) to insert a label at point.
389 @RefTeX{} will either
390 @itemize @minus
391 @item
392 derive a label from context (default for section labels)
393 @item
394 prompt for a label string (default for figures and tables) or
395 @item
396 insert a simple label made of a prefix and a number (all other
397 environments)
398 @end itemize
399 @noindent
400 Which labels are created how is configurable with the variable
401 @code{reftex-insert-label-flags}.
402
403 @item
404 @b{Referencing Labels}@* To make a reference, type @kbd{C-c )}
405 (@code{reftex-reference}). This shows an outline of the document with
406 all labels of a certain type (figure, equation,...) and some label
407 context. Selecting a label inserts a @code{\ref@{@var{label}@}} macro
408 into the original buffer.
409 @end itemize
410
411 @item
412 @b{Citations}@*
413 Typing @kbd{C-c [} (@code{reftex-citation}) will let you specify a
414 regular expression to search in current @BibTeX{} database files (as
415 specified in the @code{\bibliography} command) and pull out a list of
416 matches for you to choose from. The list is @emph{formatted} and
417 sorted. The selected article is referenced as @samp{\cite@{@var{key}@}}
418 (see the variable @code{reftex-cite-format} if you want to insert
419 different macros).
420
421 @item
422 @b{Index Support}@*
423 @RefTeX{} helps to enter index entries. It also compiles all
424 entries into an alphabetically sorted @file{*Index*} buffer which you
425 can use to check and edit the entries. @RefTeX{} knows about the
426 standard index macros and can be configured to recognize any additional
427 macros you have defined (@code{reftex-index-macros}). Multiple indices
428 are supported.
429
430 @itemize @bullet
431 @item
432 @b{Creating Index Entries}@*
433 To index the current selection or the word at point, type @kbd{C-c /}
434 (@code{reftex-index-selection-or-word}). The default macro
435 @code{reftex-index-default-macro} will be used. For a more complex entry
436 type @kbd{C-c <} (@code{reftex-index}), select any of the index macros
437 and enter the arguments with completion.
438
439 @item
440 @b{The Index Phrases File (Delayed Indexing)}@*
441 Type @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word}) to add
442 the current word or selection to a special @emph{index phrase file}.
443 @RefTeX{} can later search the document for occurrences of these
444 phrases and let you interactively index the matches.
445
446 @item
447 @b{Displaying and Editing the Index}@*
448 To display the compiled index in a special buffer, type @kbd{C-c >}
449 (@code{reftex-display-index}). From that buffer you can check and edit
450 all entries.
451 @end itemize
452
453 @page
454 @item @b{Viewing Cross-References}@*
455 When point is on the @var{key} argument of a cross-referencing macro
456 (@code{\label}, @code{\ref}, @code{\cite}, @code{\bibitem},
457 @code{\index}, and variations) or inside a @BibTeX{} database entry, you
458 can press @kbd{C-c &} (@code{reftex-view-crossref}) to display
459 corresponding locations in the document and associated @BibTeX{} database
460 files. @*
461 When the enclosing macro is @code{\cite} or @code{\ref} and no other
462 message occupies the echo area, information about the citation or label
463 will automatically be displayed in the echo area.
464
465 @item
466 @b{Multifile Documents}@*
467 Multifile Documents are fully supported. The included files must have a
468 file variable @code{TeX-master} or @code{tex-main-file} pointing to the
469 master file. @RefTeX{} provides cross-referencing information from
470 all parts of the document, and across document borders
471 (@file{xr.sty}).
472
473 @item
474 @b{Document Parsing}@* @RefTeX{} needs to parse the document in
475 order to find labels and other information. It does it automatically
476 once and updates its list internally when @code{reftex-label} and
477 @code{reftex-index} are used. To enforce reparsing, call any of the
478 commands described above with a raw @kbd{C-u} prefix, or press the
479 @kbd{r} key in the label selection buffer, the table of contents
480 buffer, or the index buffer.
481
482 @item
483 @b{@AUCTeX{}} @* If your major @LaTeX{} mode is @AUCTeX{}, @RefTeX{} can
484 cooperate with it (see variable @code{reftex-plug-into-AUCTeX}). @AUCTeX{}
485 contains style files which trigger appropriate settings in
486 @RefTeX{}, so that for many of the popular @LaTeX{} packages no
487 additional customizations will be necessary.
488
489 @item
490 @b{Useful Settings}@*
491 To integrate RefTeX with @AUCTeX{}, use
492 @lisp
493 (setq reftex-plug-into-AUCTeX t)
494 @end lisp
495
496 To make your own @LaTeX{} macro definitions known to @RefTeX{},
497 customize the variables
498 @example
499 @code{reftex-label-alist} @r{(for label macros/environments)}
500 @code{reftex-section-levels} @r{(for sectioning commands)}
501 @code{reftex-cite-format} @r{(for @code{\cite}-like macros)}
502 @code{reftex-index-macros} @r{(for @code{\index}-like macros)}
503 @code{reftex-index-default-macro} @r{(to set the default macro)}
504 @end example
505 If you have a large number of macros defined, you may want to write
506 an @AUCTeX{} style file to support them with both @AUCTeX{} and
507 @RefTeX{}.
508
509 @item @b{Where Next?}@* Go ahead and use @RefTeX{}. Use its menus
510 until you have picked up the key bindings. For an overview of what you
511 can do in each of the different special buffers, press @kbd{?}. Read
512 the manual if you get stuck, or if you are curious what else might be
513 available. The first part of the manual explains in
514 a tutorial way how to use and customize @RefTeX{}. The second
515 part is a command and variable reference.
516 @end enumerate
517
518 @node Table of Contents
519 @chapter Table of Contents
520 @cindex @file{*toc*} buffer
521 @cindex Structure editing
522 @cindex Table of contents buffer
523 @findex reftex-toc
524 @kindex C-c =
525
526 Pressing the keys @kbd{C-c =} pops up a buffer showing the table of
527 contents of the document. By default, this @file{*toc*} buffer shows
528 only the sections of a document. Using the @kbd{l} and @kbd{i} keys you
529 can display all labels and index entries defined in the document as
530 well.
531
532 With the cursor in any of the lines denoting a location in the
533 document, simple key strokes will display the corresponding part in
534 another window, jump to that location, or perform other actions.
535
536 @kindex ?
537 Here is a list of special commands in the @file{*toc*} buffer. A
538 summary of this information is always available by pressing
539 @kbd{?}.
540
541 @table @kbd
542
543 @tablesubheading{General}
544 @item ?
545 Display a summary of commands.
546
547 @item 0-9, -
548 Prefix argument.
549
550 @tablesubheading{Moving around}
551 @item n
552 Goto next entry in the table of contents.
553
554 @item p
555 Goto previous entry in the table of contents.
556
557 @item C-c C-n
558 Goto next section heading. Useful when many labels and index entries
559 separate section headings.
560
561 @item C-c C-p
562 Goto previous section heading.
563
564 @item N z
565 Jump to section N, using the prefix arg. For example, @kbd{3 z} jumps
566 to section 3.
567
568 @tablesubheading{Access to document locations}
569 @item @key{SPC}
570 Show the corresponding location in another window. This command does
571 @emph{not} select that other window.
572
573 @item @key{TAB}
574 Goto the location in another window.
575
576 @item @key{RET}
577 Go to the location and hide the @file{*toc*} buffer. This will restore
578 the window configuration before @code{reftex-toc} (@kbd{C-c =}) was
579 called.
580
581 @item mouse-2
582 @vindex reftex-highlight-selection
583 Clicking with mouse button 2 on a line has the same effect as @key{RET}.
584 See also variable @code{reftex-highlight-selection},
585 @ref{Options - Fontification}.
586
587 @item f
588 @vindex reftex-toc-follow-mode
589 @vindex reftex-revisit-to-follow
590 Toggle follow mode. When follow mode is active, the other window will
591 always show the location corresponding to the line at point in the
592 @file{*toc*} buffer. This is similar to pressing @key{SPC} after each
593 cursor motion. The default for this flag can be set with the variable
594 @code{reftex-toc-follow-mode}. Note that only context in files already
595 visited is shown. @RefTeX{} will not visit a file just for follow
596 mode. See, however, the variable
597 @code{reftex-revisit-to-follow}.
598
599 @item .
600 Show calling point in another window. This is the point from where
601 @code{reftex-toc} was last called.
602
603 @page
604 @tablesubheading{Promotion and Demotion}
605
606 @item <
607 Promote the current section. This will convert @code{\section} to
608 @code{\chapter}, @code{\subsection} to @code{\section} etc. If there is
609 an active region, all sections in the region will be promoted, including
610 the one at point. To avoid mistakes, @RefTeX{} requires a fresh
611 document scan before executing this command; if necessary, it will
612 automatically do this scan and ask the user to repeat the promotion
613 command.
614
615 @item >
616 Demote the current section. This is the opposite of promotion. It will
617 convert @code{\chapter} to @code{\section} etc. If there is an active
618 region, all sections in the region will be demoted, including the one at
619 point.
620
621 @item M-%
622 Rename the label at point. While generally not recommended, this can be
623 useful when a package like @file{fancyref} is used where the label
624 prefix determines the wording of a reference. After a
625 promotion/demotion it may be necessary to change a few labels from
626 @samp{sec:xyz} to @samp{cha:xyz} or vice versa. This command can be
627 used to do this; it launches a query replace to rename the definition
628 and all references of a label.
629
630 @tablesubheading{Exiting}
631 @item q
632 Hide the @file{*toc*} buffer, return to the position where
633 @code{reftex-toc} was last called.
634
635 @item k
636 Kill the @file{*toc*} buffer, return to the position where
637 @code{reftex-toc} was last called.
638
639 @item C-c >
640 Switch to the @file{*Index*} buffer of this document. With prefix
641 @samp{2}, restrict the index to the section at point in the @file{*toc*}
642 buffer.
643
644 @tablesubheading{Controlling what gets displayed}
645
646 @item t
647 @vindex reftex-toc-max-level
648 Change the maximum level of toc entries displayed in the @file{*toc*}
649 buffer. Without prefix arg, all levels will be included. With prefix
650 arg (e.g., @kbd{3 t}), ignore all toc entries with level greater than
651 @var{arg} (3 in this case). Chapters are level 1, sections are level 2.
652 The mode line @samp{T<>} indicator shows the current value. The default
653 depth can be configured with the variable
654 @code{reftex-toc-max-level}.
655
656 @item F
657 @vindex reftex-toc-include-file-boundaries
658 Toggle the display of the file borders of a multifile document in the
659 @file{*toc*} buffer. The default for this flag can be set with the
660 variable @code{reftex-toc-include-file-boundaries}.
661
662 @item l
663 @vindex reftex-toc-include-labels
664 Toggle the display of labels in the @file{*toc*} buffer. The default
665 for this flag can be set with the variable
666 @code{reftex-toc-include-labels}. When called with a prefix argument,
667 @RefTeX{} will prompt for a label type and include only labels of
668 the selected type in the @file{*toc*} buffer. The mode line @samp{L<>}
669 indicator shows which labels are included.
670
671 @item i
672 @vindex reftex-toc-include-index-entries
673 Toggle the display of index entries in the @file{*toc*} buffer. The
674 default for this flag can be set with the variable
675 @code{reftex-toc-include-index-entries}. When called with a prefix
676 argument, @RefTeX{} will prompt for a specific index and include
677 only entries in the selected index in the @file{*toc*} buffer. The mode
678 line @samp{I<>} indicator shows which index is used.
679
680 @item c
681 @vindex reftex-toc-include-context
682 Toggle the display of label and index context in the @file{*toc*}
683 buffer. The default for this flag can be set with the variable
684 @code{reftex-toc-include-context}.
685
686 @tablesubheading{Updating the buffer}
687
688 @item g
689 Rebuild the @file{*toc*} buffer. This does @emph{not} rescan the
690 document.
691
692 @item r
693 @vindex reftex-enable-partial-scans
694 Reparse the @LaTeX{} document and rebuild the @file{*toc*} buffer. When
695 @code{reftex-enable-partial-scans} is non-@code{nil}, rescan only the file this
696 location is defined in, not the entire document.
697
698 @item C-u r
699 Reparse the @emph{entire} @LaTeX{} document and rebuild the @file{*toc*}
700 buffer.
701
702 @item x
703 Switch to the @file{*toc*} buffer of an external document. When the
704 current document is using the @code{xr} package (@pxref{LaTeX xr Package}),
705 @RefTeX{} will switch to one of the external documents.
706
707
708 @tablesubheading{Automatic recentering}
709
710 @item d
711 Toggle the display of a dedicated frame displaying just the @file{*toc*}
712 buffer. Follow mode and visiting locations will not work that frame,
713 but automatic recentering will make this frame always show your current
714 editing location in the document (see below).
715
716 @item a
717 Toggle the automatic recentering of the @file{*toc*} buffer. When this
718 option is on, moving around in the document will cause the @file{*toc*}
719 to always highlight the current section. By default, this option is
720 active while the dedicated @file{*TOC*} frame exists. See also the
721 variable @code{reftex-auto-recenter-toc}.
722
723 @end table
724
725 @vindex reftex-toc-map
726 In order to define additional commands for the @file{*toc*} buffer, the
727 keymap @code{reftex-toc-map} may be used.
728
729 @findex reftex-toc-recenter
730 @vindex reftex-auto-recenter-toc
731 @vindex reftex-idle-time
732 @cindex @file{*toc*} buffer, recentering
733 @cindex Table of contents buffer, recentering
734 @kindex C-c -
735 If you call @code{reftex-toc} while the @file{*toc*} buffer already
736 exists, the cursor will immediately jump to the right place, i.e., the
737 section from which @code{reftex-toc} was called will be highlighted.
738 The command @kbd{C-c -} (@code{reftex-toc-recenter}) will only redisplay
739 the @file{*toc*} buffer and highlight the correct line without actually
740 selecting the @file{*toc*} window. This can be useful to quickly find
741 out where in the document you currently are. You can also automate this
742 by asking RefTeX to keep track of your current editing position in the
743 TOC@. The TOC window will then be updated whenever you stop typing for
744 more than @code{reftex-idle-time} seconds. By default this works only
745 with the dedicated @file{*TOC*} frame. But you can also force automatic
746 recentering of the TOC window on the current frame with
747 @lisp
748 (setq reftex-auto-recenter-toc t)
749 @end lisp
750
751
752 @cindex Sectioning commands
753 @cindex KOMA-Script, LaTeX classes
754 @cindex LaTeX classes, KOMA-Script
755 @cindex TOC entries for environments
756 @vindex reftex-section-levels
757 The section macros recognized by @RefTeX{} are all @LaTeX{} section
758 macros (from @code{\part} to @code{\subsubparagraph}) and the commands
759 @code{\addchap} and @code{\addsec} from the KOMA-Script classes.
760 Additional macros can be configured with the variable
761 @code{reftex-section-levels}. It is also possible to add certain @LaTeX{}
762 environments to the table of contents. This is probably only useful for
763 theorem-like environments. @xref{Defining Label Environments}, for an
764 example.
765
766 @node Labels and References
767 @chapter Labels and References
768 @cindex Labels in LaTeX
769 @cindex References in LaTeX
770 @cindex Label category
771 @cindex Label environment
772 @cindex @code{\label}
773
774 @LaTeX{} provides a powerful mechanism to deal with cross-references in a
775 document. When writing a document, any part of it can be marked with a
776 label, like @samp{\label@{mark@}}. @LaTeX{} records the current value of a
777 certain counter when a label is defined. Later references to this label
778 (like @samp{\ref@{mark@}}) will produce the recorded value of the
779 counter.
780
781 Labels can be used to mark sections, figures, tables, equations,
782 footnotes, items in enumerate lists etc. @LaTeX{} is context sensitive in
783 doing this: A label defined in a figure environment automatically
784 records the figure counter, not the section counter.
785
786 Several different environments can share a common counter and therefore
787 a common label category. For example labels in both @code{equation} and
788 @code{eqnarray} environments record the value of the same counter: the
789 equation counter.
790
791 @menu
792 * Creating Labels::
793 * Referencing Labels::
794 * Builtin Label Environments:: The environments RefTeX knows about.
795 * Defining Label Environments:: ... and environments it doesn't.
796 * Reference Info:: View the label corresponding to a \ref.
797 * Reference Styles:: Macros to be used instead of \ref.
798 * LaTeX xr Package:: References to external documents.
799 @end menu
800
801 @node Creating Labels
802 @section Creating Labels
803 @cindex Creating labels
804 @cindex Labels, creating
805 @cindex Labels, deriving from context
806 @kindex C-c (
807 @findex reftex-label
808
809 In order to create a label in a @LaTeX{} document, press @kbd{C-c (}
810 (@code{reftex-label}). Just like @LaTeX{}, @RefTeX{} is context sensitive
811 and will figure out the environment it currently is in and adapt the
812 label to that environment. A label usually consists of a short prefix
813 indicating the type of the label and a unique mark. @RefTeX{} has
814 three different modes to create this mark.
815
816 @enumerate
817 @item
818 @vindex reftex-translate-to-ascii-function
819 @vindex reftex-derive-label-parameters
820 @vindex reftex-label-illegal-re
821 @vindex reftex-abbrev-parameters
822 A label can be derived from context. This means, @RefTeX{} takes
823 the context of the label definition and constructs a label from
824 that@footnote{Note that the context may contain constructs which are
825 invalid in labels. @RefTeX{} will therefore strip the accent from
826 accented Latin-1 characters and remove everything else which is not
827 valid in labels. This mechanism is safe, but may not be satisfactory
828 for non-western languages. Check the following variables if you need to
829 change things: @code{reftex-translate-to-ascii-function},
830 @code{reftex-derive-label-parameters}, @code{reftex-label-illegal-re},
831 @code{reftex-abbrev-parameters}.}. This works best for section labels,
832 where the section heading is used to construct a label. In fact,
833 @RefTeX{}'s default settings use this method only for section
834 labels. You will be asked to confirm the derived label, or edit
835 it.
836
837 @item
838 We may also use a simple unique number to identify a label. This is
839 mostly useful for labels where it is difficult to come up with a very
840 good descriptive name. @RefTeX{}'s default settings use this method
841 for equations, enumerate items and footnotes. The author of @RefTeX{}
842 tends to write documents with many equations and finds it impossible
843 to come up with good names for each of them. These simple labels are
844 inserted without query, and are therefore very fast. Good descriptive
845 names are not really necessary as @RefTeX{} will provide context to
846 reference a label (@pxref{Referencing Labels}).
847
848 @item
849 The third method is to ask the user for a label. This is most
850 useful for things which are easy to describe briefly and do not turn up
851 too frequently in a document. @RefTeX{} uses this for figures and
852 tables. Of course, one can enter the label directly by typing the full
853 @samp{\label@{mark@}}. The advantage of using @code{reftex-label}
854 anyway is that @RefTeX{} will know that a new label has been defined.
855 It will then not be necessary to rescan the document in order to access
856 this label later.
857 @end enumerate
858
859 @vindex reftex-insert-label-flags
860 If you want to change the way certain labels are created, check out the
861 variable @code{reftex-insert-label-flags} (@pxref{Options - Creating
862 Labels}).
863
864 If you are using @AUCTeX{} to write your @LaTeX{} documents, you can
865 set it up to delegate the creation of labels to
866 @RefTeX{}. @xref{AUCTeX}, for more information.
867
868 @node Referencing Labels
869 @section Referencing Labels
870 @cindex Referencing labels
871 @cindex Labels, referencing
872 @cindex Selection buffer, labels
873 @cindex Selection process
874 @cindex @code{\ref}
875 @kindex C-c )
876 @findex reftex-reference
877
878 @vindex reftex-trust-label-prefix
879 @RefTeX{} scans the document in order to find all labels. To make
880 referencing labels easier, it assigns to each label a category, the
881 @emph{label type} (for example section, table, figure, equation, etc.).
882 In order to determine the label type, @RefTeX{} parses around each label
883 to see in what kind of environments it is located. You can speed up
884 the parsing by using type-specific prefixes for labels and configuring
885 the variable @code{reftex-trust-label-prefix}.
886
887 Referencing Labels is really at the heart of @RefTeX{}. Press @kbd{C-c
888 )} in order to reference a label (@code{reftex-reference}). This will
889 start a selection process and finally insert the complete
890 @samp{\ref@{label@}} into the buffer.
891
892 @vindex reftex-ref-macro-prompt
893 First, you can select which reference macro you want to use,
894 e.g., @samp{\ref} or @samp{\pageref}. Later in the process you have
895 another chance to make this selection and you can therefore disable this
896 step by customizing @code{reftex-ref-macro-prompt} if you find it too
897 intrusive. @xref{Reference Styles}.
898
899 Then, @RefTeX{} will determine the label category which is required.
900 Often that can be figured out from context. For example, if you write
901 @samp{As shown in eq.} and then press @kbd{C-c )}, @RefTeX{} knows that
902 an equation label is going to be referenced. If it cannot figure out
903 what label category is needed, it will query for one.
904
905 You will then be presented with a label selection menu. This is a
906 special buffer which contains an outline of the document along with all
907 labels of the given label category. In addition, next to the label
908 there will be one line of context of the label definition, which is some
909 text in the buffer near the label definition. Usually this is
910 sufficient to identify the label. If you are unsure about a certain
911 label, pressing @key{SPC} will show the label definition point in
912 another window.
913
914 In order to reference a label, move the cursor to the correct label and
915 press @key{RET}. You can also reference several labels with a single
916 call to @code{reftex-reference} by marking entries with the @kbd{m}
917 key (see below).
918
919 @kindex ?
920 Here is a list of special commands in the selection buffer. A summary
921 of this information is always available from the selection process by
922 pressing @kbd{?}.
923
924
925
926 @table @kbd
927 @tablesubheading{General}
928 @item ?
929 Show a summary of available commands.
930
931 @item 0-9,-
932 Prefix argument.
933
934 @tablesubheading{Moving around}
935 @item n
936 Go to next label.
937
938 @item p
939 Go to previous label.
940
941 @item b
942 Jump back to the position where you last left the selection buffer.
943 Normally this should get you back to the last referenced label.
944
945 @item C-c C-n
946 Goto next section heading.
947
948 @item C-c C-p
949 Goto previous section heading.
950
951 @item N z
952 Jump to section N, using the prefix arg. For example @kbd{3 z} jumps to
953 section 3.
954
955 @tablesubheading{Displaying Context}
956 @item @key{SPC}
957 Show the surroundings of the definition of the current label in another
958 window. See also the @kbd{f} key.
959
960 @item f
961 @vindex reftex-revisit-to-follow
962 Toggle follow mode. When follow mode is active, the other window will
963 always display the full context of the current label. This is similar
964 to pressing @key{SPC} after each cursor motion. Note that only context
965 in files already visited is shown. @RefTeX{} will not visit a file
966 just for follow mode. See, however, the variable
967 @code{reftex-revisit-to-follow}.
968
969 @item .
970 Show insertion point in another window. This is the point from where you
971 called @code{reftex-reference}.
972
973 @tablesubheading{Selecting a label and creating the reference}
974 @item @key{RET}
975 Insert a reference to the label at point into the buffer from which the
976 selection process was started. When entries have been marked, @key{RET}
977 references all marked labels.
978
979 @item mouse-2
980 @vindex reftex-highlight-selection
981 Clicking with mouse button 2 on a label will accept it like @key{RET}
982 would. See also variable @code{reftex-highlight-selection},
983 @ref{Options - Misc}.
984
985 @vindex reftex-multiref-punctuation
986 @item m - + ,
987 Mark the current entry. When several entries have been marked, pressing
988 @kbd{RET} will accept all of them and place them into several
989 @code{\ref} macros. The special markers @samp{,-+} also store a
990 separator to be inserted before the corresponding reference. So marking
991 six entries with the keys @samp{m , , - , +} will give a reference list
992 like this (see the variable @code{reftex-multiref-punctuation})
993 @example
994 In eqs. (1), (2), (3)--(4), (5) and (6)
995 @end example
996
997 @item u
998 Unmark a marked entry.
999
1000 @c FIXME: Do we need `A' as well for consistency?
1001 @cindex LaTeX packages, @code{saferef}
1002 @cindex @code{saferef}, LaTeX package
1003 @item a
1004 Accept the marked entries and put all labels as a comma-separated list
1005 into one @emph{single} @code{\ref} macro. Some packages like
1006 @file{saferef.sty} support multiple references in this way.
1007
1008 @item l
1009 Use the last referenced label(s) again. This is equivalent to moving to
1010 that label and pressing @key{RET}.
1011
1012 @item @key{TAB}
1013 Enter a label with completion. This may also be a label which does not
1014 yet exist in the document.
1015
1016 @item v
1017 Cycle forward through active reference macros. The selected macro is
1018 displayed by the @samp{S<...>} indicator in the mode line of the
1019 selection buffer. This mechanism comes in handy if you are using
1020 @LaTeX{} packages like @code{varioref} or @code{fancyref} and want to
1021 use the special referencing macros they provide (e.g., @code{\vref} or
1022 @code{\fref}) instead of @code{\ref}.
1023
1024 @item V
1025 Cycle backward through active reference macros.
1026
1027 @tablesubheading{Exiting}
1028
1029 @item q
1030 Exit the selection process without inserting any reference into the
1031 buffer.
1032
1033 @tablesubheading{Controlling what gets displayed}
1034 @vindex reftex-label-menu-flags
1035 The defaults for the following flags can be configured with the variable
1036 @code{reftex-label-menu-flags} (@pxref{Options - Referencing Labels}).
1037
1038 @item c
1039 Toggle the display of the one-line label definition context in the
1040 selection buffer.
1041
1042 @item F
1043 Toggle the display of the file borders of a multifile document in the
1044 selection buffer.
1045
1046 @item t
1047 Toggle the display of the table of contents in the selection buffer.
1048 With prefix @var{arg}, change the maximum level of toc entries displayed
1049 to @var{arg}. Chapters are level 1, sections are level 2.
1050
1051 @item #
1052 Toggle the display of a label counter in the selection buffer.
1053
1054 @item %
1055 Toggle the display of labels hidden in comments in the selection
1056 buffers. Sometimes, you may have commented out parts of your document.
1057 If these parts contain label definitions, @RefTeX{} can still display
1058 and reference these labels.
1059
1060 @tablesubheading{Updating the buffer}
1061 @item g
1062 Update the menu. This will rebuilt the menu from the internal label
1063 list, but not reparse the document (see @kbd{r}).
1064
1065 @item r
1066 @vindex reftex-enable-partial-scans
1067 Reparse the document to update the information on all labels and rebuild
1068 the menu. If the variable @code{reftex-enable-partial-scans} is
1069 non-@code{nil} and your document is a multifile document, this will
1070 reparse only a part of the document (the file in which the label at
1071 point was defined).
1072
1073 @item C-u r
1074 Reparse the @emph{entire} document.
1075
1076 @item s
1077 Switch the label category. After prompting for another label category,
1078 a menu for that category will be shown.
1079
1080 @item x
1081 Reference a label from an external document. With the @LaTeX{} package
1082 @code{xr} it is possible to reference labels defined in another
1083 document. This key will switch to the label menu of an external
1084 document and let you select a label from there (@pxref{LaTeX xr Package,,xr}).
1085
1086 @end table
1087
1088 @vindex reftex-select-label-map
1089 In order to define additional commands for the selection process, the
1090 keymap @code{reftex-select-label-map} may be used.
1091
1092 @node Builtin Label Environments
1093 @section Builtin Label Environments
1094 @cindex Builtin label environments
1095 @cindex Label environments, builtin
1096 @cindex Environments, builtin
1097 @vindex reftex-label-alist
1098 @vindex reftex-label-alist-builtin
1099
1100 @RefTeX{} needs to be aware of the environments which can be referenced
1101 with a label (i.e., which carry their own counters). By default, @RefTeX{}
1102 recognizes all labeled environments and macros discussed in @cite{The
1103 @LaTeX{} Companion by Goossens, Mittelbach & Samarin, Addison-Wesley
1104 1994.}. These are:
1105
1106 @itemize @minus
1107 @item
1108 @cindex @code{figure}, LaTeX environment
1109 @cindex @code{figure*}, LaTeX environment
1110 @cindex @code{table}, LaTeX environment
1111 @cindex @code{table*}, LaTeX environment
1112 @cindex @code{equation}, LaTeX environment
1113 @cindex @code{eqnarray}, LaTeX environment
1114 @cindex @code{enumerate}, LaTeX environment
1115 @cindex @code{\footnote}, LaTeX macro
1116 @cindex LaTeX macro @code{footnote}
1117 @cindex LaTeX core
1118 @code{figure}, @code{figure*}, @code{table}, @code{table*}, @code{equation},
1119 @code{eqnarray}, @code{enumerate}, the @code{\footnote} macro (this is
1120 the @LaTeX{} core stuff)
1121 @item
1122 @cindex AMS-LaTeX
1123 @cindex @code{amsmath}, LaTeX package
1124 @cindex LaTeX packages, @code{amsmath}
1125 @cindex @code{align}, AMS-LaTeX environment
1126 @cindex @code{gather}, AMS-LaTeX environment
1127 @cindex @code{multline}, AMS-LaTeX environment
1128 @cindex @code{flalign}, AMS-LaTeX environment
1129 @cindex @code{alignat}, AMS-LaTeX environment
1130 @cindex @code{xalignat}, AMS-LaTeX environment
1131 @cindex @code{xxalignat}, AMS-LaTeX environment
1132 @cindex @code{subequations}, AMS-LaTeX environment
1133 @code{align}, @code{gather}, @code{multline}, @code{flalign},
1134 @code{alignat}, @code{xalignat}, @code{xxalignat}, @code{subequations}
1135 (from AMS-@LaTeX{}'s @file{amsmath.sty} package)
1136 @item
1137 @cindex @code{endnote}, LaTeX package
1138 @cindex LaTeX packages, @code{endnote}
1139 @cindex @code{\endnote}, LaTeX macro
1140 the @code{\endnote} macro (from @file{endnotes.sty})
1141 @item
1142 @cindex @code{fancybox}, LaTeX package
1143 @cindex LaTeX packages, @code{fancybox}
1144 @cindex @code{Beqnarray}, LaTeX environment
1145 @code{Beqnarray} (@file{fancybox.sty})
1146 @item
1147 @cindex @code{floatfig}, LaTeX package
1148 @cindex LaTeX packages, @code{floatfig}
1149 @cindex @code{floatingfig}, LaTeX environment
1150 @code{floatingfig} (@file{floatfig.sty})
1151 @item
1152 @cindex @code{longtable}, LaTeX package
1153 @cindex LaTeX packages, @code{longtable}
1154 @cindex @code{longtable}, LaTeX environment
1155 @code{longtable} (@file{longtable.sty})
1156 @item
1157 @cindex @code{picinpar}, LaTeX package
1158 @cindex LaTeX packages, @code{picinpar}
1159 @cindex @code{figwindow}, LaTeX environment
1160 @cindex @code{tabwindow}, LaTeX environment
1161 @code{figwindow}, @code{tabwindow} (@file{picinpar.sty})
1162 @item
1163 @cindex @code{sidecap}, LaTeX package
1164 @cindex LaTeX packages, @code{sidecap}
1165 @cindex @code{SCfigure}, LaTeX environment
1166 @cindex @code{SCtable}, LaTeX environment
1167 @code{SCfigure}, @code{SCtable} (@file{sidecap.sty})
1168 @item
1169 @cindex @code{rotating}, LaTeX package
1170 @cindex LaTeX packages, @code{rotating}
1171 @cindex @code{sidewaysfigure}, LaTeX environment
1172 @cindex @code{sidewaystable}, LaTeX environment
1173 @code{sidewaysfigure}, @code{sidewaystable} (@file{rotating.sty})
1174 @item
1175 @cindex @code{subfig}, LaTeX package
1176 @cindex LaTeX packages, @code{subfigure}
1177 @cindex @code{subfigure}, LaTeX environment
1178 @cindex @code{subfigure*}, LaTeX environment
1179 @code{subfigure}, @code{subfigure*}, the @code{\subfigure} macro
1180 (@file{subfigure.sty})
1181 @item
1182 @cindex @code{supertab}, LaTeX package
1183 @cindex LaTeX packages, @code{supertab}
1184 @cindex @code{supertabular}, LaTeX environment
1185 @code{supertabular} (@file{supertab.sty})
1186 @item
1187 @cindex @code{wrapfig}, LaTeX package
1188 @cindex LaTeX packages, @code{wrapfig}
1189 @cindex @code{wrapfigure}, LaTeX environment
1190 @code{wrapfigure} (@file{wrapfig.sty})
1191 @end itemize
1192
1193 If you want to use other labeled environments, defined with
1194 @code{\newtheorem}, @RefTeX{} needs to be configured to recognize
1195 them (@pxref{Defining Label Environments}).
1196
1197 @node Defining Label Environments
1198 @section Defining Label Environments
1199 @cindex Label environments, defining
1200
1201 @vindex reftex-label-alist
1202 @RefTeX{} can be configured to recognize additional labeled
1203 environments and macros. This is done with the variable
1204 @code{reftex-label-alist} (@pxref{Options - Defining Label
1205 Environments}). If you are not familiar with Lisp, you can use the
1206 @code{custom} library to configure this rather complex variable. To do
1207 this, use
1208
1209 @example
1210 @kbd{M-x customize-variable @key{RET} reftex-label-alist @key{RET}}
1211 @end example
1212
1213 @vindex reftex-label-alist-builtin
1214 Here we will discuss a few examples, in order to make things clearer.
1215 It can also be instructive to look at the constant
1216 @code{reftex-label-alist-builtin} which contains the entries for
1217 all the builtin environments and macros (@pxref{Builtin Label
1218 Environments}).
1219
1220 @menu
1221 * Theorem and Axiom:: Defined with @code{\newenvironment}.
1222 * Quick Equation:: When a macro sets the label type.
1223 * Figure Wrapper:: When a macro argument is a label.
1224 * Adding Magic Words:: Other words for other languages.
1225 * Using \eqref:: How to switch to this AMS-@LaTeX{} macro.
1226 * Non-Standard Environments:: Environments without \begin and \end
1227 * Putting it Together:: How to combine many entries.
1228 @end menu
1229
1230 @node Theorem and Axiom
1231 @subsection Theorem and Axiom Environments
1232 @cindex @code{theorem}, newtheorem
1233 @cindex @code{axiom}, newtheorem
1234 @cindex @code{\newtheorem}
1235
1236 Suppose you are using @code{\newtheorem} in @LaTeX{} in order to define two
1237 new environments, @code{theorem} and @code{axiom}
1238
1239 @example
1240 \newtheorem@{axiom@}@{Axiom@}
1241 \newtheorem@{theorem@}@{Theorem@}
1242 @end example
1243
1244 @noindent
1245 to be used like this:
1246
1247 @example
1248 \begin@{axiom@}
1249 \label@{ax:first@}
1250 ....
1251 \end@{axiom@}
1252 @end example
1253
1254 So we need to tell @RefTeX{} that @code{theorem} and @code{axiom} are new
1255 labeled environments which define their own label categories. We can
1256 either use Lisp to do this (e.g., in @file{.emacs}) or use the custom
1257 library. With Lisp it would look like this
1258
1259 @lisp
1260 (setq reftex-label-alist
1261 '(("axiom" ?a "ax:" "~\\ref@{%s@}" nil ("axiom" "ax.") -2)
1262 ("theorem" ?h "thr:" "~\\ref@{%s@}" t ("theorem" "th.") -3)))
1263 @end lisp
1264
1265 The type indicator characters @code{?a} and @code{?h} are used for
1266 prompts when @RefTeX{} queries for a label type. @code{?h}
1267 was chosen for @code{theorem} since @code{?t} is already taken by
1268 @code{table}. Note that also @code{?s}, @code{?f}, @code{?e},
1269 @code{?i}, @code{?n} are already used for standard environments.
1270
1271 @noindent
1272 The labels for Axioms and Theorems will have the prefixes @samp{ax:} and
1273 @samp{thr:}, respectively. @xref{AUCTeX}, for information on how
1274 @AUCTeX{} can use @RefTeX{} to automatically create labels when a new
1275 environment is inserted into a buffer. Additionally, the following
1276 needs to be added to one's .emacs file before @AUCTeX{} will
1277 automatically create labels for the new environments.
1278
1279 @lisp
1280 (add-hook 'LaTeX-mode-hook
1281 (lambda ()
1282 (LaTeX-add-environments
1283 '("axiom" LaTeX-env-label)
1284 '("theorem" LaTeX-env-label))))
1285 @end lisp
1286
1287
1288 @noindent
1289 The @samp{~\ref@{%s@}} is a format string indicating how to insert
1290 references to these labels.
1291
1292 @noindent
1293 The next item indicates how to grab context of the label definition.
1294 @itemize @minus
1295 @item
1296 @code{t} means to get it from a default location (from the beginning of
1297 a @code{\macro} or after the @code{\begin} statement). @code{t} is
1298 @emph{not} a good choice for eqnarray and similar environments.
1299 @item
1300 @code{nil} means to use the text right after the label definition.
1301 @item
1302 For more complex ways of getting context, see the variable
1303 @code{reftex-label-alist} (@ref{Options - Defining Label Environments}).
1304 @end itemize
1305
1306 The following list of strings is used to guess the correct label type
1307 from the word before point when creating a reference. For example if you
1308 write: @samp{As we have shown in Theorem} and then press @kbd{C-c )},
1309 @RefTeX{} will know that you are looking for a theorem label and
1310 restrict the menu to only these labels without even asking.
1311
1312 The final item in each entry is the level at which the environment
1313 should produce entries in the table of context buffer. If the number is
1314 positive, the environment will produce numbered entries (like
1315 @code{\section}), if it is negative the entries will be unnumbered (like
1316 @code{\section*}). Use this only for environments which structure the
1317 document similar to sectioning commands. For everything else, omit the
1318 item.
1319
1320 To do the same configuration with @code{customize}, you need to click on
1321 the @code{[INS]} button twice to create two templates and fill them in
1322 like this:
1323
1324 @example
1325 Reftex Label Alist: [Hide]
1326 [INS] [DEL] Package or Detailed : [Value Menu] Detailed:
1327 Environment or \macro : [Value Menu] String: axiom
1328 Type specification : [Value Menu] Char : a
1329 Label prefix string : [Value Menu] String: ax:
1330 Label reference format: [Value Menu] String: ~\ref@{%s@}
1331 Context method : [Value Menu] After label
1332 Magic words:
1333 [INS] [DEL] String: axiom
1334 [INS] [DEL] String: ax.
1335 [INS]
1336 [X] Make TOC entry : [Value Menu] Level: -2
1337 [INS] [DEL] Package or Detailed : [Value Menu] Detailed:
1338 Environment or \macro : [Value Menu] String: theorem
1339 Type specification : [Value Menu] Char : h
1340 Label prefix string : [Value Menu] String: thr:
1341 Label reference format: [Value Menu] String: ~\ref@{%s@}
1342 Context method : [Value Menu] Default position
1343 Magic words:
1344 [INS] [DEL] String: theorem
1345 [INS] [DEL] String: theor.
1346 [INS] [DEL] String: th.
1347 [INS]
1348 [X] Make TOC entry : [Value Menu] Level: -3
1349 @end example
1350
1351 @vindex reftex-insert-label-flags
1352 @vindex reftex-label-menu-flags
1353 Depending on how you would like the label insertion and selection for
1354 the new environments to work, you might want to add the letters @samp{a}
1355 and @samp{h} to some of the flags in the variables
1356 @code{reftex-insert-label-flags} (@pxref{Options - Creating Labels})
1357 and @code{reftex-label-menu-flags} (@pxref{Options - Referencing Labels}).
1358
1359
1360 @node Quick Equation
1361 @subsection Quick Equation Macro
1362 @cindex Quick equation macro
1363 @cindex Macros as environment wrappers
1364
1365 Suppose you would like to have a macro for quick equations. It
1366 could be defined like this:
1367
1368 @example
1369 \newcommand@{\quickeq@}[1]@{\begin@{equation@} #1 \end@{equation@}@}
1370 @end example
1371
1372 @noindent
1373 and used like this:
1374
1375 @example
1376 Einstein's equation is \quickeq@{E=mc^2 \label@{eq:einstein@}@}.
1377 @end example
1378
1379 We need to tell @RefTeX{} that any label defined in the argument of the
1380 @code{\quickeq} is an equation label. Here is how to do this with lisp:
1381
1382 @lisp
1383 (setq reftex-label-alist '(("\\quickeq@{@}" ?e nil nil 1 nil)))
1384 @end lisp
1385
1386 The first element in this list is now the macro with empty braces as an
1387 @emph{image} of the macro arguments. @code{?e} indicates that this is
1388 an equation label, the different @code{nil} elements indicate to use the
1389 default values for equations. The @samp{1} as the fifth element
1390 indicates that the context of the label definition should be the first
1391 argument of the macro.
1392
1393 Here is again how this would look in the customization buffer:
1394
1395 @example
1396 Reftex Label Alist: [Hide]
1397 [INS] [DEL] Package or Detailed : [Value Menu] Detailed:
1398 Environment or \macro : [Value Menu] String: \quickeq@{@}
1399 Type specification : [Value Menu] Char : e
1400 Label prefix string : [Value Menu] Default
1401 Label reference format: [Value Menu] Default
1402 Context method : [Value Menu] Macro arg nr: 1
1403 Magic words:
1404 [INS]
1405 [ ] Make TOC entry : [Value Menu] No entry
1406 @end example
1407
1408 @node Figure Wrapper
1409 @subsection Figure Wrapping Macro
1410 @cindex Macros as environment wrappers
1411 @cindex Figure wrapping macro
1412
1413 Suppose you want to make figures not directly with the figure
1414 environment, but with a macro like
1415
1416 @example
1417 \newcommand@{\myfig@}[5][tbp]@{%
1418 \begin@{figure@}[#1]
1419 \epsimp[#5]@{#2@}
1420 \caption@{#3@}
1421 \label@{#4@}
1422 \end@{figure@}@}
1423 @end example
1424
1425 @noindent
1426 which would be called like
1427
1428 @example
1429 \myfig[htp]@{filename@}@{caption text@}@{label@}@{1@}
1430 @end example
1431
1432 Now we need to tell @RefTeX{} that the fourth argument of the
1433 @code{\myfig} macro @emph{is itself} a figure label, and where to find
1434 the context.
1435
1436 @lisp
1437 (setq reftex-label-alist
1438 '(("\\myfig[]@{@}@{@}@{*@}@{@}" ?f nil nil 3)))
1439 @end lisp
1440
1441 The empty pairs of brackets indicate the different arguments of the
1442 @code{\myfig} macro. The @samp{*} marks the label argument. @code{?f}
1443 indicates that this is a figure label which will be listed together with
1444 labels from normal figure environments. The @code{nil} entries for
1445 prefix and reference format mean to use the defaults for figure labels.
1446 The @samp{3} for the context method means to grab the third macro argument:
1447 the caption.
1448
1449 As a side effect of this configuration, @code{reftex-label} will now
1450 insert the required naked label (without the @code{\label} macro) when
1451 point is directly after the opening parenthesis of a @code{\myfig} macro
1452 argument.
1453
1454 Again, here the configuration in the customization buffer:
1455
1456 @example
1457 [INS] [DEL] Package or Detailed : [Value Menu] Detailed:
1458 Environment or \macro : [Value Menu] String: \myfig[]@{@}@{@}@{*@}@{@}
1459 Type specification : [Value Menu] Char : f
1460 Label prefix string : [Value Menu] Default
1461 Label reference format: [Value Menu] Default
1462 Context method : [Value Menu] Macro arg nr: 3
1463 Magic words:
1464 [INS]
1465 [ ] Make TOC entry : [Value Menu] No entry
1466 @end example
1467
1468 @node Adding Magic Words
1469 @subsection Adding Magic Words
1470 @cindex Magic words
1471 @cindex German magic words
1472 @cindex Label category
1473
1474 Sometimes you don't want to define a new label environment or macro, but
1475 just change the information associated with a label category. Maybe you
1476 want to add some magic words, for another language. Changing only the
1477 information associated with a label category is done by giving
1478 @code{nil} for the environment name and then specify the items you want
1479 to define. Here is an example which adds German magic words to all
1480 predefined label categories.
1481
1482 @lisp
1483 (setq reftex-label-alist
1484 '((nil ?s nil nil nil ("Kapitel" "Kap." "Abschnitt" "Teil"))
1485 (nil ?e nil nil nil ("Gleichung" "Gl."))
1486 (nil ?t nil nil nil ("Tabelle"))
1487 (nil ?f nil nil nil ("Figur" "Abbildung" "Abb."))
1488 (nil ?n nil nil nil ("Anmerkung" "Anm."))
1489 (nil ?i nil nil nil ("Punkt"))))
1490 @end lisp
1491
1492 @node Using \eqref
1493 @subsection Using @code{\eqref}
1494 @cindex @code{\eqref}, AMS-LaTeX macro
1495 @cindex AMS-LaTeX
1496 @cindex Label category
1497
1498 Another case where one only wants to change the information associated
1499 with the label category is to change the macro which is used for
1500 referencing the label. When working with the AMS-@LaTeX{}, you might
1501 prefer @code{\eqref} for doing equation references. Here is how to
1502 do this:
1503
1504 @lisp
1505 (setq reftex-label-alist '((nil ?e nil "~\\eqref@{%s@}" nil nil)))
1506 @end lisp
1507
1508 @RefTeX{} has also a predefined symbol for this special purpose. The
1509 following is equivalent to the line above.
1510
1511 @lisp
1512 (setq reftex-label-alist '(AMSTeX))
1513 @end lisp
1514
1515 Note that this is automatically done by the @file{amsmath.el} style file
1516 of @AUCTeX{} (@pxref{Style Files}); so if you use @AUCTeX{},
1517 this configuration will not be necessary.
1518
1519 @node Non-Standard Environments
1520 @subsection Non-standard Environments
1521 @cindex Non-standard environments
1522 @cindex Environments without @code{\begin}
1523 @cindex Special parser functions
1524 @cindex Parser functions, for special environments
1525
1526 Some @LaTeX{} packages define environment-like structures without using the
1527 standard @samp{\begin..\end} structure. @RefTeX{} cannot parse
1528 these directly, but you can write your own special-purpose parser and
1529 use it instead of the name of an environment in an entry for
1530 @code{reftex-label-alist}. The function should check if point is
1531 currently in the special environment it was written to detect. If so,
1532 it must return a buffer position indicating the start of this
1533 environment. The return value must be @code{nil} on failure to detect
1534 the environment. The function is called with one argument @var{bound}.
1535 If non-@code{nil}, @var{bound} is a boundary for backwards searches
1536 which should be observed. We will discuss two examples.
1537
1538 @cindex LaTeX commands, abbreviated
1539
1540 Some people define abbreviations for
1541 environments, like @code{\be} for @code{\begin@{equation@}}, and
1542 @code{\ee} for @code{\end@{equation@}}. The parser function would have
1543 to search backward for these macros. When the first match is
1544 @code{\ee}, point is not in this environment. When the first match is
1545 @code{\be}, point is in this environment and the function must return
1546 the beginning of the match. To avoid scanning too far, we can also look
1547 for empty lines which cannot occur inside an equation environment.
1548 Here is the setup:
1549
1550 @lisp
1551 ;; Setup entry in reftex-label-alist, using all defaults for equations
1552 (setq reftex-label-alist '((detect-be-ee ?e nil nil nil nil)))
1553
1554 (defun detect-be-ee (bound)
1555 ;; Search backward for the macros or an empty line
1556 (if (re-search-backward
1557 "\\(^[ \t]*\n\\|\\\\ee\\>\\)\\|\\(\\\\be\\>\\)" bound t)
1558 (if (match-beginning 2)
1559 (match-beginning 2) ; Return start of environment
1560 nil) ; Return nil because env is closed
1561 nil)) ; Return nil for not found
1562 @end lisp
1563
1564 @cindex @code{linguex}, LaTeX package
1565 @cindex LaTeX packages, @code{linguex}
1566 A more complex example is the @file{linguex.sty} package which defines
1567 list macros @samp{\ex.}, @samp{\a.}, @samp{\b.} etc. for lists which are
1568 terminated by @samp{\z.} or by an empty line.
1569
1570 @example
1571 \ex. \label@{ex:12@} Some text in an exotic language ...
1572 \a. \label@{ex:13@} more stuff
1573 \b. \label@{ex:14@} still more stuff
1574 \a. List on a deeper level
1575 \b. Another item
1576 \b. and the third one
1577 \z.
1578 \b. Third item on this level.
1579
1580 ... text after the empty line terminating all lists
1581 @end example
1582
1583 The difficulty is that the @samp{\a.} lists can nest and that an empty
1584 line terminates all list levels in one go. So we have to count nesting
1585 levels between @samp{\a.} and @samp{\z.}. Here is the implementation
1586 for @RefTeX{}.
1587
1588 @lisp
1589 (setq reftex-label-alist
1590 '((detect-linguex ?x "ex:" "~\\ref@{%s@}" nil ("Example" "Ex."))))
1591
1592 (defun detect-linguex (bound)
1593 (let ((cnt 0))
1594 (catch 'exit
1595 (while
1596 ;; Search backward for all possible delimiters
1597 (re-search-backward
1598 (concat "\\(^[ \t]*\n\\)\\|\\(\\\\z\\.\\)\\|"
1599 "\\(\\ex[ig]?\\.\\)\\|\\(\\\\a\\.\\)")
1600 nil t)
1601 ;; Check which delimiter was matched.
1602 (cond
1603 ((match-beginning 1)
1604 ;; empty line terminates all - return nil
1605 (throw 'exit nil))
1606 ((match-beginning 2)
1607 ;; \z. terminates one list level - decrease nesting count
1608 (decf cnt))
1609 ((match-beginning 3)
1610 ;; \ex. : return match unless there was a \z. on this level
1611 (throw 'exit (if (>= cnt 0) (match-beginning 3) nil)))
1612 ((match-beginning 4)
1613 ;; \a. : return match when on level 0, otherwise
1614 ;; increment nesting count
1615 (if (>= cnt 0)
1616 (throw 'exit (match-beginning 4))
1617 (incf cnt))))))))
1618 @end lisp
1619
1620 @node Putting it Together
1621 @subsection Putting it all together
1622
1623 When you have to put several entries into @code{reftex-label-alist}, just
1624 put them after each other in a list, or create that many templates in
1625 the customization buffer. Here is a lisp example which uses several of
1626 the entries described above:
1627
1628 @lisp
1629 (setq reftex-label-alist
1630 '(("axiom" ?a "ax:" "~\\ref@{%s@}" nil ("axiom" "ax.") -2)
1631 ("theorem" ?h "thr:" "~\\ref@{%s@}" t ("theorem" "theor." "th.") -3)
1632 ("\\quickeq@{@}" ?e nil nil 1 nil)
1633 AMSTeX
1634 ("\\myfig[]@{@}@{@}@{*@}@{@}" ?f nil nil 3)
1635 (detect-linguex ?x "ex:" "~\\ref@{%s@}" nil ("Example" "Ex."))))
1636 @end lisp
1637
1638 @node Reference Info
1639 @section Reference Info
1640 @findex reftex-view-crossref
1641 @findex reftex-mouse-view-crossref
1642 @cindex Cross-references, displaying
1643 @cindex Reference info
1644 @cindex Displaying cross-references
1645 @cindex Viewing cross-references
1646 @kindex C-c &
1647 @kindex S-mouse-2
1648
1649 When point is idle for more than @code{reftex-idle-time} seconds on the
1650 argument of a @code{\ref} macro, the echo area will display some
1651 information about the label referenced there. Note that the information
1652 is only displayed if the echo area is not occupied by a different
1653 message.
1654
1655 @RefTeX{} can also display the label definition corresponding to a
1656 @code{\ref} macro, or all reference locations corresponding to a
1657 @code{\label} macro. @xref{Viewing Cross-References}, for more
1658 information.
1659
1660 @node Reference Styles
1661 @section Reference Styles
1662
1663 In case you defined your own macros for referencing or you are using
1664 @LaTeX{} packages providing specialized macros to be used instead of
1665 @code{\ref}, @RefTeX{} provides ways to select and insert them in a
1666 convenient way.
1667
1668 @RefTeX{} comes equipped with a set of so-called reference styles where
1669 each relates to one or more reference macros. The standard macros
1670 @samp{\ref} and @samp{\pageref} or provided by the ``Default'' style.
1671 The ``Varioref'' style offers macros for the @samp{varioref} @LaTeX{}
1672 package (@samp{\vref}, @samp{\Vref}, @samp{\Ref}, @samp{\vpageref}),
1673 ``Fancyref'' for the @samp{fancyref} package (@samp{\fref},
1674 @samp{\Fref}) and ``Hyperref'' for the @samp{hyperref} package
1675 (@samp{\autoref}, @samp{\autopageref}).
1676
1677 @vindex reftex-ref-style-default-list
1678 A style can be toggled by selecting the respective entry in the
1679 @samp{Reference Style} menu. Changes made through the menu will only
1680 last for the Emacs session. In order to configure a preference
1681 permanently, the variable @code{reftex-ref-style-default-list} should be
1682 customized. This variable specifies the list of styles to be activated.
1683 It can also be set as a file variable if the preference should be set
1684 for a specific file.
1685
1686 @vindex reftex-ref-style-alist
1687 In case the built-in styles do not suffice, you can add additional
1688 macros and styles to the variable @code{reftex-ref-style-alist}. Those
1689 do not necessarily have to be related to a certain @LaTeX{} package but
1690 can follow an arbitrary grouping rule. For example you could define a
1691 style called ``Personal'' for your personal referencing macros. (When
1692 changing the variable you should be aware that other Emacs packages,
1693 like @AUCTeX{}, might rely on the entries from the default value to be
1694 present.)
1695
1696 Once a style is active the macros it relates to are available for
1697 selection when you are about to insert a reference. In general this
1698 process involves three steps: the selection of a reference macro, a
1699 label type and a label. Reference macros can be chosen in the first and
1700 last step.
1701
1702 @vindex reftex-ref-macro-prompt
1703 In the first step you will be presented with a list of macros from which
1704 you can select one by typing a single key. If you dislike having an
1705 extra step for reference macro selection, you can disable it by
1706 customizing @code{reftex-ref-macro-prompt} and relying only on the
1707 selection facilities provided in the last step.
1708
1709 In the last step, i.e., the label selection, two key bindings are
1710 provided to set the reference macro. Type @key{v} in order to cycle
1711 forward through the list of available macros or @key{V} to cycle
1712 backward. The mode line of the selection buffer shows the macro
1713 currently selected.
1714
1715 In case you are not satisfied with the order of macros when cycling
1716 through them you should adapt the order of entries in the variable
1717 @code{reftex-ref-style-alist} to fit your liking.
1718
1719 For each entry in @code{reftex-ref-style-alist} a function with the name
1720 @code{reftex-<package>-<macro>} (e.g., @code{reftex-varioref-vref}) will
1721 be created automatically by @RefTeX{}. These functions can be used
1722 instead of @kbd{C-c )} and provide an alternative way of having your
1723 favorite referencing macro preselected and if cycling through the macros
1724 seems inconvenient to you.@footnote{You could, e.g., bind
1725 @code{reftex-varioref-vref} to @kbd{C-c v} and
1726 @code{reftex-fancyref-fref} to @kbd{C-c f}.}
1727
1728 @cindex @code{varioref}, LaTeX package
1729 @cindex LaTeX packages, @code{varioref}
1730 @cindex @code{fancyref}, LaTeX package
1731 @cindex LaTeX packages, @code{fancyref}
1732 @vindex reftex-vref-is-default (deprecated)
1733 @vindex reftex-fref-is-default (deprecated)
1734 In former versions of @RefTeX{} only support for @code{varioref} and
1735 @code{fancyref} was included. @code{varioref} is a @LaTeX{} package to
1736 create cross-references with page information. @code{fancyref} is a
1737 package where a macro call like @code{\fref@{@var{fig:map-of-germany}@}}
1738 creates not only the number of the referenced counter but also the
1739 complete text around it, like @samp{Figure 3 on the preceding page}. In
1740 order to make it work you need to use label prefixes like @samp{fig:}
1741 consistently---something @RefTeX{} does automatically. For each of
1742 these packages a variable could be configured to make its macros to take
1743 precedence over @code{\ref}. Those were @code{reftex-vref-is-default}
1744 and @code{reftex-fref-is-default} respectively. While still working,
1745 these variables are deprecated now. Instead of setting them, the
1746 variable @code{reftex-ref-style-default-list} should be adapted now.
1747
1748 @node LaTeX xr Package
1749 @section @code{xr}: Cross-Document References
1750 @cindex @code{xr}, LaTeX package
1751 @cindex LaTeX packages, @code{xr}
1752 @cindex @code{\externaldocument}
1753 @cindex External documents
1754 @cindex References to external documents
1755 @cindex Cross-document references
1756
1757 The @LaTeX{} package @code{xr} makes it possible to create references to
1758 labels defined in external documents. The preamble of a document using
1759 @code{xr} will contain something like this:
1760
1761 @example
1762 \usepackage@{xr@}
1763 \externaldocument[V1-]@{volume1@}
1764 \externaldocument[V3-]@{volume3@}
1765 @end example
1766
1767 @noindent
1768 and we can make references to any labels defined in these
1769 external documents by using the prefixes @samp{V1-} and @samp{V3-},
1770 respectively.
1771
1772 @RefTeX{} can be used to create such references as well. Start the
1773 referencing process normally, by pressing @kbd{C-c )}. Select a label
1774 type if necessary. When you see the label selection buffer, pressing
1775 @kbd{x} will switch to the label selection buffer of one of the external
1776 documents. You may then select a label as before and @RefTeX{} will
1777 insert it along with the required prefix.
1778
1779 For this kind of inter-document cross-references, saving of parsing
1780 information and the use of multiple selection buffers can mean a large
1781 speed-up (@pxref{Optimizations}).
1782
1783 @node Citations
1784 @chapter Citations
1785 @cindex Citations
1786 @cindex @code{\cite}
1787
1788 Citations in @LaTeX{} are done with the @code{\cite} macro or variations of
1789 it. The argument of the macro is a citation key which identifies an
1790 article or book in either a @BibTeX{} database file or in an explicit
1791 @code{thebibliography} environment in the document. @RefTeX{}'s
1792 support for citations helps to select the correct key quickly.
1793
1794 @menu
1795 * Creating Citations:: How to create them.
1796 * Citation Styles:: Natbib, Harvard, Chicago and Co.
1797 * Citation Info:: View the corresponding database entry.
1798 * Chapterbib and Bibunits:: Multiple bibliographies in a Document.
1799 * Citations Outside LaTeX:: How to make citations in Emails etc.
1800 * BibTeX Database Subsets:: Extract parts of a big database.
1801 @end menu
1802
1803 @node Creating Citations
1804 @section Creating Citations
1805 @cindex Creating citations
1806 @cindex Citations, creating
1807 @findex reftex-citation
1808 @kindex C-c [
1809 @cindex Selection buffer, citations
1810 @cindex Selection process
1811
1812 In order to create a citation, press @kbd{C-c [}. @RefTeX{} then
1813 prompts for a regular expression which will be used to search through
1814 the database and present the list of matches to choose from in a
1815 selection process similar to that for selecting labels
1816 (@pxref{Referencing Labels}).
1817
1818 The regular expression uses an extended syntax: @samp{&&} defines a
1819 logic @code{and} for regular expressions. For example
1820 @samp{Einstein&&Bose} will match all articles which mention
1821 Bose-Einstein condensation, or which are co-authored by Bose and
1822 Einstein. When entering the regular expression, you can complete on
1823 known citation keys. @RefTeX{} also offers a default when prompting for
1824 a regular expression. This default is the word before the cursor or the
1825 word before the current @samp{\cite} command. Sometimes this may be a
1826 good search key.
1827
1828 @cindex @code{\bibliography}
1829 @cindex @code{thebibliography}, LaTeX environment
1830 @cindex @code{BIBINPUTS}, environment variable
1831 @cindex @code{TEXBIB}, environment variable
1832 @RefTeX{} prefers to use @BibTeX{} database files specified with a
1833 @code{\bibliography} macro to collect its information. Just like
1834 @BibTeX{}, it will search for the specified files in the current directory
1835 and along the path given in the environment variable @code{BIBINPUTS}.
1836 If you do not use @BibTeX{}, but the document contains an explicit
1837 @code{thebibliography} environment, @RefTeX{} will collect its
1838 information from there. Note that in this case the information
1839 presented in the selection buffer will just be a copy of relevant
1840 @code{\bibitem} entries, not the structured listing available with
1841 @BibTeX{} database files.
1842
1843 @kindex ?
1844 In the selection buffer, the following keys provide special commands. A
1845 summary of this information is always available from the selection
1846 process by pressing @kbd{?}.
1847
1848 @table @kbd
1849 @tablesubheading{General}
1850 @item ?
1851 Show a summary of available commands.
1852
1853 @item 0-9,-
1854 Prefix argument.
1855
1856 @tablesubheading{Moving around}
1857 @item n
1858 Go to next article.
1859
1860 @item p
1861 Go to previous article.
1862
1863 @tablesubheading{Access to full database entries}
1864 @item @key{SPC}
1865 Show the database entry corresponding to the article at point, in
1866 another window. See also the @kbd{f} key.
1867
1868 @item f
1869 Toggle follow mode. When follow mode is active, the other window will
1870 always display the full database entry of the current article. This is
1871 equivalent to pressing @key{SPC} after each cursor motion. With @BibTeX{}
1872 entries, follow mode can be rather slow.
1873
1874 @tablesubheading{Selecting entries and creating the citation}
1875 @item @key{RET}
1876 Insert a citation referencing the article at point into the buffer from
1877 which the selection process was started.
1878
1879 @item mouse-2
1880 @vindex reftex-highlight-selection
1881 Clicking with mouse button 2 on a citation will accept it like @key{RET}
1882 would. See also variable @code{reftex-highlight-selection},
1883 @ref{Options - Misc}.
1884
1885 @item m
1886 Mark the current entry. When one or several entries are marked,
1887 pressing @kbd{a} or @kbd{A} accepts all marked entries. Also,
1888 @key{RET} behaves like the @kbd{a} key.
1889
1890 @item u
1891 Unmark a marked entry.
1892
1893 @item a
1894 Accept all (marked) entries in the selection buffer and create a single
1895 @code{\cite} macro referring to them.
1896
1897 @item A
1898 Accept all (marked) entries in the selection buffer and create a
1899 separate @code{\cite} macro for each of it.
1900
1901 @item e
1902 Create a new @BibTeX{} database file which contains all @i{marked} entries
1903 in the selection buffer. If no entries are marked, all entries are
1904 selected.
1905
1906 @item E
1907 Create a new @BibTeX{} database file which contains all @i{unmarked}
1908 entries in the selection buffer. If no entries are marked, all entries
1909 are selected.
1910
1911 @item @key{TAB}
1912 Enter a citation key with completion. This may also be a key which does
1913 not yet exist.
1914
1915 @item .
1916 Show insertion point in another window. This is the point from where you
1917 called @code{reftex-citation}.
1918
1919 @tablesubheading{Exiting}
1920 @item q
1921 Exit the selection process without inserting a citation into the
1922 buffer.
1923
1924 @tablesubheading{Updating the buffer}
1925
1926 @item g
1927 Start over with a new regular expression. The full database will be
1928 rescanned with the new expression (see also @kbd{r}).
1929
1930 @c FIXME: Should we use something else here? r is usually rescan!
1931 @item r
1932 Refine the current selection with another regular expression. This will
1933 @emph{not} rescan the entire database, but just the already selected
1934 entries.
1935
1936 @end table
1937
1938 @vindex reftex-select-bib-map
1939 In order to define additional commands for this selection process, the
1940 keymap @code{reftex-select-bib-map} may be used.
1941
1942 Note that if you do not use Emacs to edit the @BibTeX{} database files,
1943 @RefTeX{} will ask if the related buffers should be updated once it
1944 detects that the files were changed externally. If you do not want to
1945 be bothered by such queries, you can activate Auto Revert mode for these
1946 buffers by adding the following expression to your init file:
1947
1948 @lisp
1949 (add-hook 'bibtex-mode-hook 'turn-on-auto-revert-mode)
1950 @end lisp
1951
1952
1953 @node Citation Styles
1954 @section Citation Styles
1955 @cindex Citation styles
1956 @cindex Citation styles, @code{natbib}
1957 @cindex Citation styles, @code{harvard}
1958 @cindex Citation styles, @code{chicago}
1959 @cindex Citation styles, @code{jurabib}
1960 @cindex Citation styles, @ConTeXt{}
1961 @cindex @code{natbib}, citation style
1962 @cindex @code{harvard}, citation style
1963 @cindex @code{chicago}, citation style
1964 @cindex @code{jurabib}, citation style
1965 @cindex @ConTeXt{}, citation style
1966
1967 @vindex reftex-cite-format
1968 The standard @LaTeX{} macro @code{\cite} works well with numeric or
1969 simple key citations. To deal with the more complex task of author-year
1970 citations as used in many natural sciences, a variety of packages has
1971 been developed which define derived forms of the @code{\cite} macro.
1972 @RefTeX{} can be configured to produce these citation macros as well by
1973 setting the variable @code{reftex-cite-format}. For the most commonly
1974 used @LaTeX{} packages (@code{natbib}, @code{harvard}, @code{chicago},
1975 @code{jurabib}) and for @ConTeXt{} this may be done from the menu, under
1976 @code{Ref->Citation Styles}. Since there are usually several macros to
1977 create the citations, executing @code{reftex-citation} (@kbd{C-c [})
1978 starts by prompting for the correct macro. For the Natbib style, this
1979 looks like this:
1980
1981 @example
1982 SELECT A CITATION FORMAT
1983
1984 [^M] \cite@{%l@}
1985 [t] \citet@{%l@}
1986 [T] \citet*@{%l@}
1987 [p] \citep@{%l@}
1988 [P] \citep*@{%l@}
1989 [e] \citep[e.g.][]@{%l@}
1990 [s] \citep[see][]@{%l@}
1991 [a] \citeauthor@{%l@}
1992 [A] \citeauthor*@{%l@}
1993 [y] \citeyear@{%l@}
1994 @end example
1995
1996 @vindex reftex-cite-prompt-optional-args
1997 If citation formats contain empty pairs of square brackets, @RefTeX{}
1998 will prompt for values of these optional arguments if you call the
1999 @code{reftex-citation} command with a @kbd{C-u} prefix.
2000 Following the most generic of these packages, @code{natbib}, the builtin
2001 citation packages always accept the @kbd{t} key for a @emph{textual}
2002 citation (like: @code{Jones et al. (1997) have shown...}) as well as
2003 the @kbd{p} key for a parenthetical citation (like: @code{As shown
2004 earlier (Jones et al, 1997)}).
2005
2006 To make one of these styles the default, customize the variable
2007 @code{reftex-cite-format} or put into @file{.emacs}:
2008
2009 @lisp
2010 (setq reftex-cite-format 'natbib)
2011 @end lisp
2012
2013 You can also use @AUCTeX{} style files to automatically set the
2014 citation style based on the @code{usepackage} commands in a given
2015 document. @xref{Style Files}, for information on how to set up the style
2016 files correctly.
2017
2018 @node Citation Info
2019 @section Citation Info
2020 @cindex Displaying citations
2021 @cindex Citations, displaying
2022 @cindex Citation info
2023 @cindex Viewing citations
2024 @kindex C-c &
2025 @kindex S-mouse-2
2026 @findex reftex-view-crossref
2027 @findex reftex-mouse-view-crossref
2028
2029 When point is idle for more than @code{reftex-idle-time} seconds on the
2030 argument of a @code{\cite} macro, the echo area will display some
2031 information about the article cited there. Note that the information is
2032 only displayed if the echo area is not occupied by a different message.
2033
2034 @RefTeX{} can also display the @code{\bibitem} or @BibTeX{} database
2035 entry corresponding to a @code{\cite} macro, or all citation locations
2036 corresponding to a @code{\bibitem} or @BibTeX{} database entry.
2037 @xref{Viewing Cross-References}.
2038
2039 @node Chapterbib and Bibunits
2040 @section Chapterbib and Bibunits
2041 @cindex @code{chapterbib}, LaTeX package
2042 @cindex @code{bibunits}, LaTeX package
2043 @cindex Bibliographies, multiple
2044
2045 @code{chapterbib} and @code{bibunits} are two @LaTeX{} packages which
2046 produce multiple bibliographies in a document. This is no problem for
2047 @RefTeX{} as long as all bibliographies use the same @BibTeX{} database
2048 files. If they do not, it is best to have each document part in a
2049 separate file (as it is required for @code{chapterbib} anyway). Then
2050 @RefTeX{} will still scan the locally relevant databases correctly. If
2051 you have multiple bibliographies within a @emph{single file}, this may
2052 or may not be the case.
2053
2054 @node Citations Outside LaTeX
2055 @section Citations outside @LaTeX{}
2056 @cindex Citations outside LaTeX
2057 @vindex reftex-default-bibliography
2058
2059 The command @code{reftex-citation} can also be executed outside a @LaTeX{}
2060 buffer. This can be useful to reference articles in the mail buffer and
2061 other documents. You should @emph{not} enter @code{reftex-mode} for
2062 this, just execute the command. The list of @BibTeX{} files will in this
2063 case be taken from the variable @code{reftex-default-bibliography}.
2064 Setting the variable @code{reftex-cite-format} to the symbol
2065 @code{locally} does a decent job of putting all relevant information
2066 about a citation directly into the buffer. Here is the lisp code to add
2067 the @kbd{C-c [} binding to the mail buffer. It also provides a local
2068 binding for @code{reftex-cite-format}.
2069
2070 @lisp
2071 (add-hook 'mail-setup-hook
2072 (lambda () (define-key mail-mode-map "\C-c["
2073 (lambda ()
2074 (interactive)
2075 (let ((reftex-cite-format 'locally))
2076 (reftex-citation))))))
2077 @end lisp
2078
2079 @node BibTeX Database Subsets
2080 @section Database Subsets
2081 @cindex BibTeX database subsets
2082 @findex reftex-create-bibtex-file
2083
2084 @RefTeX{} offers two ways to create a new @BibTeX{} database file.
2085
2086 The first option produces a file which contains only the entries
2087 actually referenced in the current document. This can be useful if
2088 the database is only meant for a single document and you want to clean
2089 it of old and unused ballast. It can also be useful while writing a
2090 document together with collaborators, in order to avoid sending around
2091 the entire (possibly very large) database. To create the file, use
2092 @kbd{M-x reftex-create-bibtex-file}, also available from the menu
2093 under @code{Ref->Global Actions->Create Bibtex File}. The command will
2094 prompt for a @BibTeX{} file name and write the extracted entries to that
2095 file.
2096
2097 The second option makes use of the selection process started by the
2098 command @kbd{C-c [} (@pxref{Creating Citations}). This command uses a
2099 regular expression to select entries, and lists them in a formatted
2100 selection buffer. After pressing the @kbd{e} key (mnemonics: Export),
2101 the command will prompt for the name of a new @BibTeX{} file and write
2102 the selected entries to that file. You can also first mark some
2103 entries in the selection buffer with the @kbd{m} key and then export
2104 either the @i{marked} entries (with the @kbd{e} key) or the
2105 @i{unmarked} entries (with the @kbd{E} key).
2106
2107 @node Index Support
2108 @chapter Index Support
2109 @cindex Index Support
2110 @cindex @code{\index}
2111
2112 @LaTeX{} has builtin support for creating an Index. The @LaTeX{} core
2113 supports two different indices, the standard index and a glossary. With
2114 the help of special @LaTeX{} packages (@file{multind.sty} or
2115 @file{index.sty}), any number of indices can be supported.
2116
2117 Index entries are created with the @code{\index@{@var{entry}@}} macro.
2118 All entries defined in a document are written out to the @file{.aux}
2119 file. A separate tool must be used to convert this information into a
2120 nicely formatted index. Tools used with @LaTeX{} include @code{MakeIndex}
2121 and @code{xindy}.
2122
2123 Indexing is a very difficult task. It must follow strict conventions to
2124 make the index consistent and complete. There are basically two
2125 approaches one can follow, and both have their merits.
2126
2127 @enumerate
2128 @item
2129 Part of the indexing should already be done with the markup. The
2130 document structure should be reflected in the index, so when starting
2131 new sections, the basic topics of the section should be indexed. If the
2132 document contains definitions, theorems or the like, these should all
2133 correspond to appropriate index entries. This part of the index can
2134 very well be developed along with the document. Often it is worthwhile
2135 to define special purpose macros which define an item and at the same
2136 time make an index entry, possibly with special formatting to make the
2137 reference page in the index bold or underlined. To make @RefTeX{}
2138 support for indexing possible, these special macros must be added to
2139 @RefTeX{}'s configuration (@pxref{Defining Index Macros}).
2140
2141 @item
2142 The rest of the index is often just a collection of where in the
2143 document certain words or phrases are being used. This part is
2144 difficult to develop along with the document, because consistent entries
2145 for each occurrence are needed and are best selected when the document
2146 is ready. @RefTeX{} supports this with an @emph{index phrases file}
2147 which collects phrases and helps indexing the phrases globally.
2148 @end enumerate
2149
2150 Before you start, you need to make sure that @RefTeX{} knows about
2151 the index style being used in the current document. @RefTeX{} has
2152 builtin support for the default @code{\index} and @code{\glossary}
2153 macros. Other @LaTeX{} packages, like the @file{multind} or @file{index}
2154 package, redefine the @code{\index} macro to have an additional
2155 argument, and @RefTeX{} needs to be configured for those. A
2156 sufficiently new version of @AUCTeX{} (9.10c or later) will do this
2157 automatically. If you really don't use @AUCTeX{} (you should!), this
2158 configuration needs to be done by hand with the menu (@code{Ref->Index
2159 Style}), or globally for all your documents with
2160
2161 @lisp
2162 (setq reftex-index-macros '(multind)) @r{or}
2163 (setq reftex-index-macros '(index))
2164 @end lisp
2165
2166 @menu
2167 * Creating Index Entries:: Macros and completion of entries.
2168 * The Index Phrases File:: A special file for global indexing.
2169 * Displaying and Editing the Index:: The index editor.
2170 * Builtin Index Macros:: The index macros RefTeX knows about.
2171 * Defining Index Macros:: ... and macros it doesn't.
2172 @end menu
2173
2174 @node Creating Index Entries
2175 @section Creating Index Entries
2176 @cindex Creating index entries
2177 @cindex Index entries, creating
2178 @kindex C-c <
2179 @findex reftex-index
2180 @kindex C-c /
2181 @findex reftex-index-selection-or-word
2182
2183 In order to index the current selection or the word at the cursor press
2184 @kbd{C-c /} (@code{reftex-index-selection-or-word}). This causes the
2185 selection or word @samp{@var{word}} to be replaced with
2186 @samp{\index@{@var{word}@}@var{word}}. The macro which is used
2187 (@code{\index} by default) can be configured with the variable
2188 @code{reftex-index-default-macro}. When the command is called with a
2189 prefix argument (@kbd{C-u C-c /}), you get a chance to edit the
2190 generated index entry. Use this to change the case of the word or to
2191 make the entry a subentry, for example by entering
2192 @samp{main!sub!@var{word}}. When called with two raw @kbd{C-u} prefixes
2193 (@kbd{C-u C-u C-c /}), you will be asked for the index macro as well.
2194 When there is nothing selected and no word at point, this command will
2195 just call @code{reftex-index}, described below.
2196
2197 In order to create a general index entry, press @kbd{C-c <}
2198 (@code{reftex-index}). @RefTeX{} will prompt for one of the
2199 available index macros and for its arguments. Completion will be
2200 available for the index entry and, if applicable, the index tag. The
2201 index tag is a string identifying one of multiple indices. With the
2202 @file{multind} and @file{index} packages, this tag is the first argument
2203 to the redefined @code{\index} macro.
2204
2205 @node The Index Phrases File
2206 @section The Index Phrases File
2207 @cindex Index phrase file
2208 @cindex Phrase file
2209 @kindex C-c |
2210 @findex reftex-index-visit-phrases-buffer
2211 @cindex Macro definition lines, in phrase buffer
2212
2213 @RefTeX{} maintains a file in which phrases can be collected for
2214 later indexing. The file is located in the same directory as the master
2215 file of the document and has the extension @file{.rip} (@b{R}eftex
2216 @b{I}ndex @b{P}hrases). You can create or visit the file with @kbd{C-c
2217 |} (@code{reftex-index-visit-phrases-buffer}). If the file is empty it
2218 is initialized by inserting a file header which contains the definition
2219 of the available index macros. This list is initialized from
2220 @code{reftex-index-macros} (@pxref{Defining Index Macros}). You can
2221 edit the header as needed, but if you define new @LaTeX{} indexing macros,
2222 don't forget to add them to @code{reftex-index-macros} as well. Here is
2223 a phrase file header example:
2224
2225 @example
2226 % -*- mode: reftex-index-phrases -*-
2227 % Key Macro Format Repeat
2228 %----------------------------------------------------------
2229 >>>INDEX_MACRO_DEFINITION: i \index@{%s@} t
2230 >>>INDEX_MACRO_DEFINITION: I \index*@{%s@} nil
2231 >>>INDEX_MACRO_DEFINITION: g \glossary@{%s@} t
2232 >>>INDEX_MACRO_DEFINITION: n \index*[name]@{%s@} nil
2233 %----------------------------------------------------------
2234 @end example
2235
2236 The macro definition lines consist of a unique letter identifying a
2237 macro, a format string and the @var{repeat} flag, all separated by
2238 @key{TAB}. The format string shows how the macro is to be applied, the
2239 @samp{%s} will be replaced with the index entry. The repeat flag
2240 indicates if @var{word} is indexed by the macro as
2241 @samp{\index@{@var{word}@}} (@var{repeat} = @code{nil}) or as
2242 @samp{\index@{@var{word}@}@var{word}} (@var{repeat} = @code{t}). In the
2243 above example it is assumed that the macro @code{\index*@{@var{word}@}}
2244 already typesets its argument in the text, so that it is unnecessary to
2245 repeat @var{word} outside the macro.
2246
2247 @menu
2248 * Collecting Phrases:: Collecting from document or external.
2249 * Consistency Checks:: Check for duplicates etc.
2250 * Global Indexing:: The interactive indexing process.
2251 @end menu
2252
2253 @node Collecting Phrases
2254 @subsection Collecting Phrases
2255 @cindex Collecting index phrases
2256 @cindex Index phrases, collection
2257 @cindex Phrases, collecting
2258
2259 Phrases for indexing can be collected while writing the document. The
2260 command @kbd{C-c \} (@code{reftex-index-phrase-selection-or-word})
2261 copies the current selection (if active) or the word near point into the
2262 phrases buffer. It then selects this buffer, so that the phrase line
2263 can be edited. To return to the @LaTeX{} document, press @kbd{C-c C-c}
2264 (@code{reftex-index-phrases-save-and-return}).
2265
2266 You can also prepare the list of index phrases in a different way and
2267 copy it into the phrases file. For example you might want to start from
2268 a word list of the document and remove all words which should not be
2269 indexed.
2270
2271 The phrase lines in the phrase buffer must have a specific format.
2272 @RefTeX{} will use font-lock to indicate if a line has the proper
2273 format. A phrase line looks like this:
2274
2275 @example
2276 [@var{key}] <TABs> @var{phrase} [<TABs> @var{arg}[&&@var{arg}]... [ || @var{arg}]...]
2277 @end example
2278
2279 @code{<TABs>} stands for white space containing at least one @key{TAB}.
2280 @var{key} must be at the start of the line and is the character
2281 identifying one of the macros defined in the file header. It is
2282 optional; when omitted, the first macro definition line in the file
2283 will be used for this phrase. The @var{phrase} is the phrase to be
2284 searched for when indexing. It may contain several words separated by
2285 spaces. By default the search phrase is also the text entered as
2286 argument of the index macro. If you want the index entry to be
2287 different from the search phrase, enter another @key{TAB} and the index
2288 argument @var{arg}. If you want to have each match produce several
2289 index entries, separate the different index arguments with @samp{ &&
2290 }@footnote{@samp{&&} with optional spaces, see
2291 @code{reftex-index-phrases-logical-and-regexp}.}. If you want to be
2292 able to choose at each match between several different index arguments,
2293 separate them with @samp{ || }@footnote{@samp{||} with optional spaces,
2294 see @code{reftex-index-phrases-logical-or-regexp}.}. Here is an
2295 example:
2296
2297 @example
2298 %--------------------------------------------------------------------
2299 I Sun
2300 i Planet Planets
2301 i Vega Stars!Vega
2302 Jupiter Planets!Jupiter
2303 i Mars Planets!Mars || Gods!Mars || Chocolate Bars!Mars
2304 i Pluto Planets!Pluto && Kuiper Belt Objects!Pluto
2305 @end example
2306
2307
2308 So @samp{Sun} will be indexed directly as @samp{\index*@{Sun@}}, while
2309 @samp{Planet} will be indexed as @samp{\index@{Planets@}Planet}.
2310 @samp{Vega} will be indexed as a subitem of @samp{Stars}. The
2311 @samp{Jupiter} line will also use the @samp{i} macro as it was the first
2312 macro definition in the file header (see above example). At each
2313 occurrence of @samp{Mars} you will be able choose between indexing it as
2314 a subitem of @samp{Planets}, @samp{Gods} or @samp{Chocolate Bars}.
2315 Finally, every occurrence of @samp{Pluto} will be indexed as
2316 @samp{\index@{Planets!Pluto@}\index@{Kuiper Belt Objects!Pluto@}Pluto}
2317 and will therefore create two different index entries.
2318
2319 @node Consistency Checks
2320 @subsection Consistency Checks
2321 @cindex Index phrases, consistency checks
2322 @cindex Phrases, consistency checks
2323 @cindex Consistency check for index phrases
2324
2325 @kindex C-c C-s
2326 Before indexing the phrases in the phrases buffer, they should be
2327 checked carefully for consistency. A first step is to sort the phrases
2328 alphabetically; this is done with the command @kbd{C-c C-s}
2329 (@code{reftex-index-sort-phrases}). It will sort all phrases in the
2330 buffer alphabetically by search phrase. If you want to group certain
2331 phrases and only sort within the groups, insert empty lines between the
2332 groups. Sorting will only change the sequence of phrases within each
2333 group (see the variable @code{reftex-index-phrases-sort-in-blocks}).
2334
2335 @kindex C-c C-i
2336 A useful command is @kbd{C-c C-i} (@code{reftex-index-phrases-info})
2337 which lists information about the phrase at point, including an example
2338 of how the index entry will look like and the number of expected matches
2339 in the document.
2340
2341 @kindex C-c C-t
2342 Another important check is to find out if there are double or
2343 overlapping entries in the buffer. For example if you are first
2344 searching and indexing @samp{Mars} and then @samp{Planet Mars}, the
2345 second phrase will not match because of the index macro inserted before
2346 @samp{Mars} earlier. The command @kbd{C-c C-t}
2347 (@code{reftex-index-find-next-conflict-phrase}) finds the next phrase in
2348 the buffer which is either duplicate or a subphrase of another phrase.
2349 In order to check the whole buffer like this, start at the beginning and
2350 execute this command repeatedly.
2351
2352 @node Global Indexing
2353 @subsection Global Indexing
2354 @cindex Global indexing
2355 @cindex Indexing, global
2356 @cindex Indexing, from @file{phrases} buffer
2357
2358 Once the index phrases have been collected and organized, you are set
2359 for global indexing. I recommend to do this only on an otherwise
2360 finished document. Global indexing starts from the phrases buffer.
2361 There are several commands which start indexing: @kbd{C-c C-x} acts on
2362 the current phrase line, @kbd{C-c C-r} on all lines in the current
2363 region and @kbd{C-c C-a} on all phrase lines in the buffer. It is
2364 probably good to do indexing in small chunks since your concentration
2365 may not last long enough to do everything in one go.
2366
2367 @RefTeX{} will start at the first phrase line and search the phrase
2368 globally in the whole document. At each match it will stop, compute the
2369 replacement string and offer you the following choices@footnote{Windows
2370 users: Restrict yourself to the described keys during indexing. Pressing
2371 @key{Help} at the indexing prompt can apparently hang Emacs.}:
2372
2373 @table @kbd
2374 @item y
2375 Replace this match with the proposed string.
2376 @item n
2377 Skip this match.
2378 @item !
2379 Replace this and all further matches in this file.
2380 @item q
2381 Skip this match, start with next file.
2382 @item Q
2383 Skip this match, start with next phrase.
2384 @item o
2385 Select a different indexing macro for this match.
2386 @item 1-9
2387 Select one of multiple index keys (those separated with @samp{||}).
2388 @item e
2389 Edit the replacement text.
2390 @item C-r
2391 Recursive edit. Use @kbd{C-M-c} to return to the indexing process.
2392 @item s
2393 Save this buffer and ask again about the current match.
2394 @item S
2395 Save all document buffers and ask again about the current match.
2396 @item C-g
2397 Abort the indexing process.
2398 @end table
2399
2400 The @samp{Find and Index in Document} menu in the phrases buffer also
2401 lists a few options for the indexing process. The options have
2402 associated customization variables to set the defaults
2403 (@pxref{Options - Index Support}). Here is a short explanation of
2404 what the options do:
2405
2406 @table @i
2407 @item Match Whole Words
2408 When searching for index phrases, make sure whole words are matched.
2409 This should probably always be on.
2410 @item Case Sensitive Search
2411 Search case sensitively for phrases. I recommend to have this setting
2412 off, in order to match the capitalized words at the beginning of a
2413 sentence, and even typos. You can always say @emph{no} at a match you
2414 do not like.
2415 @item Wrap Long Lines
2416 Inserting index macros increases the line length. Turn this option on
2417 to allow @RefTeX{} to wrap long lines.
2418 @item Skip Indexed Matches
2419 When this is on, @RefTeX{} will at each match try to figure out if
2420 this match is already indexed. A match is considered indexed if it is
2421 either the argument of an index macro, or if an index macro is directly
2422 (without whitespace separation) before or after the match. Index macros
2423 are those configured in @code{reftex-index-macros}. Intended for
2424 re-indexing a documents after changes have been made.
2425 @end table
2426
2427 Even though indexing should be the last thing you do to a document, you
2428 are bound to make changes afterwards. Indexing then has to be applied
2429 to the changed regions. The command
2430 @code{reftex-index-phrases-apply-to-region} is designed for this
2431 purpose. When called from a @LaTeX{} document with active region, it will
2432 apply @code{reftex-index-all-phrases} to the current region.
2433
2434 @node Displaying and Editing the Index
2435 @section Displaying and Editing the Index
2436 @cindex Displaying the Index
2437 @cindex Editing the Index
2438 @cindex Index entries, creating
2439 @cindex Index, displaying
2440 @cindex Index, editing
2441 @kindex C-c >
2442 @findex reftex-display-index
2443
2444 In order to compile and display the index, press @kbd{C-c >}. If the
2445 document uses multiple indices, @RefTeX{} will ask you to select
2446 one. Then, all index entries will be sorted alphabetically and
2447 displayed in a special buffer, the @file{*Index*} buffer. From that
2448 buffer you can check and edit each entry.
2449
2450 The index can be restricted to the current section or the region. Then
2451 only entries in that part of the document will go into the compiled
2452 index. To restrict to the current section, use a numeric prefix
2453 @samp{2}, thus press @kbd{C-u 2 C-c >}. To restrict to the current
2454 region, make the region active and use a numeric prefix @samp{3} (press
2455 @kbd{C-u 3 C-c >}). From within the @file{*Index*} buffer the
2456 restriction can be moved from one section to the next by pressing the
2457 @kbd{<} and @kbd{>} keys.
2458
2459 One caveat: @RefTeX{} finds the definition point of an index entry
2460 by searching near the buffer position where it had found to macro during
2461 scanning. If you have several identical index entries in the same
2462 buffer and significant changes have shifted the entries around, you must
2463 rescan the buffer to ensure the correspondence between the
2464 @file{*Index*} buffer and the definition locations. It is therefore
2465 advisable to rescan the document (with @kbd{r} or @kbd{C-u r})
2466 frequently while editing the index from the @file{*Index*}
2467 buffer.
2468
2469 @kindex ?
2470 Here is a list of special commands available in the @file{*Index*} buffer. A
2471 summary of this information is always available by pressing
2472 @kbd{?}.
2473
2474 @table @kbd
2475 @tablesubheading{General}
2476 @item ?
2477 Display a summary of commands.
2478
2479 @item 0-9, -
2480 Prefix argument.
2481
2482 @tablesubheading{Moving around}
2483 @item ! A..Z
2484 Pressing any capital letter will jump to the corresponding section in
2485 the @file{*Index*} buffer. The exclamation mark is special and jumps to
2486 the first entries alphabetically sorted below @samp{A}. These are
2487 usually non-alphanumeric characters.
2488 @item n
2489 Go to next entry.
2490 @item p
2491 Go to previous entry.
2492
2493 @tablesubheading{Access to document locations}
2494 @item @key{SPC}
2495 Show the place in the document where this index entry is defined.
2496
2497 @item @key{TAB}
2498 Go to the definition of the current index entry in another
2499 window.
2500
2501 @item @key{RET}
2502 Go to the definition of the current index entry and hide the
2503 @file{*Index*} buffer window.
2504
2505 @item f
2506 @vindex reftex-index-follow-mode
2507 @vindex reftex-revisit-to-follow
2508 Toggle follow mode. When follow mode is active, the other window will
2509 always show the location corresponding to the line in the @file{*Index*}
2510 buffer at point. This is similar to pressing @key{SPC} after each
2511 cursor motion. The default for this flag can be set with the variable
2512 @code{reftex-index-follow-mode}. Note that only context in files
2513 already visited is shown. @RefTeX{} will not visit a file just for
2514 follow mode. See, however, the variable
2515 @code{reftex-revisit-to-follow}.
2516
2517 @tablesubheading{Entry editing}
2518 @item e
2519 Edit the current index entry. In the minibuffer, you can edit the
2520 index macro which defines this entry.
2521
2522 @item C-k
2523 Kill the index entry. Currently not implemented because I don't know
2524 how to implement an @code{undo} function for this.
2525
2526 @item *
2527 Edit the @var{key} part of the entry. This is the initial part of the
2528 entry which determines the location of the entry in the index.
2529
2530 @item |
2531 Edit the @var{attribute} part of the entry. This is the part after the
2532 vertical bar. With @code{MakeIndex}, this part is an encapsulating
2533 macro. With @code{xindy}, it is called @emph{attribute} and is a
2534 property of the index entry that can lead to special formatting. When
2535 called with @kbd{C-u} prefix, kill the entire @var{attribute}
2536 part.
2537
2538 @item @@
2539 Edit the @var{visual} part of the entry. This is the part after the
2540 @samp{@@} which is used by @code{MakeIndex} to change the visual
2541 appearance of the entry in the index. When called with @kbd{C-u}
2542 prefix, kill the entire @var{visual} part.
2543
2544 @item (
2545 Toggle the beginning of page range property @samp{|(} of the
2546 entry.
2547
2548 @item )
2549 Toggle the end of page range property @samp{|)} of the entry.
2550
2551 @item _
2552 Make the current entry a subentry. This command will prompt for the
2553 superordinate entry and insert it.
2554
2555 @item ^
2556 Remove the highest superordinate entry. If the current entry is a
2557 subitem (@samp{aaa!bbb!ccc}), this function moves it up the hierarchy
2558 (@samp{bbb!ccc}).
2559
2560 @tablesubheading{Exiting}
2561 @item q
2562 Hide the @file{*Index*} buffer.
2563
2564 @item k
2565 Kill the @file{*Index*} buffer.
2566
2567 @item C-c =
2568 Switch to the Table of Contents buffer of this document.
2569
2570 @tablesubheading{Controlling what gets displayed}
2571 @item c
2572 @vindex reftex-index-include-context
2573 Toggle the display of short context in the @file{*Index*} buffer. The
2574 default for this flag can be set with the variable
2575 @code{reftex-index-include-context}.
2576
2577 @item @}
2578 Restrict the index to a single document section. The corresponding
2579 section number will be displayed in the @code{R<>} indicator in the
2580 mode line and in the header of the @file{*Index*} buffer.
2581
2582 @item @{
2583 Widen the index to contain all entries of the document.
2584
2585 @item <
2586 When the index is currently restricted, move the restriction to the
2587 previous section.
2588
2589 @item >
2590 When the index is currently restricted, move the restriction to the
2591 next section.
2592
2593 @tablesubheading{Updating the buffer}
2594 @item g
2595 Rebuild the @file{*Index*} buffer. This does @emph{not} rescan the
2596 document. However, it sorts the entries again, so that edited entries
2597 will move to the correct position.
2598
2599 @item r
2600 @vindex reftex-enable-partial-scans
2601 Reparse the @LaTeX{} document and rebuild the @file{*Index*} buffer. When
2602 @code{reftex-enable-partial-scans} is non-@code{nil}, rescan only the file this
2603 location is defined in, not the entire document.
2604
2605 @item C-u r
2606 Reparse the @emph{entire} @LaTeX{} document and rebuild the @file{*Index*}
2607 buffer.
2608
2609 @item s
2610 Switch to a different index (for documents with multiple
2611 indices).
2612 @end table
2613
2614
2615 @node Builtin Index Macros
2616 @section Builtin Index Macros
2617 @cindex Builtin index macros
2618 @cindex Index macros, builtin
2619 @vindex reftex-index-macros
2620 @cindex @code{multind}, LaTeX package
2621 @cindex @code{index}, LaTeX package
2622 @cindex LaTeX packages, @code{multind}
2623 @cindex LaTeX packages, @code{index}
2624
2625 @RefTeX{} by default recognizes the @code{\index} and
2626 @code{\glossary} macros which are defined in the @LaTeX{} core. It has
2627 also builtin support for the re-implementations of @code{\index}
2628 in the @file{multind} and @file{index} packages. However, since
2629 the different definitions of the @code{\index} macro are incompatible,
2630 you will have to explicitly specify the index style used.
2631 @xref{Creating Index Entries}, for information on how to do that.
2632
2633 @node Defining Index Macros
2634 @section Defining Index Macros
2635 @cindex Defining Index Macros
2636 @cindex Index macros, defining
2637 @vindex reftex-index-macros
2638
2639 When writing a document with an index you will probably define
2640 additional macros which make entries into the index.
2641 Let's look at an example.
2642
2643 @example
2644 \newcommand@{\ix@}[1]@{#1\index@{#1@}@}
2645 \newcommand@{\nindex@}[1]@{\textit@{#1@}\index[name]@{#1@}@}
2646 \newcommand@{\astobj@}[1]@{\index@{Astronomical Objects!#1@}@}
2647 @end example
2648
2649 The first macro @code{\ix} typesets its argument in the text and places
2650 it into the index. The second macro @code{\nindex} typesets its
2651 argument in the text and places it into a separate index with the tag
2652 @samp{name}@footnote{We are using the syntax of the @file{index} package
2653 here.}. The last macro also places its argument into the index, but as
2654 subitems under the main index entry @samp{Astronomical Objects}. Here
2655 is how to make @RefTeX{} recognize and correctly interpret these
2656 macros, first with Emacs Lisp.
2657
2658 @lisp
2659 (setq reftex-index-macros
2660 '(("\\ix@{*@}" "idx" ?x "" nil nil)
2661 ("\\nindex@{*@}" "name" ?n "" nil nil)
2662 ("\\astobj@{*@}" "idx" ?o "Astronomical Objects!" nil t)))
2663 @end lisp
2664
2665 Note that the index tag is @samp{idx} for the main index, and
2666 @samp{name} for the name index. @samp{idx} and @samp{glo} are reserved
2667 for the default index and for the glossary.
2668
2669 The character arguments @code{?x}, @code{?n}, and @code{?o} are for
2670 quick identification of these macros when @RefTeX{} inserts new
2671 index entries with @code{reftex-index}. These codes need to be
2672 unique. @code{?i}, @code{?I}, and @code{?g} are reserved for the
2673 @code{\index}, @code{\index*}, and @code{\glossary} macros,
2674 respectively.
2675
2676 The following string is empty unless your macro adds a superordinate
2677 entry to the index key; this is the case for the @code{\astobj} macro.
2678
2679 The next entry can be a hook function to exclude certain matches, it
2680 almost always can be @code{nil}.
2681
2682 The final element in the list indicates if the text being indexed needs
2683 to be repeated outside the macro. For the normal index macros, this
2684 should be @code{t}. Only if the macro typesets the entry in the text
2685 (like @code{\ix} and @code{\nindex} in the example do), this should be
2686 @code{nil}.
2687
2688 To do the same thing with customize, you need to fill in the templates
2689 like this:
2690
2691 @example
2692 Repeat:
2693 [INS] [DEL] List:
2694 Macro with args: \ix@{*@}
2695 Index Tag : [Value Menu] String: idx
2696 Access Key : x
2697 Key Prefix :
2698 Exclusion hook : nil
2699 Repeat Outside : [Toggle] off (nil)
2700 [INS] [DEL] List:
2701 Macro with args: \nindex@{*@}
2702 Index Tag : [Value Menu] String: name
2703 Access Key : n
2704 Key Prefix :
2705 Exclusion hook : nil
2706 Repeat Outside : [Toggle] off (nil)
2707 [INS] [DEL] List:
2708 Macro with args: \astobj@{*@}
2709 Index Tag : [Value Menu] String: idx
2710 Access Key : o
2711 Key Prefix : Astronomical Objects!
2712 Exclusion hook : nil
2713 Repeat Outside : [Toggle] on (non-nil)
2714 [INS]
2715 @end example
2716
2717 With the macro @code{\ix} defined, you may want to change the default
2718 macro used for indexing a text phrase (@pxref{Creating Index Entries}).
2719 This would be done like this
2720
2721 @lisp
2722 (setq reftex-index-default-macro '(?x "idx"))
2723 @end lisp
2724
2725 which specifies that the macro identified with the character @code{?x} (the
2726 @code{\ix} macro) should be used for indexing phrases and words already
2727 in the buffer with @kbd{C-c /} (@code{reftex-index-selection-or-word}).
2728 The index tag is "idx".
2729
2730 @node Viewing Cross-References
2731 @chapter Viewing Cross-References
2732 @findex reftex-view-crossref
2733 @findex reftex-mouse-view-crossref
2734 @kindex C-c &
2735 @kindex S-mouse-2
2736
2737 @RefTeX{} can display cross-referencing information. This means,
2738 if two document locations are linked, @RefTeX{} can display the
2739 matching location(s) in another window. The @code{\label} and @code{\ref}
2740 macros are one way of establishing such a link. Also, a @code{\cite}
2741 macro is linked to the corresponding @code{\bibitem} macro or a @BibTeX{}
2742 database entry.
2743
2744 The feature is invoked by pressing @kbd{C-c &}
2745 (@code{reftex-view-crossref}) while point is on the @var{key} argument
2746 of a macro involved in cross-referencing. You can also click with
2747 @kbd{S-mouse-2} on the macro argument. Here is what will happen for
2748 individual classes of macros:
2749
2750 @table @asis
2751
2752 @item @code{\ref}
2753 @cindex @code{\ref}
2754 Display the corresponding label definition. All usual
2755 variants@footnote{all macros that start with @samp{ref} or end with
2756 @samp{ref} or @samp{refrange}} of the @code{\ref} macro are active for
2757 cross-reference display. This works also for labels defined in an
2758 external document when the current document refers to them through the
2759 @code{xr} interface (@pxref{LaTeX xr Package}).
2760
2761 @item @code{\label}
2762 @cindex @code{\label}
2763 @vindex reftex-label-alist
2764 Display a document location which references this label. Pressing
2765 @kbd{C-c &} several times moves through the entire document and finds
2766 all locations. Not only the @code{\label} macro but also other macros
2767 with label arguments (as configured with @code{reftex-label-alist}) are
2768 active for cross-reference display.
2769
2770 @item @code{\cite}
2771 @cindex @code{\cite}
2772 Display the corresponding @BibTeX{} database entry or @code{\bibitem}.
2773 All usual variants@footnote{all macros that either start or end with
2774 @samp{cite}} of the @code{\cite} macro are active for cross-reference
2775 display.
2776
2777 @item @code{\bibitem}
2778 @cindex @code{\bibitem}
2779 Display a document location which cites this article. Pressing
2780 @kbd{C-c &} several times moves through the entire document and finds
2781 all locations.
2782
2783 @item @BibTeX{}
2784 @cindex BibTeX buffer, viewing cite locations from
2785 @cindex Viewing cite locations from BibTeX buffer
2786 @kbd{C-c &} is also active in @BibTeX{} buffers. All locations in a
2787 document where the database entry at point is cited will be displayed.
2788 On first use, @RefTeX{} will prompt for a buffer which belongs to
2789 the document you want to search. Subsequent calls will use the same
2790 document, until you break this link with a prefix argument to @kbd{C-c
2791 &}.
2792
2793 @item @code{\index}
2794 @cindex @code{\index}
2795 Display other locations in the document which are marked by an index
2796 macro with the same key argument. Along with the standard @code{\index}
2797 and @code{\glossary} macros, all macros configured in
2798 @code{reftex-index-macros} will be recognized.
2799 @end table
2800
2801 @vindex reftex-view-crossref-extra
2802 While the display of cross referencing information for the above
2803 mentioned macros is hard-coded, you can configure additional relations
2804 in the variable @code{reftex-view-crossref-extra}.
2805
2806 @iftex
2807 @chapter All the Rest
2808 @end iftex
2809 @ifnottex
2810 @raisesections
2811 @end ifnottex
2812
2813 @node RefTeXs Menu
2814 @section @RefTeX{}'s Menu
2815 @cindex RefTeXs Menu
2816 @cindex Menu, in the menu bar
2817
2818 @RefTeX{} installs a @code{Ref} menu in the menu bar on systems
2819 which support this. From this menu you can access all of
2820 @RefTeX{}'s commands and a few of its options. There is also a
2821 @code{Customize} submenu which can be used to access @RefTeX{}'s
2822 entire set of options.
2823
2824 @node Key Bindings
2825 @section Default Key Bindings
2826 @cindex Key Bindings, summary
2827
2828 Here is a summary of the available key bindings.
2829
2830 @kindex C-c =
2831 @kindex C-c -
2832 @kindex C-c (
2833 @kindex C-c )
2834 @kindex C-c [
2835 @kindex C-c &
2836 @kindex S-mouse-2
2837 @kindex C-c /
2838 @kindex C-c \
2839 @kindex C-c |
2840 @kindex C-c <
2841 @kindex C-c >
2842 @example
2843 @kbd{C-c =} @code{reftex-toc}
2844 @kbd{C-c -} @code{reftex-toc-recenter}
2845 @kbd{C-c (} @code{reftex-label}
2846 @kbd{C-c )} @code{reftex-reference}
2847 @kbd{C-c [} @code{reftex-citation}
2848 @kbd{C-c &} @code{reftex-view-crossref}
2849 @kbd{S-mouse-2} @code{reftex-mouse-view-crossref}
2850 @kbd{C-c /} @code{reftex-index-selection-or-word}
2851 @kbd{C-c \} @code{reftex-index-phrase-selection-or-word}
2852 @kbd{C-c |} @code{reftex-index-visit-phrases-buffer}
2853 @kbd{C-c <} @code{reftex-index}
2854 @kbd{C-c >} @code{reftex-display-index}
2855 @end example
2856
2857 Note that the @kbd{S-mouse-2} binding is only provided if this key is
2858 not already used by some other package. @RefTeX{} will not override an
2859 existing binding to @kbd{S-mouse-2}.
2860
2861 Personally, I also bind some functions in the users @kbd{C-c} map for
2862 easier access.
2863
2864 @c FIXME: Do we need bindings for the Index macros here as well?
2865 @c C-c i C-c I or so????
2866 @c How about key bindings for reftex-reset-mode and reftex-parse-document?
2867 @kindex C-c t
2868 @kindex C-c l
2869 @kindex C-c r
2870 @kindex C-c c
2871 @kindex C-c v
2872 @kindex C-c s
2873 @kindex C-c g
2874 @example
2875 @kbd{C-c t} @code{reftex-toc}
2876 @kbd{C-c l} @code{reftex-label}
2877 @kbd{C-c r} @code{reftex-reference}
2878 @kbd{C-c c} @code{reftex-citation}
2879 @kbd{C-c v} @code{reftex-view-crossref}
2880 @kbd{C-c s} @code{reftex-search-document}
2881 @kbd{C-c g} @code{reftex-grep-document}
2882 @end example
2883
2884 @noindent These keys are reserved for the user, so I cannot bind them by
2885 default. If you want to have these key bindings available, set in your
2886 @file{.emacs} file:
2887
2888 @vindex reftex-extra-bindings
2889 @lisp
2890 (setq reftex-extra-bindings t)
2891 @end lisp
2892
2893 @vindex reftex-load-hook
2894 Changing and adding to @RefTeX{}'s key bindings is best done in the hook
2895 @code{reftex-load-hook}. For information on the keymaps
2896 which should be used to add keys, see @ref{Keymaps and Hooks}.
2897
2898 @node Faces
2899 @section Faces
2900 @cindex Faces
2901
2902 @RefTeX{} uses faces when available to structure the selection and
2903 table of contents buffers. It does not create its own faces, but uses
2904 the ones defined in @file{font-lock.el}. Therefore, @RefTeX{} will
2905 use faces only when @code{font-lock} is loaded. This seems to be
2906 reasonable because people who like faces will very likely have it
2907 loaded. If you wish to turn off fontification or change the involved
2908 faces, see @ref{Options - Fontification}.
2909
2910 @node Multifile Documents
2911 @section Multifile Documents
2912 @cindex Multifile documents
2913 @cindex Documents, spread over files
2914
2915 The following is relevant when working with documents spread over many
2916 files:
2917
2918 @itemize @bullet
2919 @item
2920 @RefTeX{} has full support for multifile documents. You can edit parts of
2921 several (multifile) documents at the same time without conflicts.
2922 @RefTeX{} provides functions to run @code{grep}, @code{search} and
2923 @code{query-replace} on all files which are part of a multifile
2924 document.
2925
2926 @item
2927 @vindex tex-main-file
2928 @vindex TeX-master
2929 All files belonging to a multifile document should define a File
2930 Variable (@code{TeX-master} for @AUCTeX{} or @code{tex-main-file} for the
2931 standard Emacs @LaTeX{} mode) containing the name of the master file. For
2932 example, to set the file variable @code{TeX-master}, include something
2933 like the following at the end of each @TeX{} file:
2934
2935 @example
2936 %%% Local Variables: ***
2937 %%% mode:latex ***
2938 %%% TeX-master: "thesis.tex" ***
2939 %%% End: ***
2940 @end example
2941
2942 @AUCTeX{} with the setting
2943
2944 @lisp
2945 (setq-default TeX-master nil)
2946 @end lisp
2947
2948 will actually ask you for each new file about the master file and insert
2949 this comment automatically. For more details see the documentation of
2950 the @AUCTeX{} (@pxref{Multifile,,,auctex, The AUCTeX User Manual}), the
2951 documentation about the Emacs (La)TeX mode (@pxref{TeX Print,,,emacs,
2952 The GNU Emacs Manual}) and the Emacs documentation on File Variables
2953 (@pxref{File Variables,,,emacs, The GNU Emacs Manual}).
2954
2955 @item
2956 The context of a label definition must be found in the same file as the
2957 label itself in order to be processed correctly by @RefTeX{}. The only
2958 exception is that section labels referring to a section statement
2959 outside the current file can still use that section title as
2960 context.
2961 @end itemize
2962
2963 @node Language Support
2964 @section Language Support
2965 @cindex Language support
2966
2967 Some parts of @RefTeX{} are language dependent. The default
2968 settings work well for English. If you are writing in a different
2969 language, the following hints may be useful:
2970
2971 @itemize @bullet
2972 @item
2973 @vindex reftex-derive-label-parameters
2974 @vindex reftex-abbrev-parameters
2975 The mechanism to derive a label from context includes the abbreviation
2976 of words and omission of unimportant words. These mechanisms may have
2977 to be changed for other languages. See the variables
2978 @code{reftex-derive-label-parameters} and @code{reftex-abbrev-parameters}.
2979
2980 @item
2981 @vindex reftex-translate-to-ascii-function
2982 @vindex reftex-label-illegal-re
2983 Also, when a label is derived from context, @RefTeX{} clears the
2984 context string from non-ASCII characters in order to make a valid label.
2985 If there should ever be a version of @TeX{} which allows extended
2986 characters @emph{in labels}, then we will have to look at the
2987 variables @code{reftex-translate-to-ascii-function} and
2988 @code{reftex-label-illegal-re}.
2989
2990 @item
2991 When a label is referenced, @RefTeX{} looks at the word before point
2992 to guess which label type is required. These @emph{magic words} are
2993 different in every language. For an example of how to add magic words,
2994 see @ref{Adding Magic Words}.
2995
2996 @vindex reftex-multiref-punctuation
2997 @vindex reftex-cite-punctuation
2998 @item
2999 @RefTeX{} inserts ``punctuation'' for multiple references and
3000 for the author list in citations. Some of this may be language
3001 dependent. See the variables @code{reftex-multiref-punctuation} and
3002 @code{reftex-cite-punctuation}.
3003 @end itemize
3004
3005 @node Finding Files
3006 @section Finding Files
3007 @cindex Finding files
3008
3009 In order to find files included in a document via @code{\input} or
3010 @code{\include}, @RefTeX{} searches all directories specified in the
3011 environment variable @code{TEXINPUTS}. Similarly, it will search the
3012 path specified in the variables @code{BIBINPUTS} and @code{TEXBIB} for
3013 @BibTeX{} database files.
3014
3015 When searching, @RefTeX{} will also expand recursive path
3016 definitions (directories ending in @samp{//} or @samp{!!}). But it will
3017 only search and expand directories @emph{explicitly} given in these
3018 variables. This may cause problems under the following circumstances:
3019
3020 @itemize @bullet
3021 @item
3022 Most @TeX{} system have a default search path for both @TeX{} files and @BibTeX{}
3023 files which is defined in some setup file. Usually this default path is
3024 for system files which @RefTeX{} does not need to see. But if your
3025 document needs @TeX{} files or @BibTeX{} database files in a directory only
3026 given in the default search path, @RefTeX{} will fail to find them.
3027 @item
3028 Some @TeX{} systems do not use environment variables at all in order to
3029 specify the search path. Both default and user search path are then
3030 defined in setup files.
3031 @end itemize
3032
3033 @noindent
3034 There are three ways to solve this problem:
3035
3036 @itemize @bullet
3037 @item
3038 Specify all relevant directories explicitly in the environment
3039 variables. If for some reason you don't want to mess with the default
3040 variables @code{TEXINPUTS} and @code{BIBINPUTS}, define your own
3041 variables and configure @RefTeX{} to use them instead:
3042
3043 @lisp
3044 (setq reftex-texpath-environment-variables '("MYTEXINPUTS"))
3045 (setq reftex-bibpath-environment-variables '("MYBIBINPUTS"))
3046 @end lisp
3047
3048 @item
3049 Specify the full search path directly in @RefTeX{}'s variables.
3050
3051 @lisp
3052 (setq reftex-texpath-environment-variables
3053 '("./inp:/home/cd/tex//:/usr/local/tex//"))
3054 (setq reftex-bibpath-environment-variables
3055 '("/home/cd/tex/lit/"))
3056 @end lisp
3057
3058 @item
3059 Some @TeX{} systems provide stand-alone programs to do the file search just
3060 like @TeX{} and @BibTeX{}. E.g., Thomas Esser's @code{teTeX} uses the
3061 @code{kpathsearch} library which provides the command @code{kpsewhich}
3062 to search for files. @RefTeX{} can be configured to use this
3063 program. Note that the exact syntax of the @code{kpsewhich}
3064 command depends upon the version of that program.
3065
3066 @lisp
3067 (setq reftex-use-external-file-finders t)
3068 (setq reftex-external-file-finders
3069 '(("tex" . "kpsewhich -format=.tex %f")
3070 ("bib" . "kpsewhich -format=.bib %f")))
3071 @end lisp
3072 @end itemize
3073
3074 @cindex Noweb files
3075 @vindex reftex-file-extensions
3076 @vindex TeX-file-extensions
3077 Some people like to use RefTeX with noweb files, which usually have the
3078 extension @file{.nw}. In order to deal with such files, the new
3079 extension must be added to the list of valid extensions in the variable
3080 @code{reftex-file-extensions}. When working with @AUCTeX{} as major mode,
3081 the new extension must also be known to @AUCTeX{} via the variable
3082 @code{TeX-file-extension}. For example:
3083
3084 @lisp
3085 (setq reftex-file-extensions
3086 '(("nw" "tex" ".tex" ".ltx") ("bib" ".bib")))
3087 (setq TeX-file-extensions
3088 '( "nw" "tex" "sty" "cls" "ltx" "texi" "texinfo"))
3089 @end lisp
3090
3091 @node Optimizations
3092 @section Optimizations
3093 @cindex Optimizations
3094
3095 @b{Note added 2002. Computers have gotten a lot faster, so most of the
3096 optimizations discussed below will not be necessary on new machines. I
3097 am leaving this stuff in the manual for people who want to write thick
3098 books, where some of it still might be useful.}
3099
3100 Implementing the principle of least surprises, the default settings of
3101 @RefTeX{} ensure a safe ride for beginners and casual users. However,
3102 when using @RefTeX{} for a large project and/or on a small computer,
3103 there are ways to improve speed or memory usage.
3104
3105 @itemize @bullet
3106 @item
3107 @b{Removing Lookup Buffers}@*
3108 @cindex Removing lookup buffers
3109 @RefTeX{} will load other parts of a multifile document as well as @BibTeX{}
3110 database files for lookup purposes. These buffers are kept, so that
3111 subsequent use of the same files is fast. If you can't afford keeping
3112 these buffers around, and if you can live with a speed penalty, try
3113
3114 @vindex reftex-keep-temporary-buffers
3115 @lisp
3116 (setq reftex-keep-temporary-buffers nil)
3117 @end lisp
3118
3119 @item
3120 @b{Partial Document Scans}@*
3121 @cindex Partial documents scans
3122 @cindex Document scanning, partial
3123 A @kbd{C-u} prefix on the major @RefTeX{} commands @code{reftex-label}
3124 (@kbd{C-u C-c (}), @code{reftex-reference} (@kbd{C-u C-c )}),
3125 @code{reftex-citation} (@kbd{C-u C-c [}), @code{reftex-toc} (@kbd{C-u C-c
3126 =}), and @code{reftex-view-crossref} (@kbd{C-u C-c &}) initiates
3127 re-parsing of the entire document in order to update the parsing
3128 information. For a large document this can be unnecessary, in
3129 particular if only one file has changed. @RefTeX{} can be configured
3130 to do partial scans instead of full ones. @kbd{C-u} re-parsing then
3131 does apply only to the current buffer and files included from it.
3132 Likewise, the @kbd{r} key in both the label selection buffer and the
3133 table-of-contents buffer will only prompt scanning of the file in which
3134 the label or section macro near the cursor was defined. Re-parsing of
3135 the entire document is still available by using @kbd{C-u C-u} as a
3136 prefix, or the capital @kbd{R} key in the menus. To use this feature,
3137 try
3138
3139 @vindex reftex-enable-partial-scans
3140 @lisp
3141 (setq reftex-enable-partial-scans t)
3142 @end lisp
3143
3144 @item
3145 @b{Saving Parser Information}@*
3146 @cindex Saving parser information
3147 @cindex Parse information, saving to a file
3148 @vindex reftex-parse-file-extension
3149 Even with partial scans enabled, @RefTeX{} still has to make one full
3150 scan, when you start working with a document. To avoid this, parsing
3151 information can be stored in a file. The file @file{MASTER.rel} is used
3152 for storing information about a document with master file
3153 @file{MASTER.tex}. It is written automatically when you kill a buffer
3154 in @code{reftex-mode} or when you exit Emacs. The information is
3155 restored when you begin working with a document in a new editing
3156 session. To use this feature, put into @file{.emacs}:
3157
3158 @vindex reftex-save-parse-info
3159 @lisp
3160 (setq reftex-save-parse-info t)
3161 @end lisp
3162
3163 @item
3164 @b{Identifying label types by prefix}@*
3165 @cindex Parse information, saving to a file
3166 @vindex reftex-trust-label-prefix
3167 @RefTeX{} normally parses around each label to check in which
3168 environment this label is located, in order to assign a label type to
3169 the label. If your document contains thousands of labels, document
3170 parsing will take considerable time. If you have been using label prefixes
3171 like tab: and fn: consistently, you can tell @RefTeX{} to get the
3172 label type directly from the prefix, without additional parsing. This
3173 will be faster and also allow labels to end up in the correct category
3174 if for some reason it is not possible to derive the correct type from
3175 context. For example, to enable this feature for footnote and
3176 equation labels, use
3177
3178 @lisp
3179 (setq reftex-trust-label-prefix '("fn:" "eq:"))
3180 @end lisp
3181
3182 @item
3183 @b{Automatic Document Scans}@*
3184 @cindex Automatic document scans
3185 @cindex Document scanning, automatic
3186 At rare occasions, @RefTeX{} will automatically rescan a part of the
3187 document. If this gets into your way, it can be turned off with
3188
3189 @vindex reftex-allow-automatic-rescan
3190 @lisp
3191 (setq reftex-allow-automatic-rescan nil)
3192 @end lisp
3193
3194 @RefTeX{} will then occasionally annotate new labels in the selection
3195 buffer, saying that their position in the label list in uncertain. A
3196 manual document scan will fix this.
3197
3198 @item
3199 @b{Multiple Selection Buffers}@*
3200 @cindex Multiple selection buffers
3201 @cindex Selection buffers, multiple
3202 Normally, the selection buffer @file{*RefTeX Select*} is re-created for
3203 every selection process. In documents with very many labels this can
3204 take several seconds. @RefTeX{} provides an option to create a
3205 separate selection buffer for each label type and to keep this buffer
3206 from one selection to the next. These buffers are updated automatically
3207 only when a new label has been added in the buffers category with
3208 @code{reftex-label}. Updating the buffer takes as long as recreating it
3209 - so the time saving is limited to cases where no new labels of that
3210 category have been added. To turn on this feature, use
3211
3212 @vindex reftex-use-multiple-selection-buffers
3213 @lisp
3214 (setq reftex-use-multiple-selection-buffers t)
3215 @end lisp
3216
3217 @noindent
3218 @cindex Selection buffers, updating
3219 You can also inhibit the automatic updating entirely. Then the
3220 selection buffer will always pop up very fast, but may not contain the
3221 most recently defined labels. You can always update the buffer by hand,
3222 with the @kbd{g} key. To get this behavior, use instead
3223
3224 @vindex reftex-auto-update-selection-buffers
3225 @lisp
3226 (setq reftex-use-multiple-selection-buffers t
3227 reftex-auto-update-selection-buffers nil)
3228 @end lisp
3229 @end itemize
3230
3231 @need 2000
3232 @noindent
3233 @b{As a summary}, here are the settings I recommend for heavy use of
3234 @RefTeX{} with large documents:
3235
3236 @lisp
3237 @group
3238 (setq reftex-enable-partial-scans t
3239 reftex-save-parse-info t
3240 reftex-use-multiple-selection-buffers t)
3241 @end group
3242 @end lisp
3243
3244 @node AUCTeX
3245 @section @AUCTeX{}
3246 @cindex @code{AUCTeX}, Emacs package
3247 @cindex Emacs packages, @code{AUCTeX}
3248
3249 @AUCTeX{} is without doubt the best major mode for editing @TeX{} and @LaTeX{}
3250 files with Emacs (@pxref{Top,AUCTeX,,auctex, The AUCTeX User Manual}).
3251 If @AUCTeX{} is not part of your Emacs distribution, you can get
3252 it@footnote{XEmacs 21.x users may want to install the corresponding
3253 XEmacs package.} by FTP from the @value{AUCTEXSITE}.
3254
3255 @menu
3256 * AUCTeX-RefTeX Interface:: How both packages work together
3257 * Style Files:: @AUCTeX{}'s style files can support RefTeX
3258 * Bib-Cite:: Hypertext reading of a document
3259 @end menu
3260
3261 @node AUCTeX-RefTeX Interface
3262 @subsection The @AUCTeX{}-@RefTeX{} Interface
3263
3264 @RefTeX{} contains code to interface with @AUCTeX{}. When this
3265 interface is turned on, both packages will interact closely. Instead of
3266 using @RefTeX{}'s commands directly, you can then also use them
3267 indirectly as part of the @AUCTeX{}
3268 environment@footnote{@RefTeX{} 4.0 and @AUCTeX{} 9.10c will be
3269 needed for all of this to work. Parts of it work also with earlier
3270 versions.}. The interface is turned on with
3271
3272 @lisp
3273 (setq reftex-plug-into-AUCTeX t)
3274 @end lisp
3275
3276 If you need finer control about which parts of the interface are used
3277 and which not, read the docstring of the variable
3278 @code{reftex-plug-into-AUCTeX} or customize it with @kbd{M-x
3279 customize-variable @key{RET} reftex-plug-into-AUCTeX @key{RET}}.
3280
3281 The following list describes the individual parts of the interface.
3282
3283 @itemize @bullet
3284 @item
3285 @findex reftex-label
3286 @vindex LaTeX-label-function, @r{AUCTeX}
3287 @kindex C-c C-e
3288 @kindex C-c C-s
3289 @findex LaTeX-section, @r{AUCTeX}
3290 @findex TeX-insert-macro, @r{AUCTeX}
3291 @b{@AUCTeX{} calls @code{reftex-label} to insert labels}@*
3292 When a new section is created with @kbd{C-c C-s}, or a new environment
3293 is inserted with @kbd{C-c C-e}, @AUCTeX{} normally prompts for a label to
3294 go with it. With the interface, @code{reftex-label} is called instead.
3295 For example, if you type @kbd{C-c C-e equation @key{RET}}, @AUCTeX{} and
3296 @RefTeX{} will insert
3297
3298 @example
3299 \begin@{equation@}
3300 \label@{eq:1@}
3301
3302 \end@{equation@}
3303 @end example
3304
3305 @noindent
3306 without further prompts.
3307
3308 Similarly, when you type @kbd{C-c C-s section @key{RET}}, @RefTeX{}
3309 will offer its default label which is derived from the section title.
3310
3311 @item
3312 @b{@AUCTeX{} tells @RefTeX{} about new sections}@*
3313 When creating a new section with @kbd{C-c C-s}, @RefTeX{} will not
3314 have to rescan the buffer in order to see it.
3315
3316 @item
3317 @findex reftex-arg-label
3318 @findex TeX-arg-label, @r{AUCTeX function}
3319 @findex reftex-arg-ref
3320 @findex TeX-arg-ref, @r{AUCTeX function}
3321 @findex reftex-arg-cite
3322 @findex TeX-arg-cite, @r{AUCTeX function}
3323 @findex reftex-arg-index
3324 @findex TeX-arg-index, @r{AUCTeX function}
3325 @findex TeX-insert-macro, @r{AUCTeX function}
3326 @kindex C-c @key{RET}
3327 @b{@RefTeX{} supplies macro arguments}@* When you insert a macro
3328 interactively with @kbd{C-c @key{RET}}, @AUCTeX{} normally prompts for
3329 macro arguments. Internally, it uses the functions
3330 @code{TeX-arg-label}, @code{TeX-arg-cite}, and @code{TeX-arg-index} to
3331 prompt for arguments which are labels, citation keys and index entries.
3332 The interface takes over these functions@footnote{@code{fset} is used to
3333 do this, which is not reversible. However, @RefTeX{} implements the
3334 old functionality when you later decide to turn off the interface.} and
3335 supplies the macro arguments with @b{@RefTeX{}'s} mechanisms. For
3336 example, when you type @kbd{C-c @key{RET} ref @key{RET}}, @RefTeX{}
3337 will supply its label selection process (@pxref{Referencing
3338 Labels}).
3339
3340 @item
3341 @b{@RefTeX{} tells @AUCTeX{} about new labels, citation and index keys}@*
3342 @RefTeX{} will add all newly created labels to @AUCTeX{}'s completion list.
3343 @end itemize
3344
3345 @node Style Files
3346 @subsection Style Files
3347 @cindex Style files, AUCTeX
3348 @findex TeX-add-style-hook, @r{AUCTeX}
3349 Style files are Emacs Lisp files which are evaluated by @AUCTeX{} in
3350 association with the @code{\documentclass} and @code{\usepackage}
3351 commands of a document (@pxref{Style Files,,,auctex}). Support for
3352 @RefTeX{} in such a style file is useful when the @LaTeX{} style
3353 defines macros or environments connected with labels, citations, or the
3354 index. Many style files (e.g., @file{amsmath.el} or @file{natbib.el})
3355 distributed with @AUCTeX{} already support @RefTeX{} in this
3356 way.
3357
3358 Before calling a @RefTeX{} function, the style hook should always
3359 test for the availability of the function, so that the style file will
3360 also work for people who do not use @RefTeX{}.
3361
3362 Additions made with style files in the way described below remain local
3363 to the current document. For example, if one package uses AMSTeX, the
3364 style file will make @RefTeX{} switch over to @code{\eqref}, but
3365 this will not affect other documents.
3366
3367 @findex reftex-add-label-environments
3368 @findex reftex-add-to-label-alist
3369 A style hook may contain calls to
3370 @code{reftex-add-label-environments}@footnote{This used to be the
3371 function @code{reftex-add-to-label-alist} which is still available as an
3372 alias for compatibility.} which defines additions to
3373 @code{reftex-label-alist}. The argument taken by this function must have
3374 the same format as @code{reftex-label-alist}. The @file{amsmath.el}
3375 style file of @AUCTeX{} for example contains the following:
3376
3377 @lisp
3378 @group
3379 (TeX-add-style-hook "amsmath"
3380 (lambda ()
3381 (if (fboundp 'reftex-add-label-environments)
3382 (reftex-add-label-environments '(AMSTeX)))))
3383 @end group
3384 @end lisp
3385
3386 @noindent
3387 @findex LaTeX-add-environments, @r{AUCTeX}
3388 while a package @code{myprop} defining a @code{proposition} environment
3389 with @code{\newtheorem} might use
3390
3391 @lisp
3392 @group
3393 (TeX-add-style-hook "myprop"
3394 (lambda ()
3395 (LaTeX-add-environments '("proposition" LaTeX-env-label))
3396 (if (fboundp 'reftex-add-label-environments)
3397 (reftex-add-label-environments
3398 '(("proposition" ?p "prop:" "~\\ref@{%s@}" t
3399 ("Proposition" "Prop.") -3))))))
3400 @end group
3401 @end lisp
3402
3403 @findex reftex-set-cite-format
3404 Similarly, a style hook may contain a call to
3405 @code{reftex-set-cite-format} to set the citation format. The style
3406 file @file{natbib.el} for the Natbib citation style does switch
3407 @RefTeX{}'s citation format like this:
3408
3409 @lisp
3410 (TeX-add-style-hook "natbib"
3411 (lambda ()
3412 (if (fboundp 'reftex-set-cite-format)
3413 (reftex-set-cite-format 'natbib))))
3414 @end lisp
3415
3416 @findex reftex-add-index-macros
3417 The hook may contain a call to @code{reftex-add-index-macros} to
3418 define additional @code{\index}-like macros. The argument must have
3419 the same format as @code{reftex-index-macros}. It may be a symbol, to
3420 trigger support for one of the builtin index packages. For example,
3421 the style @file{multind.el} contains
3422
3423 @lisp
3424 (TeX-add-style-hook "multind"
3425 (lambda ()
3426 (and (fboundp 'reftex-add-index-macros)
3427 (reftex-add-index-macros '(multind)))))
3428 @end lisp
3429
3430 If you have your own package @file{myindex} which defines the
3431 following macros to be used with the @LaTeX{} @file{index.sty} file
3432 @example
3433 \newcommand@{\molec@}[1]@{#1\index@{Molecules!#1@}@}
3434 \newcommand@{\aindex@}[1]@{#1\index[author]@{#1@}
3435 @end example
3436
3437 you could write this in the style file @file{myindex.el}:
3438
3439 @lisp
3440 (TeX-add-style-hook "myindex"
3441 (lambda ()
3442 (TeX-add-symbols
3443 '("molec" TeX-arg-index)
3444 '("aindex" TeX-arg-index))
3445 (if (fboundp 'reftex-add-index-macros)
3446 (reftex-add-index-macros
3447 '(("molec@{*@}" "idx" ?m "Molecules!" nil nil)
3448 ("aindex@{*@}" "author" ?a "" nil nil))))))
3449 @end lisp
3450
3451 @findex reftex-add-section-levels
3452 Finally the hook may contain a call to @code{reftex-add-section-levels}
3453 to define additional section statements. For example, the FoilTeX class
3454 has just two headers, @code{\foilhead} and @code{\rotatefoilhead}. Here
3455 is a style file @file{foils.el} that will inform @RefTeX{} about these:
3456
3457 @lisp
3458 (TeX-add-style-hook "foils"
3459 (lambda ()
3460 (if (fboundp 'reftex-add-section-levels)
3461 (reftex-add-section-levels '(("foilhead" . 3)
3462 ("rotatefoilhead" . 3))))))
3463 @end lisp
3464
3465 @node Bib-Cite
3466 @subsection Bib-Cite
3467 @cindex @code{bib-cite}, Emacs package
3468 @cindex Emacs packages, @code{bib-cite}
3469
3470 Once you have written a document with labels, references and citations,
3471 it can be nice to read it like a hypertext document. @RefTeX{} has
3472 support for that: @code{reftex-view-crossref} (bound to @kbd{C-c
3473 &}), @code{reftex-mouse-view-crossref} (bound to @kbd{S-mouse-2}), and
3474 @code{reftex-search-document}. A somewhat fancier interface with mouse
3475 highlighting is provided (among other things) by Peter S. Galbraith's
3476 @file{bib-cite.el}. There is some overlap in the functionalities of
3477 Bib-cite and @RefTeX{}. Bib-cite.el comes bundled with
3478 @AUCTeX{}.
3479
3480 Bib-cite version 3.06 and later can be configured so that bib-cite's
3481 mouse functions use @RefTeX{} for displaying references and citations.
3482 This can be useful in particular when working with the @LaTeX{} @code{xr}
3483 package or with an explicit @code{thebibliography} environment (rather
3484 than @BibTeX{}). Bib-cite cannot handle those, but @RefTeX{} does. To
3485 make use of this feature, try
3486
3487 @vindex bib-cite-use-reftex-view-crossref
3488 @lisp
3489 (setq bib-cite-use-reftex-view-crossref t)
3490 @end lisp
3491
3492 @page
3493 @node Problems and Work-Arounds
3494 @section Problems and Work-arounds
3495 @cindex Problems and work-arounds
3496
3497 @itemize @bullet
3498 @item
3499 @b{@LaTeX{} commands}@*
3500 @cindex LaTeX commands, not found
3501 @code{\input}, @code{\include}, and @code{\section} (etc.)@: statements
3502 have to be first on a line (except for white space).
3503
3504 @item
3505 @b{Commented regions}@*
3506 @cindex Labels, commented out
3507 @RefTeX{} sees also labels in regions commented out and will refuse to
3508 make duplicates of such labels. This is considered to be a feature.
3509
3510 @item
3511 @b{Wrong section numbers}@*
3512 @cindex Section numbers, wrong
3513 @vindex reftex-enable-partial-scans
3514 When using partial scans (@code{reftex-enable-partial-scans}), the section
3515 numbers in the table of contents may eventually become wrong. A full
3516 scan will fix this.
3517
3518 @item
3519 @b{Local settings}@*
3520 @cindex Settings, local
3521 @findex reftex-add-label-environments
3522 @findex reftex-set-cite-format
3523 @findex reftex-add-section-levels
3524 The label environment definitions in @code{reftex-label-alist} are
3525 global and apply to all documents. If you need to make definitions
3526 local to a document, because they would interfere with settings in other
3527 documents, you should use @AUCTeX{} and set up style files with calls to
3528 @code{reftex-add-label-environments}, @code{reftex-set-cite-format},
3529 @code{reftex-add-index-macros}, and @code{reftex-add-section-levels}.
3530 Settings made with these functions remain local to the current
3531 document. @xref{AUCTeX}.
3532
3533 @item
3534 @b{Funny display in selection buffer}@*
3535 @cindex @code{x-symbol}, Emacs package
3536 @cindex Emacs packages, @code{x-symbol}
3537 @cindex @code{isotex}, Emacs package
3538 @cindex Emacs packages, @code{isotex}
3539 @cindex @code{iso-cvt}, Emacs package
3540 @cindex Emacs packages, @code{iso-cvt}
3541 When using packages which make the buffer representation of a file
3542 different from its disk representation (e.g., x-symbol, isotex,
3543 iso-cvt) you may find that @RefTeX{}'s parsing information sometimes
3544 reflects the disk state of a file. This happens only in @emph{unvisited}
3545 parts of a multifile document, because @RefTeX{} visits these files
3546 literally for speed reasons. Then both short context and section
3547 headings may look different from what you usually see on your screen.
3548 In rare cases @code{reftex-toc} may have problems to jump to an affected
3549 section heading. There are three possible ways to deal with
3550 this:
3551 @itemize @minus
3552 @item
3553 @vindex reftex-keep-temporary-buffers
3554 @code{(setq reftex-keep-temporary-buffers t)}@*
3555 This implies that @RefTeX{} will load all parts of a multifile
3556 document into Emacs (i.e., there won't be any temporary buffers).
3557 @item
3558 @vindex reftex-initialize-temporary-buffers
3559 @code{(setq reftex-initialize-temporary-buffers t)}@*
3560 This means full initialization of temporary buffers. It involves
3561 a penalty when the same unvisited file is used for lookup often.
3562 @item
3563 Set @code{reftex-initialize-temporary-buffers} to a list of hook
3564 functions doing a minimal initialization.
3565 @end itemize
3566 @vindex reftex-refontify-context
3567 See also the variable @code{reftex-refontify-context}.
3568
3569 @item
3570 @b{Labels as arguments to \begin}@*
3571 @cindex @code{pf}, LaTeX package
3572 @cindex LaTeX packages, @code{pf}
3573 Some packages use an additional argument to a @code{\begin} macro
3574 to specify a label. E.g., Lamport's @file{pf.sty} uses both
3575 @example
3576 \step@{@var{label}@}@{@var{claim}@} and \begin@{step+@}@{@var{label}@}
3577 @var{claim}
3578 \end@{step+@}
3579 @end example
3580
3581 @noindent
3582 We need to trick @RefTeX{} into swallowing this:
3583
3584 @lisp
3585 @group
3586 ;; Configuration for Lamport's pf.sty
3587 (setq reftex-label-alist
3588 '(("\\step@{*@}@{@}" ?p "st:" "~\\stepref@{%s@}" 2 ("Step" "St."))
3589 ("\\begin@{step+@}@{*@}" ?p "st:" "~\\stepref@{%s@}" 1000)))
3590 @end group
3591 @end lisp
3592
3593 @noindent
3594 The first line is just a normal configuration for a macro. For the
3595 @code{step+} environment we actually tell @RefTeX{} to look for the
3596 @emph{macro} @samp{\begin@{step+@}} and interpret the @emph{first}
3597 argument (which really is a second argument to the macro @code{\begin})
3598 as a label of type @code{?p}. Argument count for this macro starts only
3599 after the @samp{@{step+@}}, also when specifying how to get
3600 context.
3601
3602 @item
3603 @b{Idle timers in XEmacs}@*
3604 @cindex Idle timer restart
3605 @vindex reftex-use-itimer-in-xemacs
3606 In XEmacs, idle timer restart does not work reliably after fast
3607 keystrokes. Therefore @RefTeX{} currently uses the post command
3608 hook to start the timer used for automatic crossref information. When
3609 this bug gets fixed, a real idle timer can be requested with
3610 @lisp
3611 (setq reftex-use-itimer-in-xemacs t)
3612 @end lisp
3613
3614 @item
3615 @b{Viper mode}@*
3616 @cindex Viper mode
3617 @cindex Key bindings, problems with Viper mode
3618 @findex viper-harness-minor-mode
3619 With @i{Viper} mode prior to Vipers version 3.01, you need to protect
3620 @RefTeX{}'s keymaps with
3621
3622 @lisp
3623 (viper-harness-minor-mode "reftex")
3624 @end lisp
3625
3626 @end itemize
3627
3628 @page
3629 @node Imprint
3630 @section Imprint
3631 @cindex Imprint
3632 @cindex Maintainer
3633 @cindex Acknowledgments
3634 @cindex Thanks
3635 @cindex Bug reports
3636 @cindex @code{http}, @RefTeX{} home page
3637 @cindex @code{ftp}, @RefTeX{} site
3638
3639 @c dominik@@science.uva.nl
3640 @RefTeX{} was written by @i{Carsten Dominik}, with contributions by @i{Stephen
3641 Eglen}. @RefTeX{} is currently maintained by @value{MAINTAINER}, see
3642 the @value{MAINTAINERSITE} for detailed information.
3643
3644 If you have questions about @RefTeX{}, you can send email to the
3645 @value{SUPPORTADDRESS}. If you want to contribute code or ideas, write
3646 to the @value{DEVELADDRESS}. And in the rare case of finding a bug,
3647 please use @kbd{M-x reftex-report-bug @key{RET}} which will prepare a
3648 bug report with useful information about your setup. Remember to add
3649 essential information like a recipe for reproducing the bug, what you
3650 expected to happen, and what actually happened. Send the bug report to
3651 the @value{BUGADDRESS}.
3652
3653 There are also several Usenet groups which have competent readers who
3654 might be able to help: @code{comp.emacs}, @code{gnu.emacs.help},
3655 @code{comp.emacs.xemacs}, and @code{comp.text.tex}.
3656
3657 Thanks to the people on the Net who have used @RefTeX{} and helped
3658 developing it with their reports. In particular thanks to @i{Ralf
3659 Angeli, Fran Burstall, Alastair Burt, Lars Clausen, Soren Dayton,
3660 Stephen Eglen, Karl Eichwalder, Erik Frisk, Peter Galbraith, Kai
3661 Grossjohann, Frank Harrell, Till A. Heilmann, Peter Heslin, Stephan
3662 Heuel, Alan Ho, Lute Kamstra, Dieter Kraft, David Kastrup, Adrian Lanz,
3663 Juri Linkov, Wolfgang Mayer, Rory Molinari, Stefan Monnier, Laurent
3664 Mugnier, Dan Nicolaescu, Sudeep Kumar Palat, Daniel Polani, Alan Shutko,
3665 Robin Socha, Richard Stanton, Allan Strand, Jan Vroonhof, Christoph
3666 Wedler, Alan Williams, Roland Winkler, Hans-Christoph Wirth, Eli
3667 Zaretskii}.
3668
3669 The @code{view-crossref} feature was inspired by @i{Peter Galbraith's}
3670 @file{bib-cite.el}.
3671
3672 Finally thanks to @i{Uwe Bolick} who first got me interested in
3673 supporting @LaTeX{} labels and references with an editor (which was
3674 MicroEmacs at the time).
3675
3676 @c Turn off the raising that we turned on in ``All the rest''.
3677 @ifnottex
3678 @lowersections
3679 @end ifnottex
3680
3681 @node Commands
3682 @chapter Commands
3683 @cindex Commands, list of
3684
3685 Here is a summary of @RefTeX{}'s commands which can be executed from
3686 @LaTeX{} files. Command which are executed from the special buffers are
3687 not described here. All commands are available from the @code{Ref}
3688 menu. See @xref{Key Bindings}.
3689
3690 @deffn Command reftex-toc
3691 Show the table of contents for the current document. When called with
3692 one ore two @kbd{C-u} prefixes, rescan the document first.
3693 @end deffn
3694
3695 @deffn Command reftex-label
3696 Insert a unique label. With one or two @kbd{C-u} prefixes, enforce
3697 document rescan first.
3698 @end deffn
3699
3700 @deffn Command reftex-reference
3701 Start a selection process to select a label, and insert a reference to
3702 it. With one or two @kbd{C-u} prefixes, enforce document rescan first.
3703 @end deffn
3704
3705 @deffn Command reftex-citation
3706 Make a citation using @BibTeX{} database files. After prompting for a regular
3707 expression, scans the buffers with @BibTeX{} entries (taken from the
3708 @code{\bibliography} command or a @code{thebibliography} environment)
3709 and offers the matching entries for selection. The selected entry is
3710 formatted according to @code{reftex-cite-format} and inserted into the
3711 buffer. @*
3712 When called with a @kbd{C-u} prefix, prompt for optional arguments in
3713 cite macros. When called with a numeric prefix, make that many citations.
3714 When called with point inside the braces of a @code{\cite} command, it
3715 will add another key, ignoring the value of
3716 @code{reftex-cite-format}. @*
3717 The regular expression uses an expanded syntax: @samp{&&} is interpreted
3718 as @code{and}. Thus, @samp{aaaa&&bbb} matches entries which contain
3719 both @samp{aaaa} and @samp{bbb}. While entering the regexp, completion
3720 on knows citation keys is possible. @samp{=} is a good regular
3721 expression to match all entries in all files.
3722 @end deffn
3723
3724 @deffn Command reftex-index
3725 Query for an index macro and insert it along with its arguments. The
3726 index macros available are those defined in @code{reftex-index-macro} or
3727 by a call to @code{reftex-add-index-macros}, typically from an @AUCTeX{}
3728 style file. @RefTeX{} provides completion for the index tag and the
3729 index key, and will prompt for other arguments.
3730 @end deffn
3731
3732 @deffn Command reftex-index-selection-or-word
3733 Put current selection or the word near point into the default index
3734 macro. This uses the information in @code{reftex-index-default-macro}
3735 to make an index entry. The phrase indexed is the current selection or
3736 the word near point. When called with one @kbd{C-u} prefix, let the
3737 user have a chance to edit the index entry. When called with 2
3738 @kbd{C-u} as prefix, also ask for the index macro and other stuff. When
3739 called inside @TeX{} math mode as determined by the @file{texmathp.el}
3740 library which is part of @AUCTeX{}, the string is first processed with the
3741 @code{reftex-index-math-format}, which see.
3742 @end deffn
3743
3744 @deffn Command reftex-index-phrase-selection-or-word
3745 Add current selection or the word at point to the phrases buffer.
3746 When you are in transient-mark-mode and the region is active, the
3747 selection will be used; otherwise the word at point.
3748 You get a chance to edit the entry in the phrases buffer; to save the
3749 buffer and return to the @LaTeX{} document, finish with @kbd{C-c C-c}.
3750 @end deffn
3751
3752 @deffn Command reftex-index-visit-phrases-buffer
3753 Switch to the phrases buffer, initialize if empty.
3754 @end deffn
3755
3756 @deffn Command reftex-index-phrases-apply-to-region
3757 Index all index phrases in the current region.
3758 This works exactly like global indexing from the index phrases buffer,
3759 but operation is restricted to the current region.
3760 @end deffn
3761
3762 @deffn Command reftex-display-index
3763 Display a buffer with an index compiled from the current document.
3764 When the document has multiple indices, first prompts for the correct one.
3765 When index support is turned off, offer to turn it on.
3766 With one or two @kbd{C-u} prefixes, rescan document first.
3767 With prefix 2, restrict index to current document section.
3768 With prefix 3, restrict index to active region.
3769 @end deffn
3770
3771 @deffn Command reftex-view-crossref
3772 View cross reference of macro at point. Point must be on the @var{key}
3773 argument. Works with the macros @code{\label}, @code{\ref},
3774 @code{\cite}, @code{\bibitem}, @code{\index} and many derivatives of
3775 these. Where it makes sense, subsequent calls show additional
3776 locations. See also the variable @code{reftex-view-crossref-extra} and
3777 the command @code{reftex-view-crossref-from-bibtex}. With one or two
3778 @kbd{C-u} prefixes, enforce rescanning of the document. With argument
3779 2, select the window showing the cross reference.
3780 @end deffn
3781
3782 @deffn Command reftex-view-crossref-from-bibtex
3783 View location in a @LaTeX{} document which cites the @BibTeX{} entry at point.
3784 Since @BibTeX{} files can be used by many @LaTeX{} documents, this function
3785 prompts upon first use for a buffer in @RefTeX{} mode. To reset this
3786 link to a document, call the function with a prefix arg. Calling
3787 this function several times find successive citation locations.
3788 @end deffn
3789
3790 @deffn Command reftex-create-tags-file
3791 Create TAGS file by running @code{etags} on the current document. The
3792 TAGS file is also immediately visited with
3793 @code{visit-tags-table}.
3794 @end deffn
3795
3796 @deffn Command reftex-grep-document
3797 Run grep query through all files related to this document.
3798 With prefix arg, force to rescan document.
3799 No active TAGS table is required.
3800 @end deffn
3801
3802 @deffn Command reftex-search-document
3803 Regexp search through all files of the current document.
3804 Starts always in the master file. Stops when a match is found.
3805 No active TAGS table is required.
3806 @end deffn
3807
3808 @deffn Command reftex-query-replace-document
3809 Run a query-replace-regexp of @var{from} with @var{to} over the entire
3810 document. With prefix arg, replace only word-delimited matches. No
3811 active TAGS table is required.
3812 @end deffn
3813
3814 @deffn Command reftex-isearch-minor-mode
3815 Toggle a minor mode which enables incremental search to work globally
3816 on the entire multifile document. Files will be searched in the
3817 sequence they appear in the document.
3818 @end deffn
3819
3820 @deffn Command reftex-goto-label
3821 Prompt for a label (with completion) and jump to the location of this
3822 label. Optional prefix argument @var{other-window} goes to the label in
3823 another window.
3824 @end deffn
3825
3826
3827 @deffn Command reftex-change-label
3828 Query replace @var{from} with @var{to} in all @code{\label} and
3829 @code{\ref} commands. Works on the entire multifile document. No
3830 active TAGS table is required.
3831 @end deffn
3832
3833 @deffn Command reftex-renumber-simple-labels
3834 Renumber all simple labels in the document to make them sequentially.
3835 Simple labels are the ones created by RefTeX, consisting only of the
3836 prefix and a number. After the command completes, all these labels will
3837 have sequential numbers throughout the document. Any references to the
3838 labels will be changed as well. For this, @RefTeX{} looks at the
3839 arguments of any macros which either start or end with the string
3840 @samp{ref}. This command should be used with care, in particular in
3841 multifile documents. You should not use it if another document refers
3842 to this one with the @code{xr} package.
3843 @end deffn
3844
3845 @deffn Command reftex-find-duplicate-labels
3846 Produce a list of all duplicate labels in the document.
3847 @end deffn
3848
3849 @deffn Command reftex-create-bibtex-file
3850 @vindex reftex-create-bibtex-header
3851 @vindex reftex-create-bibtex-footer
3852 Create a new @BibTeX{} database file with all entries referenced in
3853 document. The command prompts for a filename and writes the collected
3854 entries to that file. Only entries referenced in the current document
3855 with any @code{\cite}-like macros are used. The sequence in the new
3856 file is the same as it was in the old database.
3857
3858 Entries referenced from other entries must appear after all referencing
3859 entries.
3860
3861 You can define strings to be used as header or footer for the created
3862 files in the variables @code{reftex-create-bibtex-header} or
3863 @code{reftex-create-bibtex-footer} respectively.
3864 @end deffn
3865
3866 @deffn Command reftex-customize
3867 Run the customize browser on the @RefTeX{} group.
3868 @end deffn
3869 @deffn Command reftex-show-commentary
3870 Show the commentary section from @file{reftex.el}.
3871 @end deffn
3872 @deffn Command reftex-info
3873 Run info on the top @RefTeX{} node.
3874 @end deffn
3875 @deffn Command reftex-parse-document
3876 Parse the entire document in order to update the parsing information.
3877 @end deffn
3878 @deffn Command reftex-reset-mode
3879 Enforce rebuilding of several internal lists and variables. Also
3880 removes the parse file associated with the current document.
3881 @end deffn
3882
3883 @node Options
3884 @chapter Options, Keymaps, Hooks
3885 @cindex Options, list of
3886
3887 Here is a complete list of @RefTeX{}'s configuration variables. All
3888 variables have customize support, so if you are not familiar with Emacs
3889 Lisp (and even if you are) you might find it more comfortable to use
3890 @code{customize} to look at and change these variables. @kbd{M-x
3891 reftex-customize} will get you there.
3892
3893 @menu
3894 * Options - Table of Contents::
3895 * Options - Defining Label Environments::
3896 * Options - Creating Labels::
3897 * Options - Referencing Labels::
3898 * Options - Creating Citations::
3899 * Options - Index Support::
3900 * Options - Viewing Cross-References::
3901 * Options - Finding Files::
3902 * Options - Optimizations::
3903 * Options - Fontification::
3904 * Options - Misc::
3905 * Keymaps and Hooks::
3906 @end menu
3907
3908 @node Options - Table of Contents
3909 @section Table of Contents
3910 @cindex Options, table of contents
3911 @cindex Table of contents, options
3912
3913 @defopt reftex-include-file-commands
3914 List of @LaTeX{} commands which input another file.
3915 The file name is expected after the command, either in braces or separated
3916 by whitespace.
3917 @end defopt
3918
3919 @defopt reftex-max-section-depth
3920 Maximum depth of section levels in document structure.
3921 Standard @LaTeX{} needs 7, default is 12.
3922 @end defopt
3923
3924 @defopt reftex-section-levels
3925 Commands and levels used for defining sections in the document. The
3926 @code{car} of each cons cell is the name of the section macro. The
3927 @code{cdr} is a number indicating its level. A negative level means the
3928 same as the positive value, but the section will never get a number.
3929 The @code{cdr} may also be a function which then has to return the
3930 level. This list is also used for promotion and demotion of sectioning
3931 commands. If you are using a document class which has several sets of
3932 sectioning commands, promotion only works correctly if this list is
3933 sorted first by set, then within each set by level. The promotion
3934 commands always select the nearest entry with the correct new level.
3935
3936 @end defopt
3937
3938 @defopt reftex-toc-max-level
3939 The maximum level of toc entries which will be included in the TOC@.
3940 Section headings with a bigger level will be ignored. In RefTeX,
3941 chapters are level 1, sections level 2 etc. This variable can be
3942 changed from within the @file{*toc*} buffer with the @kbd{t} key.
3943 @end defopt
3944
3945 @defopt reftex-part-resets-chapter
3946 Non-@code{nil} means, @code{\part} is like any other sectioning command.
3947 This means, part numbers will be included in the numbering of chapters, and
3948 chapter counters will be reset for each part.
3949 When @code{nil} (the default), parts are special, do not reset the
3950 chapter counter and also do not show up in chapter numbers.
3951 @end defopt
3952
3953 @defopt reftex-auto-recenter-toc
3954 Non-@code{nil} means, turn automatic recentering of @file{*TOC*} window on.
3955 When active, the @file{*TOC*} window will always show the section you
3956 are currently working in. Recentering happens whenever Emacs is idle for
3957 more than @code{reftex-idle-time} seconds.
3958
3959 Value @code{t} means, turn on immediately when RefTeX gets started. Then,
3960 recentering will work for any toc window created during the session.
3961
3962 Value @code{frame} (the default) means, turn automatic recentering on
3963 only while the dedicated TOC frame does exist, and do the recentering
3964 only in that frame. So when creating that frame (with @kbd{d} key in an
3965 ordinary TOC window), the automatic recentering is turned on. When the
3966 frame gets destroyed, automatic recentering is turned off again.
3967
3968 This feature can be turned on and off from the menu
3969 (Ref->Options).
3970 @end defopt
3971
3972 @defopt reftex-toc-split-windows-horizontally
3973 Non-@code{nil} means, create TOC window by splitting window
3974 horizontally. The default is to split vertically.
3975 @end defopt
3976
3977 @defopt reftex-toc-split-windows-fraction
3978 Fraction of the width or height of the frame to be used for TOC window.
3979 @end defopt
3980
3981 @defopt reftex-toc-keep-other-windows
3982 Non-@code{nil} means, split the selected window to display the
3983 @file{*toc*} buffer. This helps to keep the window configuration, but
3984 makes the @file{*toc*} small. When @code{nil}, all other windows except
3985 the selected one will be deleted, so that the @file{*toc*} window fills
3986 half the frame.
3987 @end defopt
3988
3989 @defopt reftex-toc-include-file-boundaries
3990 Non-@code{nil} means, include file boundaries in @file{*toc*} buffer.
3991 This flag can be toggled from within the @file{*toc*} buffer with the
3992 @kbd{i} key.
3993 @end defopt
3994
3995 @defopt reftex-toc-include-labels
3996 Non-@code{nil} means, include labels in @file{*toc*} buffer. This flag
3997 can be toggled from within the @file{*toc*} buffer with the @kbd{l}
3998 key.
3999 @end defopt
4000
4001 @defopt reftex-toc-include-index-entries
4002 Non-@code{nil} means, include index entries in @file{*toc*} buffer.
4003 This flag can be toggled from within the @file{*toc*} buffer with the
4004 @kbd{i} key.
4005 @end defopt
4006
4007 @defopt reftex-toc-include-context
4008 Non-@code{nil} means, include context with labels in the @file{*toc*}
4009 buffer. Context will only be shown if the labels are visible as well.
4010 This flag can be toggled from within the @file{*toc*} buffer with the
4011 @kbd{c} key.
4012 @end defopt
4013
4014 @defopt reftex-toc-follow-mode
4015 Non-@code{nil} means, point in @file{*toc*} buffer (the
4016 table-of-contents buffer) will cause other window to follow. The other
4017 window will show the corresponding part of the document. This flag can
4018 be toggled from within the @file{*toc*} buffer with the @kbd{f}
4019 key.
4020 @end defopt
4021
4022 @deffn {Normal Hook} reftex-toc-mode-hook
4023 Normal hook which is run when a @file{*toc*} buffer is
4024 created.
4025 @end deffn
4026
4027 @deffn Keymap reftex-toc-map
4028 The keymap which is active in the @file{*toc*} buffer.
4029 (@pxref{Table of Contents}).
4030 @end deffn
4031
4032 @node Options - Defining Label Environments
4033 @section Defining Label Environments
4034 @cindex Options, defining label environments
4035 @cindex Defining label environments, options
4036
4037 @defopt reftex-default-label-alist-entries
4038 Default label alist specifications. It is a list of symbols with
4039 associations in the constant @code{reftex-label-alist-builtin}.
4040 @code{LaTeX} should always be the last entry.
4041 @end defopt
4042
4043 @defopt reftex-label-alist
4044 Set this variable to define additions and changes to the defaults in
4045 @code{reftex-default-label-alist-entries}. The only things you
4046 @emph{must not} change is that @code{?s} is the type indicator for
4047 section labels, and @key{SPC} for the @code{any} label type. These are
4048 hard-coded at other places in the code.
4049
4050 The value of the variable must be a list of items. Each item is a list
4051 itself and has the following structure:
4052
4053 @example
4054 (@var{env-or-macro} @var{type-key} @var{label-prefix} @var{reference-format}
4055 @var{context-method} (@var{magic-word} ... ) @var{toc-level})
4056 @end example
4057
4058 Each list entry describes either an environment carrying a counter for
4059 use with @code{\label} and @code{\ref}, or a @LaTeX{} macro defining a
4060 label as (or inside) one of its arguments. The elements of each list
4061 entry are:
4062
4063 @table @asis
4064 @item @var{env-or-macro}
4065 Name of the environment (like @samp{table}) or macro (like
4066 @samp{\myfig}). For macros, indicate the arguments, as in
4067 @samp{\myfig[]@{@}@{@}@{*@}@{@}}. Use square brackets for optional
4068 arguments, a star to mark the label argument, if any. The macro does
4069 not have to have a label argument; you could also use
4070 @samp{\label@{...@}} inside one of its arguments.
4071
4072 Special names: @code{section} for section labels, @code{any} to define a
4073 group which contains all labels.
4074
4075 This may also be a function to do local parsing and identify point to be
4076 in a non-standard label environment. The function must take an
4077 argument @var{bound} and limit backward searches to this value. It
4078 should return either nil or a cons cell @code{(@var{function}
4079 . @var{position})} with the function symbol and the position where the
4080 special environment starts. See the Info documentation for an
4081 example.
4082
4083 Finally this may also be @code{nil} if the entry is only meant to change
4084 some settings associated with the type indicator character (see
4085 below).
4086
4087 @item @var{type-key}
4088 Type indicator character, like @code{?t}, must be a printable ASCII
4089 character. The type indicator is a single character which defines a
4090 label type. Any label inside the environment or macro is assumed to
4091 belong to this type. The same character may occur several times in this
4092 list, to cover cases in which different environments carry the same
4093 label type (like @code{equation} and @code{eqnarray}). If the type
4094 indicator is @code{nil} and the macro has a label argument @samp{@{*@}},
4095 the macro defines neutral labels just like @code{\label}. In this case
4096 the remainder of this entry is ignored.
4097
4098 @item @var{label-prefix}
4099 Label prefix string, like @samp{tab:}. The prefix is a short string
4100 used as the start of a label. It may be the empty string. The prefix
4101 may contain the following @samp{%} escapes:
4102
4103 @example
4104 %f Current file name, directory and extension stripped.
4105 %F Current file name relative to master file directory.
4106 %m Master file name, directory and extension stripped.
4107 %M Directory name (without path) where master file is located.
4108 %u User login name, on systems which support this.
4109 %S A section prefix derived with variable @code{reftex-section-prefixes}.
4110 @end example
4111
4112 @noindent
4113 Example: In a file @file{intro.tex}, @samp{eq:%f:} will become
4114 @samp{eq:intro:}.
4115
4116 @item @var{reference-format}
4117 Format string for reference insertion in buffer. @samp{%s} will be
4118 replaced by the label. When the format starts with @samp{~}, this
4119 @samp{~} will only be inserted when the character before point is
4120 @emph{not} a whitespace.
4121
4122 @item @var{context-method}
4123 Indication on how to find the short context.
4124 @itemize @minus
4125 @item
4126 If @code{nil}, use the text following the @samp{\label@{...@}} macro.
4127 @item
4128 If @code{t}, use
4129 @itemize @minus
4130 @item
4131 the section heading for section labels.
4132 @item
4133 text following the @samp{\begin@{...@}} statement of environments (not
4134 a good choice for environments like eqnarray or enumerate, where one has
4135 several labels in a single environment).
4136 @item
4137 text after the macro name (starting with the first arg) for
4138 macros.
4139 @end itemize
4140 @item
4141 If an integer, use the nth argument of the macro. As a special case,
4142 1000 means to get text after the last macro argument.
4143 @item
4144 If a string, use as regexp to search @emph{backward} from the label.
4145 Context is then the text following the end of the match. E.g., setting
4146 this to @samp{\\caption[[@{]} will use the caption in a figure or table
4147 environment. @samp{\\begin@{eqnarray@}\|\\\\} works for
4148 eqnarrays.
4149 @item
4150 If any of @code{caption}, @code{item}, @code{eqnarray-like},
4151 @code{alignat-like}, this symbol will internally be translated into an
4152 appropriate regexp (see also the variable
4153 @code{reftex-default-context-regexps}).
4154 @item
4155 If a function, call this function with the name of the environment/macro
4156 as argument. On call, point will be just after the @code{\label} macro.
4157 The function is expected to return a suitable context string. It should
4158 throw an exception (error) when failing to find context. As an example,
4159 here is a function returning the 10 chars following the label macro as
4160 context:
4161
4162 @example
4163 (defun my-context-function (env-or-mac)
4164 (if (> (point-max) (+ 10 (point)))
4165 (buffer-substring (point) (+ 10 (point)))
4166 (error "Buffer too small")))
4167 @end example
4168 @end itemize
4169
4170 Label context is used in two ways by @RefTeX{}: For display in the label
4171 menu, and to derive a label string. If you want to use a different
4172 method for each of these, specify them as a dotted pair.
4173 E.g., @code{(nil . t)} uses the text after the label (@code{nil}) for
4174 display, and text from the default position (@code{t}) to derive a label
4175 string. This is actually used for section labels.
4176
4177 @item @var{magic-word-list}
4178 List of magic words which identify a reference to be of this type. If
4179 the word before point is equal to one of these words when calling
4180 @code{reftex-reference}, the label list offered will be automatically
4181 restricted to labels of the correct type. If the first element of this
4182 word list is the symbol `regexp', the strings are interpreted as regular
4183 expressions.
4184
4185 @item @var{toc-level}
4186 The integer level at which this environment should be added to the table
4187 of contents. See also @code{reftex-section-levels}. A positive value
4188 will number the entries mixed with the sectioning commands of the same
4189 level. A negative value will make unnumbered entries. Useful only for
4190 theorem-like environments which structure the document. Will be ignored
4191 for macros. When omitted or @code{nil}, no TOC entries will be
4192 made.
4193 @end table
4194
4195 If the type indicator characters of two or more entries are the same,
4196 @RefTeX{} will use
4197 @itemize @minus
4198 @item
4199 the first non-@code{nil} format and prefix
4200 @item
4201 the magic words of all involved entries.
4202 @end itemize
4203
4204 Any list entry may also be a symbol. If that has an association in
4205 @code{reftex-label-alist-builtin}, the @code{cddr} of that association is
4206 spliced into the list. However, builtin defaults should normally be set
4207 with the variable @code{reftex-default-label-alist-entries}.
4208 @end defopt
4209
4210 @defopt reftex-section-prefixes
4211 Prefixes for section labels. When the label prefix given in an entry in
4212 @code{reftex-label-alist} contains @samp{%S}, this list is used to
4213 determine the correct prefix string depending on the current section
4214 level. The list is an alist, with each entry of the form
4215 @w{@code{(@var{key} . @var{prefix})}}. Possible keys are sectioning macro
4216 names like @samp{chapter}, integer section levels (as given in
4217 @code{reftex-section-levels}), and @code{t} for the default.
4218 @end defopt
4219
4220 @defopt reftex-default-context-regexps
4221 Alist with default regular expressions for finding context. The emacs
4222 lisp form @w{@code{(format regexp (regexp-quote environment))}} is used
4223 to calculate the final regular expression, so @samp{%s} will be
4224 replaced with the environment or macro.
4225 @end defopt
4226
4227 @defopt reftex-trust-label-prefix
4228 Non-@code{nil} means, trust the label prefix when determining label type.
4229 It is customary to use special label prefixes to distinguish different label
4230 types. The label prefixes have no syntactic meaning in @LaTeX{} (unless
4231 special packages like fancyref) are being used. RefTeX can and by
4232 default does parse around each label to detect the correct label type,
4233 but this process can be slow when a document contains thousands of
4234 labels. If you use label prefixes consistently, you may speed up
4235 document parsing by setting this variable to a non-nil value. RefTeX
4236 will then compare the label prefix with the prefixes found in
4237 `reftex-label-alist' and derive the correct label type in this way.
4238 Possible values for this option are:
4239
4240 @example
4241 t @r{This means to trust any label prefixes found.}
4242 regexp @r{If a regexp, only prefixes matched by the regexp are trusted.}
4243 list @r{List of accepted prefixes, as strings. The colon is part of}
4244 @r{the prefix, e.g., ("fn:" "eqn:" "item:").}
4245 nil @r{Never trust a label prefix.}
4246 @end example
4247 The only disadvantage of using this feature is that the label context
4248 displayed in the label selection buffer along with each label is
4249 simply some text after the label definition. This is no problem if you
4250 place labels keeping this in mind (e.g., @i{before} the equation, @i{at
4251 the beginning} of a fig/tab caption ...). Anyway, it is probably best
4252 to use the regexp or the list value types to fine-tune this feature.
4253 For example, if your document contains thousands of footnotes with
4254 labels fn:xxx, you may want to set this variable to the value "^fn:$" or
4255 ("fn:"). Then RefTeX will still do extensive parsing for any
4256 non-footnote labels.
4257 @end defopt
4258
4259 @node Options - Creating Labels
4260 @section Creating Labels
4261 @cindex Options, creating labels
4262 @cindex Creating labels, options
4263
4264 @defopt reftex-insert-label-flags
4265 Flags governing label insertion. The value has the form
4266
4267 @example
4268 (@var{derive} @var{prompt})
4269 @end example
4270
4271 If @var{derive} is @code{t}, @RefTeX{} will try to derive a sensible
4272 label from context. A section label for example will be derived from
4273 the section heading. The conversion of the context to a valid label is
4274 governed by the specifications given in
4275 @code{reftex-derive-label-parameters}. If @var{derive} is @code{nil},
4276 the default label will consist of the prefix and a unique number, like
4277 @samp{eq:23}.
4278
4279 If @var{prompt} is @code{t}, the user will be prompted for a label
4280 string. When @var{prompt} is @code{nil}, the default label will be
4281 inserted without query.
4282
4283 So the combination of @var{derive} and @var{prompt} controls label
4284 insertion. Here is a table describing all four possibilities:
4285
4286 @example
4287 @group
4288 @var{derive} @var{prompt} @var{action}
4289 -----------------------------------------------------------
4290 nil nil @r{Insert simple label, like @samp{eq:22} or @samp{sec:13}. No query.}
4291 nil t @r{Prompt for label.}
4292 t nil @r{Derive a label from context and insert. No query.}
4293 t t @r{Derive a label from context, prompt for confirmation.}
4294 @end group
4295 @end example
4296
4297 Each flag may be set to @code{t}, @code{nil}, or a string of label type
4298 letters indicating the label types for which it should be true. Thus,
4299 the combination may be set differently for each label type. The default
4300 settings @samp{"s"} and @samp{"sft"} mean: Derive section labels from
4301 headings (with confirmation). Prompt for figure and table labels. Use
4302 simple labels without confirmation for everything else.
4303
4304 The available label types are: @code{s} (section), @code{f} (figure),
4305 @code{t} (table), @code{i} (item), @code{e} (equation), @code{n}
4306 (footnote), @code{N} (endnote) plus any definitions in
4307 @code{reftex-label-alist}.
4308 @end defopt
4309
4310 @deffn Hook reftex-format-label-function
4311 If non-@code{nil}, should be a function which produces the string to
4312 insert as a label definition. The function will be called with two
4313 arguments, the @var{label} and the @var{default-format} (usually
4314 @samp{\label@{%s@}}). It should return the string to insert into the
4315 buffer.
4316 @end deffn
4317
4318 @deffn Hook reftex-string-to-label-function
4319 Function to turn an arbitrary string into a valid label.
4320 @RefTeX{}'s default function uses the variable
4321 @code{reftex-derive-label-parameters}.
4322 @end deffn
4323
4324 @deffn Hook reftex-translate-to-ascii-function
4325 Filter function which will process a context string before it is used to
4326 derive a label from it. The intended application is to convert ISO or
4327 Mule characters into something valid in labels. The default function
4328 @code{reftex-latin1-to-ascii} removes the accents from Latin-1
4329 characters. X-Symbol (>=2.6) sets this variable to the much more
4330 general @code{x-symbol-translate-to-ascii}.
4331 @end deffn
4332
4333 @defopt reftex-derive-label-parameters
4334 Parameters for converting a string into a label. This variable is a
4335 list of the following items:
4336 @table @asis
4337 @item @var{nwords}
4338 Number of words to use.
4339 @item @var{maxchar}
4340 Maximum number of characters in a label string.
4341 @item @var{invalid}
4342 @code{nil}: Throw away any words containing characters invalid in labels.@*
4343 @code{t}: Throw away only the invalid characters, not the whole word.
4344 @item @var{abbrev}
4345 @code{nil}: Never abbreviate words.@*
4346 @code{t}: Always abbreviate words (see @code{reftex-abbrev-parameters}).@*
4347 @code{1}: Abbreviate words if necessary to shorten label string.
4348 @item @var{separator}
4349 String separating different words in the label.
4350 @item @var{ignorewords}
4351 List of words which should not be part of labels.
4352 @item @var{downcase}
4353 @code{t}: Downcase words before putting them into the label.@*
4354 @end table
4355 @end defopt
4356
4357 @defopt reftex-label-illegal-re
4358 Regexp matching characters not valid in labels.
4359 @end defopt
4360
4361 @defopt reftex-abbrev-parameters
4362 Parameters for abbreviation of words. A list of four parameters.
4363 @table @asis
4364 @item @var{min-chars}
4365 Minimum number of characters remaining after abbreviation.
4366 @item @var{min-kill}
4367 Minimum number of characters to remove when abbreviating words.
4368 @item @var{before}
4369 Character class before abbrev point in word.
4370 @item @var{after}
4371 Character class after abbrev point in word.
4372 @end table
4373 @end defopt
4374
4375 @node Options - Referencing Labels
4376 @section Referencing Labels
4377 @cindex Options, referencing labels
4378 @cindex Referencing labels, options
4379
4380 @defopt reftex-label-menu-flags
4381 List of flags governing the label menu makeup. The flags are:
4382 @table @asis
4383 @item @var{table-of-contents}
4384 Show the labels embedded in a table of context.
4385 @item @var{section-numbers}
4386 Include section numbers (like 4.1.3) in table of contents.
4387 @item @var{counters}
4388 Show counters. This just numbers the labels in the menu.
4389 @item @var{no-context}
4390 Non-@code{nil} means do @emph{not} show the short context.
4391 @item @var{follow}
4392 Follow full context in other window.
4393 @item @var{show-commented}
4394 Show labels from regions which are commented out.
4395 @item @var{match-everywhere}
4396 Obsolete flag.
4397 @item @var{show-files}
4398 Show begin and end of included files.
4399 @end table
4400
4401 Each of these flags can be set to @code{t} or @code{nil}, or to a string
4402 of type letters indicating the label types for which it should be true.
4403 These strings work like character classes in regular expressions. Thus,
4404 setting one of the flags to @samp{"sf"} makes the flag true for section
4405 and figure labels, @code{nil} for everything else. Setting it to
4406 @samp{"^sf"} makes it the other way round.
4407
4408 The available label types are: @code{s} (section), @code{f} (figure),
4409 @code{t} (table), @code{i} (item), @code{e} (equation), @code{n}
4410 (footnote), plus any definitions in @code{reftex-label-alist}.
4411
4412 Most options can also be switched from the label menu itself, so if you
4413 decide here to not have a table of contents in the label menu, you can
4414 still get one interactively during selection from the label menu.
4415 @end defopt
4416
4417 @defopt reftex-multiref-punctuation
4418 Punctuation strings for multiple references. When marking is used in
4419 the selection buffer to select several references, this variable
4420 associates the 3 marking characters @samp{,-+} with prefix strings to be
4421 inserted into the buffer before the corresponding @code{\ref} macro.
4422 This is used to string together whole reference sets, like
4423 @samp{eqs. 1,2,3-5,6 and 7} in a single call to
4424 @code{reftex-reference}.
4425 @end defopt
4426
4427 @defopt reftex-ref-style-alist
4428 Alist of reference styles. Each element is a list of the style name,
4429 the name of the @LaTeX{} package associated with the style or @code{t}
4430 for any package, and an alist of macros where the first entry of each
4431 item is the reference macro and the second a key for selecting the macro
4432 when the macro type is being prompted for. (See also
4433 @code{reftex-ref-macro-prompt}.) The keys, represented as characters,
4434 have to be unique.
4435 @end defopt
4436
4437 @defopt reftex-ref-style-default-list
4438 List of reference styles to be activated by default. The order is
4439 significant and controls the order in which macros can be cycled in the
4440 buffer for selecting a label. The entries in the list have to match the
4441 respective reference style names used in the variable
4442 @code{reftex-ref-style-alist}.
4443 @end defopt
4444
4445 @defopt reftex-ref-macro-prompt
4446 Controls if @code{reftex-reference} prompts for the reference macro.
4447 @end defopt
4448
4449 @deffn Hook reftex-format-ref-function
4450 If non-@code{nil}, should be a function which produces the string to
4451 insert as a reference. Note that the insertion format can also be
4452 changed with @code{reftex-label-alist}. This hook also is used by the
4453 special commands to insert, e.g., @code{\vref} and @code{\fref}
4454 references, so even if you set this, your setting will be ignored by the
4455 special commands. The function will be called with three arguments, the
4456 @var{label}, the @var{default format} which normally is
4457 @samp{~\ref@{%s@}} and the @var{reference style}. The function should
4458 return the string to insert into the buffer.
4459 @end deffn
4460
4461 @defopt reftex-level-indent
4462 Number of spaces to be used for indentation per section level.
4463 @end defopt
4464
4465 @defopt reftex-guess-label-type
4466 Non-@code{nil} means, @code{reftex-reference} will try to guess the
4467 label type. To do that, @RefTeX{} will look at the word before the
4468 cursor and compare it with the magic words given in
4469 @code{reftex-label-alist}. When it finds a match, @RefTeX{} will
4470 immediately offer the correct label menu; otherwise it will prompt you
4471 for a label type. If you set this variable to @code{nil}, @RefTeX{}
4472 will always prompt for a label type.
4473 @end defopt
4474
4475 @deffn {Normal Hook} reftex-display-copied-context-hook
4476 Normal Hook which is run before context is displayed anywhere. Designed
4477 for @w{@code{X-Symbol}}, but may have other uses as well.
4478 @end deffn
4479
4480 @deffn Hook reftex-pre-refontification-functions
4481 @code{X-Symbol} specific hook. Probably not useful for other purposes.
4482 The functions get two arguments, the buffer from where the command
4483 started and a symbol indicating in what context the hook is
4484 called.
4485 @end deffn
4486
4487 @deffn {Normal Hook} reftex-select-label-mode-hook
4488 Normal hook which is run when a selection buffer enters
4489 @code{reftex-select-label-mode}.
4490 @end deffn
4491
4492 @deffn Keymap reftex-select-label-map
4493 The keymap which is active in the labels selection process
4494 (@pxref{Referencing Labels}).
4495 @end deffn
4496
4497 @node Options - Creating Citations
4498 @section Creating Citations
4499 @cindex Options, creating citations
4500 @cindex Creating citations, options
4501
4502 @defopt reftex-bibliography-commands
4503 @LaTeX{} commands which specify the @BibTeX{} databases to use with the document.
4504 @end defopt
4505
4506 @defopt reftex-bibfile-ignore-regexps
4507 List of regular expressions to exclude files in
4508 @code{\\bibliography@{..@}}. File names matched by any of these regexps
4509 will not be parsed. Intended for files which contain only
4510 @code{@@string} macro definitions and the like, which are ignored by
4511 @RefTeX{} anyway.
4512 @end defopt
4513
4514 @defopt reftex-default-bibliography
4515 List of @BibTeX{} database files which should be used if none are specified.
4516 When @code{reftex-citation} is called from a document with neither
4517 a @samp{\bibliography@{...@}} statement nor a @code{thebibliography}
4518 environment, @RefTeX{} will scan these files instead. Intended for
4519 using @code{reftex-citation} in non-@LaTeX{} files. The files will be
4520 searched along the BIBINPUTS or TEXBIB path.
4521 @end defopt
4522
4523 @defopt reftex-sort-bibtex-matches
4524 Sorting of the entries found in @BibTeX{} databases by reftex-citation.
4525 Possible values:
4526 @example
4527 nil @r{Do not sort entries.}
4528 author @r{Sort entries by author name.}
4529 year @r{Sort entries by increasing year.}
4530 reverse-year @r{Sort entries by decreasing year.}
4531 @end example
4532 @end defopt
4533
4534 @defopt reftex-cite-format
4535 The format of citations to be inserted into the buffer. It can be a
4536 string, an alist or a symbol. In the simplest case this is just the string
4537 @samp{\cite@{%l@}}, which is also the default. See the definition of
4538 @code{reftex-cite-format-builtin} for more complex examples.
4539
4540 If @code{reftex-cite-format} is a string, it will be used as the format.
4541 In the format, the following percent escapes will be expanded.
4542
4543 @table @code
4544 @item %l
4545 The @BibTeX{} label of the citation.
4546 @item %a
4547 List of author names, see also @code{reftex-cite-punctuation}.
4548 @item %2a
4549 Like %a, but abbreviate more than 2 authors like Jones et al.
4550 @item %A
4551 First author name only.
4552 @item %e
4553 Works like @samp{%a}, but on list of editor names. (@samp{%2e} and
4554 @samp{%E} work a well).
4555 @end table
4556
4557 It is also possible to access all other @BibTeX{} database fields:
4558
4559 @example
4560 %b booktitle %c chapter %d edition %h howpublished
4561 %i institution %j journal %k key %m month
4562 %n number %o organization %p pages %P first page
4563 %r address %s school %u publisher %t title
4564 %v volume %y year
4565 %B booktitle, abbreviated %T title, abbreviated
4566 @end example
4567
4568 @noindent
4569 Usually, only @samp{%l} is needed. The other stuff is mainly for the
4570 echo area display, and for @code{(setq reftex-comment-citations t)}.
4571
4572 @samp{%<} as a special operator kills punctuation and space around it
4573 after the string has been formatted.
4574
4575 A pair of square brackets indicates an optional argument, and RefTeX
4576 will prompt for the values of these arguments.
4577
4578 Beware that all this only works with @BibTeX{} database files. When
4579 citations are made from the @code{\bibitems} in an explicit
4580 @code{thebibliography} environment, only @samp{%l} is available.
4581
4582 If @code{reftex-cite-format} is an alist of characters and strings, the
4583 user will be prompted for a character to select one of the possible
4584 format strings.
4585
4586 In order to configure this variable, you can either set
4587 @code{reftex-cite-format} directly yourself or set it to the
4588 @emph{symbol} of one of the predefined styles. The predefined symbols
4589 are those which have an association in the constant
4590 @code{reftex-cite-format-builtin}) E.g.: @code{(setq reftex-cite-format
4591 'natbib)}.
4592 @end defopt
4593
4594 @deffn Hook reftex-format-cite-function
4595 If non-@code{nil}, should be a function which produces the string to
4596 insert as a citation. Note that the citation format can also be changed
4597 with the variable @code{reftex-cite-format}. The function will be
4598 called with two arguments, the @var{citation-key} and the
4599 @var{default-format} (taken from @code{reftex-cite-format}). It should
4600 return the string to insert into the buffer.
4601 @end deffn
4602
4603 @defopt reftex-cite-prompt-optional-args
4604 Non-@code{nil} means, prompt for empty optional arguments in cite macros.
4605 When an entry in @code{reftex-cite-format} ist given with square brackets to
4606 indicate optional arguments (for example @samp{\\cite[][]@{%l@}}), RefTeX can
4607 prompt for values. Possible values are:
4608 @example
4609 nil @r{Never prompt for optional arguments}
4610 t @r{Always prompt}
4611 maybe @r{Prompt only if @code{reftex-citation} was called with C-u prefix arg}
4612 @end example
4613 Unnecessary empty optional arguments are removed before insertion into
4614 the buffer. See @code{reftex-cite-cleanup-optional-args}.
4615 @end defopt
4616
4617 @defopt reftex-cite-cleanup-optional-args
4618 Non-@code{nil} means, remove empty optional arguments from cite macros
4619 if possible.
4620 @end defopt
4621
4622 @defopt reftex-comment-citations
4623 Non-@code{nil} means add a comment for each citation describing the full
4624 entry. The comment is formatted according to
4625 @code{reftex-cite-comment-format}.
4626 @end defopt
4627
4628 @defopt reftex-cite-comment-format
4629 Citation format used for commented citations. Must @emph{not} contain
4630 @samp{%l}. See the variable @code{reftex-cite-format} for possible
4631 percent escapes.
4632 @end defopt
4633
4634 @defopt reftex-cite-punctuation
4635 Punctuation for formatting of name lists in citations. This is a list
4636 of 3 strings.
4637 @enumerate
4638 @item
4639 normal names separator, like @samp{, } in Jones, Brown and Miller
4640 @item
4641 final names separator, like @samp{ and } in Jones, Brown and Miller
4642 @item
4643 The @samp{et al.} string, like @samp{ @{\it et al.@}} in
4644 Jones @{\it et al.@}
4645 @end enumerate
4646 @end defopt
4647
4648 @deffn {Normal Hook} reftex-select-bib-mode-hook
4649 Normal hook which is run when a selection buffer enters
4650 @code{reftex-select-bib-mode}.
4651 @end deffn
4652
4653 @deffn Keymap reftex-select-bib-map
4654 The keymap which is active in the citation-key selection process
4655 (@pxref{Creating Citations}).
4656 @end deffn
4657
4658 @defopt reftex-cite-key-separator
4659 String used to separate several keys in a single @samp{\\cite} macro.
4660 Per default this is @samp{","} but if you often have to deal with a lot
4661 of entries and need to break the macro across several lines you might
4662 want to change it to @samp{", "}.
4663 @end defopt
4664
4665 @defopt reftex-create-bibtex-header
4666 Header to insert in BibTeX files generated by
4667 @code{reftex-create-bibtex-file}.
4668 @end defopt
4669
4670 @defopt reftex-create-bibtex-footer
4671 Footer to insert in BibTeX files generated by
4672 @code{reftex-create-bibtex-file}.
4673 @end defopt
4674
4675
4676 @node Options - Index Support, Options - Viewing Cross-References, Options - Creating Citations, Options
4677 @section Index Support
4678 @cindex Options, Index support
4679 @cindex Index support, options
4680
4681 @defopt reftex-support-index
4682 Non-@code{nil} means, index entries are parsed as well. Index support
4683 is resource intensive and the internal structure holding the parsed
4684 information can become quite big. Therefore it can be turned off. When
4685 this is @code{nil} and you execute a command which requires index
4686 support, you will be asked for confirmation to turn it on and rescan the
4687 document.
4688 @end defopt
4689
4690 @defopt reftex-index-special-chars
4691 List of special characters in index entries, given as strings. These
4692 correspond to the @code{MakeIndex} keywords
4693 @code{(@var{level} @var{encap} @var{actual} @var{quote} @var{escape})}.
4694 @end defopt
4695
4696 @defopt reftex-index-macros
4697 List of macros which define index entries. The structure of each entry
4698 is
4699 @lisp
4700 (@var{macro} @var{index-tag} @var{key} @var{prefix} @var{exclude} @var{repeat})
4701 @end lisp
4702
4703 @var{macro} is the macro. Arguments should be denoted by empty braces,
4704 as for example in @samp{\index[]@{*@}}. Use square brackets to denote
4705 optional arguments. The star marks where the index key is.
4706
4707 @var{index-tag} is a short name of the index. @samp{idx} and @samp{glo}
4708 are reserved for the default index and the glossary. Other indices can
4709 be defined as well. If this is an integer, the Nth argument of the
4710 macro holds the index tag.
4711
4712 @var{key} is a character which is used to identify the macro for input
4713 with @code{reftex-index}. @samp{?i}, @samp{?I}, and @samp{?g} are
4714 reserved for default index and glossary.
4715
4716 @var{prefix} can be a prefix which is added to the @var{key} part of the
4717 index entry. If you have a macro
4718 @code{\newcommand@{\molec@}[1]@{#1\index@{Molecules!#1@}}, this prefix
4719 should be @samp{Molecules!}.
4720
4721 @var{exclude} can be a function. If this function exists and returns a
4722 non-@code{nil} value, the index entry at point is ignored. This was
4723 implemented to support the (deprecated) @samp{^} and @samp{_} shortcuts
4724 in the @LaTeX{}2e @code{index} package.
4725
4726 @var{repeat}, if non-@code{nil}, means the index macro does not typeset
4727 the entry in the text, so that the text has to be repeated outside the
4728 index macro. Needed for @code{reftex-index-selection-or-word} and for
4729 indexing from the phrase buffer.
4730
4731 The final entry may also be a symbol. It must have an association in
4732 the variable @code{reftex-index-macros-builtin} to specify the main
4733 indexing package you are using. Valid values are currently
4734 @example
4735 default @r{The @LaTeX{} default; unnecessary to specify this one}
4736 multind @r{The multind.sty package}
4737 index @r{The index.sty package}
4738 index-shortcut @r{The index.sty packages with the ^ and _ shortcuts.}
4739 @r{Should not be used; only for old documents}
4740 @end example
4741 Note that @AUCTeX{} sets these things internally for @RefTeX{} as well,
4742 so with a sufficiently new version of @AUCTeX{}, you should not set the
4743 package here.
4744 @end defopt
4745
4746 @defopt reftex-index-default-macro
4747 The default index macro for @code{reftex-index-selection-or-word}.
4748 This is a list with @code{(@var{macro-key} @var{default-tag})}.
4749
4750 @var{macro-key} is a character identifying an index macro; see
4751 @code{reftex-index-macros}.
4752
4753 @var{default-tag} is the tag to be used if the macro requires a
4754 @var{tag} argument. When this is @code{nil} and a @var{tag} is needed,
4755 @RefTeX{} will ask for it. When this is the empty string and the
4756 TAG argument of the index macro is optional, the TAG argument will be
4757 omitted.
4758 @end defopt
4759
4760 @defopt reftex-index-default-tag
4761 Default index tag. When working with multiple indexes, RefTeX queries
4762 for an index tag when creating index entries or displaying a specific
4763 index. This variable controls the default offered for these queries.
4764 The default can be selected with @key{RET} during selection or
4765 completion. Valid values of this variable are:
4766 @example
4767 nil @r{Do not provide a default index}
4768 "tag" @r{The default index tag given as a string, e.g., "idx"}
4769 last @r{The last used index tag will be offered as default}
4770 @end example
4771 @end defopt
4772
4773 @defopt reftex-index-math-format
4774 Format of index entries when copied from inside math mode. When
4775 @code{reftex-index-selection-or-word} is executed inside @TeX{} math mode,
4776 the index key copied from the buffer is processed with this format
4777 string through the @code{format} function. This can be used to add the
4778 math delimiters (e.g., @samp{$}) to the string. Requires the
4779 @file{texmathp.el} library which is part of @AUCTeX{}.
4780 @end defopt
4781
4782 @defopt reftex-index-phrase-file-extension
4783 File extension for the index phrase file. This extension will be added
4784 to the base name of the master file.
4785 @end defopt
4786
4787 @defopt reftex-index-phrases-logical-and-regexp
4788 Regexp matching the @samp{and} operator for index arguments in phrases
4789 file. When several index arguments in a phrase line are separated by
4790 this operator, each part will generate an index macro. So each match of
4791 the search phrase will produce @emph{several} different index entries.
4792 Make sure this does no match things which are not separators. This
4793 logical @samp{and} has higher priority than the logical @samp{or}
4794 specified in @code{reftex-index-phrases-logical-or-regexp}.
4795 @end defopt
4796
4797 @defopt reftex-index-phrases-logical-or-regexp
4798 Regexp matching the @samp{or} operator for index arguments in phrases
4799 file. When several index arguments in a phrase line are separated by
4800 this operator, the user will be asked to select one of them at each
4801 match of the search phrase. The first index arg will be the default. A
4802 number key @kbd{1}--@kbd{9} must be pressed to switch to another. Make
4803 sure this does no match things which are not separators. The logical
4804 @samp{and} specified in @code{reftex-index-phrases-logical-or-regexp}
4805 has higher priority than this logical @samp{or}.
4806 @end defopt
4807
4808 @defopt reftex-index-phrases-search-whole-words
4809 Non-@code{nil} means phrases search will look for whole words, not subwords.
4810 This works by requiring word boundaries at the beginning and end of
4811 the search string. When the search phrase already has a non-word-char
4812 at one of these points, no word boundary is required there.
4813 @end defopt
4814
4815 @defopt reftex-index-phrases-case-fold-search
4816 Non-@code{nil} means, searching for index phrases will ignore
4817 case.
4818 @end defopt
4819
4820 @defopt reftex-index-verify-function
4821 A function which is called at each match during global indexing.
4822 If the function returns nil, the current match is skipped.
4823 @end defopt
4824
4825 @defopt reftex-index-phrases-skip-indexed-matches
4826 Non-@code{nil} means, skip matches which appear to be indexed already.
4827 When doing global indexing from the phrases buffer, searches for some
4828 phrases may match at places where that phrase was already indexed. In
4829 particular when indexing an already processed document again, this
4830 will even be the norm. When this variable is non-@code{nil},
4831 @RefTeX{} checks if the match is an index macro argument, or if an
4832 index macro is directly before or after the phrase. If that is the
4833 case, that match will be ignored.
4834 @end defopt
4835
4836 @defopt reftex-index-phrases-wrap-long-lines
4837 Non-@code{nil} means, when indexing from the phrases buffer, wrap lines.
4838 Inserting indexing commands in a line makes the line longer, often
4839 so long that it does not fit onto the screen. When this variable is
4840 non-@code{nil}, newlines will be added as necessary before and/or after the
4841 indexing command to keep lines short. However, the matched text
4842 phrase and its index command will always end up on a single line.
4843 @end defopt
4844
4845 @defopt reftex-index-phrases-sort-prefers-entry
4846 Non-@code{nil} means when sorting phrase lines, the explicit index entry
4847 is used. Phrase lines in the phrases buffer contain a search phrase, and
4848 sorting is normally based on these. Some phrase lines also have
4849 an explicit index argument specified. When this variable is
4850 non-@code{nil}, the index argument will be used for sorting.
4851 @end defopt
4852
4853 @defopt reftex-index-phrases-sort-in-blocks
4854 Non-@code{nil} means, empty and comment lines separate phrase buffer
4855 into blocks. Sorting will then preserve blocks, so that lines are
4856 re-arranged only within blocks.
4857 @end defopt
4858
4859 @defopt reftex-index-phrases-map
4860 Keymap for the Index Phrases buffer.
4861 @end defopt
4862
4863 @defopt reftex-index-phrases-mode-hook
4864 Normal hook which is run when a buffer is put into
4865 @code{reftex-index-phrases-mode}.
4866 @end defopt
4867
4868 @defopt reftex-index-section-letters
4869 The letters which denote sections in the index. Usually these are all
4870 capital letters. Don't use any downcase letters. Order is not
4871 significant, the index will be sorted by whatever the sort function
4872 thinks is correct. In addition to these letters, @RefTeX{} will
4873 create a group @samp{!} which contains all entries sorted below the
4874 lowest specified letter. In the @file{*Index*} buffer, pressing any of
4875 these capital letters or @kbd{!} will jump to that section.
4876 @end defopt
4877
4878 @defopt reftex-index-include-context
4879 Non-@code{nil} means, display the index definition context in the
4880 @file{*Index*} buffer. This flag may also be toggled from the
4881 @file{*Index*} buffer with the @kbd{c} key.
4882 @end defopt
4883
4884 @defopt reftex-index-follow-mode
4885 Non-@code{nil} means, point in @file{*Index*} buffer will cause other
4886 window to follow. The other window will show the corresponding part of
4887 the document. This flag can be toggled from within the @file{*Index*}
4888 buffer with the @kbd{f} key.
4889 @end defopt
4890
4891 @deffn Keymap reftex-index-map
4892 The keymap which is active in the @file{*Index*} buffer
4893 (@pxref{Index Support}).
4894 @end deffn
4895
4896 @node Options - Viewing Cross-References
4897 @section Viewing Cross-References
4898 @cindex Options, viewing cross-references
4899 @cindex Viewing cross-references, options
4900
4901 @defopt reftex-view-crossref-extra
4902 Macros which can be used for the display of cross references.
4903 This is used when `reftex-view-crossref' is called with point in an
4904 argument of a macro. Note that crossref viewing for citations,
4905 references (both ways) and index entries is hard-coded. This variable
4906 is only to configure additional structures for which crossreference
4907 viewing can be useful. Each entry has the structure
4908 @example
4909 (@var{macro-re} @var{search-re} @var{highlight}).
4910 @end example
4911 @var{macro-re} is matched against the macro. @var{search-re} is the
4912 regexp used to search for cross references. @samp{%s} in this regexp is
4913 replaced with the macro argument at point. @var{highlight} is an
4914 integer indicating which subgroup of the match should be highlighted.
4915 @end defopt
4916
4917 @defopt reftex-auto-view-crossref
4918 Non-@code{nil} means, initially turn automatic viewing of crossref info
4919 on. Automatic viewing of crossref info normally uses the echo area.
4920 Whenever point is idle for more than @code{reftex-idle-time} seconds on
4921 the argument of a @code{\ref} or @code{\cite} macro, and no other
4922 message is being displayed, the echo area will display information about
4923 that cross reference. You can also set the variable to the symbol
4924 @code{window}. In this case a small temporary window is used for the
4925 display. This feature can be turned on and off from the menu
4926 (Ref->Options).
4927 @end defopt
4928
4929 @defopt reftex-idle-time
4930 Time (secs) Emacs has to be idle before automatic crossref display
4931 or toc recentering is done.
4932 @end defopt
4933
4934 @defopt reftex-cite-view-format
4935 Citation format used to display citation info in the message area. See
4936 the variable @code{reftex-cite-format} for possible percent
4937 escapes.
4938 @end defopt
4939
4940 @defopt reftex-revisit-to-echo
4941 Non-@code{nil} means, automatic citation display will revisit files if
4942 necessary. When nil, citation display in echo area will only be active
4943 for cached echo strings (see @code{reftex-cache-cite-echo}), or for
4944 @BibTeX{} database files which are already visited by a live associated
4945 buffers.
4946 @end defopt
4947
4948 @defopt reftex-cache-cite-echo
4949 Non-@code{nil} means, the information displayed in the echo area for
4950 cite macros (see variable @code{reftex-auto-view-crossref}) is cached and
4951 saved along with the parsing information. The cache survives document
4952 scans. In order to clear it, use @kbd{M-x reftex-reset-mode}.
4953 @end defopt
4954
4955 @node Options - Finding Files
4956 @section Finding Files
4957 @cindex Options, Finding Files
4958 @cindex Finding files, options
4959
4960 @defopt reftex-texpath-environment-variables
4961 List of specifications how to retrieve the search path for @TeX{} files.
4962 Several entries are possible.
4963 @itemize @minus
4964 @item
4965 If an element is the name of an environment variable, its content is
4966 used.
4967 @item
4968 If an element starts with an exclamation mark, it is used as a command
4969 to retrieve the path. A typical command with the kpathsearch library
4970 would be @w{@code{"!kpsewhich -show-path=.tex"}}.
4971 @item
4972 Otherwise the element itself is interpreted as a path.
4973 @end itemize
4974 Multiple directories can be separated by the system dependent
4975 @code{path-separator}. Directories ending in @samp{//} or @samp{!!} will
4976 be expanded recursively. See also @code{reftex-use-external-file-finders}.
4977 @end defopt
4978
4979 @defopt reftex-bibpath-environment-variables
4980 List of specifications how to retrieve the search path for @BibTeX{}
4981 files. Several entries are possible.
4982 @itemize @minus
4983 @item
4984 If an element is the name of an environment variable, its content is
4985 used.
4986 @item
4987 If an element starts with an exclamation mark, it is used as a command
4988 to retrieve the path. A typical command with the kpathsearch library
4989 would be @w{@code{"!kpsewhich -show-path=.bib"}}.
4990 @item
4991 Otherwise the element itself is interpreted as a path.
4992 @end itemize
4993 Multiple directories can be separated by the system dependent
4994 @code{path-separator}. Directories ending in @samp{//} or @samp{!!} will
4995 be expanded recursively. See also @code{reftex-use-external-file-finders}.
4996 @end defopt
4997
4998 @defopt reftex-file-extensions
4999 Association list with file extensions for different file types.
5000 This is a list of items, each item is like:
5001 @code{(@var{type} . (@var{def-ext} @var{other-ext} ...))}
5002 @example
5003 @var{type}: @r{File type like @code{"bib"} or @code{"tex"}.}
5004 @var{def-ext}: @r{The default extension for that file type, like @code{".tex"} or @code{".bib"}.}
5005 @var{other-ext}: @r{Any number of other valid extensions for this file type.}
5006 @end example
5007 When a files is searched and it does not have any of the valid extensions,
5008 we try the default extension first, and then the naked file name.
5009 @end defopt
5010
5011 @defopt reftex-search-unrecursed-path-first
5012 Non-@code{nil} means, search all specified directories before trying
5013 recursion. Thus, in a path @samp{.//:/tex/}, search first @samp{./},
5014 then @samp{/tex/}, and then all subdirectories of @samp{./}. If this
5015 option is @code{nil}, the subdirectories of @samp{./} are searched
5016 before @samp{/tex/}. This is mainly for speed; most of the time the
5017 recursive path is for the system files and not for the user files. Set
5018 this to @code{nil} if the default makes @RefTeX{} finding files with
5019 equal names in wrong sequence.
5020 @end defopt
5021
5022 @defopt reftex-use-external-file-finders
5023 Non-@code{nil} means, use external programs to find files. Normally,
5024 @RefTeX{} searches the paths given in the environment variables
5025 @code{TEXINPUTS} and @code{BIBINPUTS} to find @TeX{} files and @BibTeX{}
5026 database files. With this option turned on, it calls an external
5027 program specified in the option @code{reftex-external-file-finders}
5028 instead. As a side effect, the variables
5029 @code{reftex-texpath-environment-variables} and
5030 @code{reftex-bibpath-environment-variables} will be ignored.
5031 @end defopt
5032
5033 @defopt reftex-external-file-finders
5034 Association list with external programs to call for finding files. Each
5035 entry is a cons cell @w{@code{(@var{type} . @var{program})}}.
5036 @var{type} is either @code{"tex"} or @code{"bib"}. @var{program} is a
5037 string containing the external program to use with any arguments.
5038 @code{%f} will be replaced by the name of the file to be found. Note
5039 that these commands will be executed directly, not via a shell. Only
5040 relevant when @code{reftex-use-external-file-finders} is
5041 non-@code{nil}.
5042 @end defopt
5043
5044 @page
5045 @node Options - Optimizations
5046 @section Optimizations
5047 @cindex Options, optimizations
5048 @cindex Optimizations, options
5049
5050 @defopt reftex-keep-temporary-buffers
5051 Non-@code{nil} means, keep buffers created for parsing and lookup.
5052 @RefTeX{} sometimes needs to visit files related to the current
5053 document. We distinguish files visited for
5054 @table @asis
5055 @item PARSING
5056 Parts of a multifile document loaded when (re)-parsing the
5057 document.
5058 @item LOOKUP
5059 @BibTeX{} database files and @TeX{} files loaded to find a reference, to
5060 display label context, etc.
5061 @end table
5062 The created buffers can be kept for later use, or be thrown away
5063 immediately after use, depending on the value of this variable:
5064
5065 @table @code
5066 @item nil
5067 Throw away as much as possible.
5068 @item t
5069 Keep everything.
5070 @item 1
5071 Throw away buffers created for parsing, but keep the ones created for
5072 lookup.
5073 @end table
5074
5075 If a buffer is to be kept, the file is visited normally (which is
5076 potentially slow but will happen only once). If a buffer is to be thrown
5077 away, the initialization of the buffer depends upon the variable
5078 @code{reftex-initialize-temporary-buffers}.
5079 @end defopt
5080
5081 @defopt reftex-initialize-temporary-buffers
5082 Non-@code{nil} means do initializations even when visiting file
5083 temporarily. When @code{nil}, @RefTeX{} may turn off find-file hooks and
5084 other stuff to briefly visit a file. When @code{t}, the full default
5085 initializations are done (@code{find-file-hook} etc.). Instead of
5086 @code{t} or @code{nil}, this variable may also be a list of hook
5087 functions to do a minimal initialization.
5088 @end defopt
5089
5090 @defopt reftex-no-include-regexps
5091 List of regular expressions to exclude certain input files from parsing.
5092 If the name of a file included via @code{\include} or @code{\input} is
5093 matched by any of the regular expressions in this list, that file is not
5094 parsed by @RefTeX{}.
5095 @end defopt
5096
5097 @defopt reftex-enable-partial-scans
5098 Non-@code{nil} means, re-parse only 1 file when asked to re-parse.
5099 Re-parsing is normally requested with a @kbd{C-u} prefix to many @RefTeX{}
5100 commands, or with the @kbd{r} key in menus. When this option is
5101 @code{t} in a multifile document, we will only parse the current buffer,
5102 or the file associated with the label or section heading near point in a
5103 menu. Requesting re-parsing of an entire multifile document then
5104 requires a @kbd{C-u C-u} prefix or the capital @kbd{R} key in
5105 menus.
5106 @end defopt
5107
5108 @defopt reftex-save-parse-info
5109 Non-@code{nil} means, save information gathered with parsing in files.
5110 The file @file{MASTER.rel} in the same directory as @file{MASTER.tex} is
5111 used to save the information. When this variable is @code{t},
5112 @itemize @minus
5113 @item
5114 accessing the parsing information for the first time in an editing
5115 session will read that file (if available) instead of parsing the
5116 document.
5117 @item
5118 exiting Emacs or killing a buffer in reftex-mode will cause a new
5119 version of the file to be written.
5120 @end itemize
5121 @end defopt
5122
5123 @defopt reftex-parse-file-extension
5124 File extension for the file in which parser information is stored.
5125 This extension is added to the base name of the master file.
5126 @end defopt
5127
5128 @defopt reftex-allow-automatic-rescan
5129 Non-@code{nil} means, @RefTeX{} may rescan the document when this seems
5130 necessary. Applies (currently) only in rare cases, when a new label
5131 cannot be placed with certainty into the internal label list.
5132 @end defopt
5133
5134 @defopt reftex-use-multiple-selection-buffers
5135 Non-@code{nil} means use a separate selection buffer for each label
5136 type. These buffers are kept from one selection to the next and need
5137 not be created for each use, so the menu generally comes up faster.
5138 The selection buffers will be erased (and therefore updated)
5139 automatically when new labels in its category are added. See the
5140 variable @code{reftex-auto-update-selection-buffers}.
5141 @end defopt
5142
5143 @defopt reftex-auto-update-selection-buffers
5144 Non-@code{nil} means, selection buffers will be updated automatically.
5145 When a new label is defined with @code{reftex-label}, all selection
5146 buffers associated with that label category are emptied, in order to
5147 force an update upon next use. When @code{nil}, the buffers are left
5148 alone and have to be updated by hand, with the @kbd{g} key from the
5149 label selection process. The value of this variable will only have any
5150 effect when @code{reftex-use-multiple-selection-buffers} is
5151 non-@code{nil}.
5152 @end defopt
5153
5154 @node Options - Fontification
5155 @section Fontification
5156 @cindex Options, fontification
5157 @cindex Fontification, options
5158
5159 @defopt reftex-use-fonts
5160 Non-@code{nil} means, use fonts in label menu and on-the-fly help.
5161 Font-lock must be loaded as well to actually get fontified
5162 display. After changing this option, a rescan may be necessary to
5163 activate it.
5164 @end defopt
5165
5166 @defopt reftex-refontify-context
5167 Non-@code{nil} means, re-fontify the context in the label menu with
5168 font-lock. This slightly slows down the creation of the label menu. It
5169 is only necessary when you definitely want the context fontified.
5170
5171 This option may have 3 different values:
5172 @table @code
5173 @item nil
5174 Never refontify.
5175 @item t
5176 Always refontify.
5177 @item 1
5178 Refontify when necessary, e.g., with old versions of the x-symbol
5179 package.
5180 @end table
5181 The option is ignored when @code{reftex-use-fonts} is @code{nil}.
5182 @end defopt
5183
5184 @defopt reftex-highlight-selection
5185 Non-@code{nil} means, highlight selected text in selection and
5186 @file{*toc*} buffers. Normally, the text near the cursor is the
5187 @emph{selected} text, and it is highlighted. This is the entry most
5188 keys in the selection and @file{*toc*} buffers act on. However, if you
5189 mainly use the mouse to select an item, you may find it nice to have
5190 mouse-triggered highlighting @emph{instead} or @emph{as well}. The
5191 variable may have one of these values:
5192
5193 @example
5194 nil @r{No highlighting.}
5195 cursor @r{Highlighting is cursor driven.}
5196 mouse @r{Highlighting is mouse driven.}
5197 both @r{Both cursor and mouse trigger highlighting.}
5198 @end example
5199
5200 Changing this variable requires to rebuild the selection and *toc*
5201 buffers to become effective (keys @kbd{g} or @kbd{r}).
5202 @end defopt
5203
5204 @defopt reftex-cursor-selected-face
5205 Face name to highlight cursor selected item in toc and selection buffers.
5206 See also the variable @code{reftex-highlight-selection}.
5207 @end defopt
5208 @defopt reftex-mouse-selected-face
5209 Face name to highlight mouse selected item in toc and selection buffers.
5210 See also the variable @code{reftex-highlight-selection}.
5211 @end defopt
5212 @defopt reftex-file-boundary-face
5213 Face name for file boundaries in selection buffer.
5214 @end defopt
5215 @defopt reftex-label-face
5216 Face name for labels in selection buffer.
5217 @end defopt
5218 @defopt reftex-section-heading-face
5219 Face name for section headings in toc and selection buffers.
5220 @end defopt
5221 @defopt reftex-toc-header-face
5222 Face name for the header of a toc buffer.
5223 @end defopt
5224 @defopt reftex-bib-author-face
5225 Face name for author names in bib selection buffer.
5226 @end defopt
5227 @defopt reftex-bib-year-face
5228 Face name for year in bib selection buffer.
5229 @end defopt
5230 @defopt reftex-bib-title-face
5231 Face name for article title in bib selection buffer.
5232 @end defopt
5233 @defopt reftex-bib-extra-face
5234 Face name for bibliographic information in bib selection buffer.
5235 @end defopt
5236 @defopt reftex-select-mark-face
5237 Face name for marked entries in the selection buffers.
5238 @end defopt
5239 @defopt reftex-index-header-face
5240 Face name for the header of an index buffer.
5241 @end defopt
5242 @defopt reftex-index-section-face
5243 Face name for the start of a new letter section in the index.
5244 @end defopt
5245 @defopt reftex-index-tag-face
5246 Face name for index names (for multiple indices).
5247 @end defopt
5248 @defopt reftex-index-face
5249 Face name for index entries.
5250 @end defopt
5251
5252 @node Options - Misc
5253 @section Miscellaneous
5254 @cindex Options, misc
5255
5256 @defopt reftex-extra-bindings
5257 Non-@code{nil} means, make additional key bindings on startup. These
5258 extra bindings are located in the users @samp{C-c letter}
5259 map. @xref{Key Bindings}.
5260 @end defopt
5261
5262 @defopt reftex-plug-into-AUCTeX
5263 Plug-in flags for @AUCTeX{} interface. This variable is a list of
5264 5 boolean flags. When a flag is non-@code{nil}, @RefTeX{}
5265 will
5266
5267 @example
5268 - supply labels in new sections and environments (flag 1)
5269 - supply arguments for macros like @code{\label} (flag 2)
5270 - supply arguments for macros like @code{\ref} (flag 3)
5271 - supply arguments for macros like @code{\cite} (flag 4)
5272 - supply arguments for macros like @code{\index} (flag 5)
5273 @end example
5274
5275 You may also set the variable itself to t or nil in order to turn all
5276 options on or off, respectively.@*
5277 Supplying labels in new sections and environments applies when creating
5278 sections with @kbd{C-c C-s} and environments with @kbd{C-c C-e}.@*
5279 Supplying macro arguments applies when you insert such a macro
5280 interactively with @kbd{C-c @key{RET}}.@*
5281 See the @AUCTeX{} documentation for more information.
5282 @end defopt
5283
5284 @defopt reftex-revisit-to-follow
5285 Non-@code{nil} means, follow-mode will revisit files if necessary.
5286 When nil, follow-mode will be suspended for stuff in unvisited files.
5287 @end defopt
5288
5289 @defopt reftex-allow-detached-macro-args
5290 Non-@code{nil} means, allow arguments of macros to be detached by
5291 whitespace. When this is @code{t}, the @samp{aaa} in @w{@samp{\bbb
5292 [xxx] @{aaa@}}} will be considered an argument of @code{\bb}. Note that
5293 this will be the case even if @code{\bb} is defined with zero or one
5294 argument.
5295 @end defopt
5296
5297 @node Keymaps and Hooks
5298 @section Keymaps and Hooks
5299 @cindex Keymaps
5300
5301 @RefTeX{} has the usual general keymap, load hook and mode hook.
5302
5303 @deffn Keymap reftex-mode-map
5304 The keymap for @RefTeX{} mode.
5305 @end deffn
5306
5307 @deffn {Normal Hook} reftex-load-hook
5308 Normal hook which is being run when loading @file{reftex.el}.
5309 @end deffn
5310
5311 @deffn {Normal Hook} reftex-mode-hook
5312 Normal hook which is being run when turning on @RefTeX{} mode.
5313 @end deffn
5314
5315 Furthermore, the four modes used for referencing labels, creating
5316 citations, the table of contents buffer and the phrases buffer have
5317 their own keymaps and mode hooks. See the respective sections. There
5318 are many more hooks which are described in the relevant sections about
5319 options for a specific part of @RefTeX{}.
5320
5321 @node Changes
5322 @chapter Changes
5323 @cindex Changes
5324
5325 Here is a list of recent changes to @RefTeX{}.
5326
5327 @noindent @b{Version 4.33}
5328
5329 @itemize @bullet
5330 @item
5331 Update to GPLv3.
5332 @item
5333 Parse files are created in a way that does not interfere with recentf
5334 mode.
5335 @end itemize
5336
5337 @noindent @b{Version 4.32}
5338
5339 @itemize @bullet
5340 @item
5341 First release by @AUCTeX{} project.
5342 @item
5343 Installation routine rewritten after structure of source package
5344 changed.
5345 @item
5346 Activation of @RefTeX{} changed, so make sure you read the installation
5347 instructions and remove obsolete cruft related to @RefTeX{} from your
5348 init file.
5349 @item
5350 Fixed bug where point would end up in the wrong buffer when jumping
5351 between several @LaTeX{} and phrases buffers.
5352 @item
5353 Fixed bug where @BibTeX{} keys with hyphens were parsed incorrectly.
5354 @item
5355 Some performance improvements.
5356 @item
5357 The separator used between multiple citations in a \cite macro can now
5358 be changed by customizing the variable @code{reftex-cite-key-separator}.
5359 @end itemize
5360
5361 @noindent @b{Version 4.28}
5362 @itemize @bullet
5363 @item Support for the Jurabib package.
5364 @item Improvements when selecting several items in a selection buffer.
5365 @end itemize
5366
5367 @noindent @b{Version 4.26}
5368 @itemize @bullet
5369 @item
5370 Support for global incremental search.
5371 @item
5372 Some improvements for XEmacs compatibility.
5373 @end itemize
5374
5375 @noindent @b{Version 4.25}
5376 @itemize @bullet
5377 @item
5378 Fixed bug with @samp{%F} in a label prefix. Added new escapes
5379 @samp{%m} and @samp{%M} for mater file name and master directory.
5380 @end itemize
5381
5382 @noindent @b{Version 4.24}
5383 @itemize @bullet
5384 @item
5385 Inserting citation commands now prompts for optional arguments
5386 when called with a prefix argument. Related new options are
5387 @code{reftex-cite-prompt-optional-args} and
5388 @code{reftex-cite-cleanup-optional-args}.
5389 @item
5390 New option @code{reftex-trust-label-prefix}. Configure this variable
5391 if you'd like RefTeX to base its classification of labels on prefixes.
5392 This can speed-up document parsing, but may in some cases reduce the
5393 quality of the context used by RefTeX to describe a label.
5394 @item
5395 Fixed bug in @code{reftex-create-bibtex-file} when @code{reftex-comment-citations}
5396 is non-nil.
5397 @item
5398 Fixed bugs in indexing: Case-sensitive search, quotes before and/or
5399 after words. Disabled indexing in comment lines.
5400 @end itemize
5401
5402 @noindent @b{Version 4.22}
5403 @itemize @bullet
5404 @item
5405 New command @code{reftex-create-bibtex-file} to create a new database
5406 with all entries referenced in the current document.
5407 @item
5408 New keys @kbd{e} and @kbd{E} allow to produce a BibTeX database file
5409 from entries marked in a citation selection buffer.
5410 @end itemize
5411
5412 @noindent @b{Version 4.21}
5413 @itemize @bullet
5414 @item
5415 Renaming labels from the toc buffer with key @kbd{M-%}.
5416 @end itemize
5417
5418 @noindent @b{Version 4.20}
5419 @itemize @bullet
5420 @item
5421 Structure editing capabilities. The command keys @kbd{<} and @kbd{>} in
5422 the TOC buffer promote/demote the section at point or all sections in
5423 the current region.
5424 @item
5425 New option @code{reftex-toc-split-windows-fraction} to set the size of
5426 the window used by the TOC@. This makes the old variable
5427 @code{reftex-toc-split-windows-horizontally-fraction} obsolete.
5428 @item
5429 A dedicated frame can show the TOC with the current section
5430 always automatically highlighted. The frame is created and
5431 deleted from the toc buffer with the @kbd{d} key.
5432 @end itemize
5433
5434 @noindent @b{Version 4.19}
5435 @itemize @bullet
5436 @item
5437 New command `reftex-toc-recenter' (@kbd{C-c -}) which shows the current
5438 section in the TOC buffer without selecting the TOC window.
5439 @item
5440 Recentering happens automatically in idle time when the option
5441 @code{reftex-auto-recenter-toc} is turned on.
5442 @item
5443 Fixed several bugs related to automatic cursor positioning in the TOC
5444 buffer.
5445 @item
5446 The highlight in the TOC buffer stays when the focus moves to a
5447 different window.
5448 @item
5449 New command `reftex-goto-label'.
5450 @item
5451 Part numbers are no longer included in chapter numbers, and a new
5452 part does not reset the chapter counter. See new option
5453 @code{reftex-part-resets-chapter}.
5454 @end itemize
5455
5456 @noindent @b{Version 4.18}
5457 @itemize @bullet
5458 @item
5459 @code{reftex-citation} uses the word before the cursor as a default
5460 search string.
5461 @item
5462 Simplified several regular expressions for speed.
5463 @item
5464 Better support for chapterbib.
5465 @end itemize
5466
5467 @noindent @b{Version 4.17}
5468 @itemize @bullet
5469 @item
5470 The toc window can be split off horizontally. See new options
5471 @code{reftex-toc-split-windows-horizontally},
5472 @code{reftex-toc-split-windows-horizontally-fraction}.
5473 @item
5474 It is possible to specify a function which verifies an index match
5475 during global indexing. See new option @code{reftex-index-verify-function}.
5476 @item
5477 The macros which input a file in LaTeX (like \input, \include) can
5478 be configured. See new option @code{reftex-include-file-commands}.
5479 @item
5480 The macros which specify the bibliography file (like \bibliography) can
5481 be configured. See new option @code{reftex-bibliography-commands}.
5482 @item
5483 The regular expression used to search for the \bibliography macro has
5484 been relaxed to allow for @samp{@{\bibliography@{...@}@}} needed by
5485 chapterbib.
5486 @item
5487 Small bug fixes.
5488 @end itemize
5489
5490 @noindent @b{Version 4.15}
5491 @itemize @bullet
5492 @item
5493 Fixed bug with parsing of BibTeX files, when fields contain quotes or
5494 unmatched parenthesis.
5495 @item
5496 Small bug fixes.
5497 @item
5498 Improved interaction with Emacs LaTeX mode.
5499 @end itemize
5500
5501 @noindent @b{Version 4.12}
5502 @itemize @bullet
5503 @item
5504 Support for @file{bibentry} citation style.
5505 @end itemize
5506
5507 @noindent @b{Version 4.11}
5508 @itemize @bullet
5509 @item
5510 Fixed bug which would parse @samp{\Section} just like @samp{\section}.
5511 @end itemize
5512
5513 @noindent @b{Version 4.10}
5514 @itemize @bullet
5515 @item
5516 Renamed @file{reftex-vcr.el} to @file{reftex-dcr.el} because of conflict
5517 with @file{reftex-vars.el} on DOS machines.
5518 @item
5519 New options @code{reftex-parse-file-extension} and
5520 @code{reftex-index-phrase-file-extension}.
5521 @end itemize
5522
5523 @noindent [.....]
5524 @ignore
5525 @noindent @b{Version 4.09}
5526 @itemize @bullet
5527 @item
5528 New option @code{reftex-toc-max-level} to limit the depth of the toc.
5529 New key binding @kbd{t} in the @file{*toc*} buffer to change this
5530 setting.
5531 @item
5532 RefTeX maintains an @file{Index Phrases} file in which phrases can be
5533 collected. When the document is ready, RefTeX can search all
5534 these phrases and assist indexing all matches.
5535 @item
5536 The variables @code{reftex-index-macros} and
5537 @code{reftex-index-default-macro} have changed their syntax slightly.
5538 The @var{repeat} parameter has move from the latter to the former.
5539 Also calls to @code{reftex-add-index-macros} from AUCTeX style files
5540 need to be adapted.
5541 @item
5542 The variable @code{reftex-section-levels} no longer contains the
5543 default stuff which has been moved to a constant.
5544 @item
5545 Environments like theorems can be placed into the TOC by putting
5546 entries for @samp{"begin@{theorem@}"} in
5547 @code{reftex-section-levels}.
5548 @end itemize
5549
5550 @noindent @b{Version 4.06}
5551 @itemize @bullet
5552 @item
5553 @code{reftex-section-levels} can contain a function to compute the level
5554 of a sectioning command.
5555 @item
5556 Multiple @code{thebibliography} environments recognized.
5557 @end itemize
5558
5559 @noindent @b{Version 4.04}
5560 @itemize @bullet
5561 @item
5562 New option @code{reftex-index-default-tag} implements a default for queries.
5563 @end itemize
5564
5565 @noindent @b{Version 4.02}
5566 @itemize @bullet
5567 @item
5568 macros ending in @samp{refrange} are considered to contain references.
5569 @item
5570 Index entries made with @code{reftex-index-selection-or-word} in TeX
5571 math mode automatically get enclosing @samp{$} to preserve math mode. See
5572 new option @code{reftex-index-math-format}. Requires AUCTeX.
5573 @end itemize
5574
5575 @noindent @b{Version 4.01}
5576 @itemize @bullet
5577 @item
5578 New command @code{reftex-index-globally} to index a word in many
5579 places in the document. Also available from the index buffer with
5580 @kbd{&}.
5581 @item
5582 The first item in a @code{reftex-label-alist} entry may now also be a parser
5583 function to do non-standard parsing.
5584 @item
5585 @code{reftex-auto-view-crossref} no longer interferes with
5586 @code{pop-up-frames} (patch from Stefan Monnier).
5587 @end itemize
5588
5589 @noindent @b{Version 4.00}
5590 @itemize @bullet
5591 @item
5592 RefTeX has been split into several smaller files which are autoloaded on
5593 demand.
5594 @item
5595 Index support, along with many new options.
5596 @item
5597 The selection of keys for @code{\ref} and @code{\cite} now allows to
5598 select multiple items by marking entries with the @kbd{m} key.
5599 @item
5600 Fancyref support.
5601 @end itemize
5602
5603 @noindent @b{Version 3.43}
5604 @itemize @bullet
5605 @item
5606 Viewing cross-references generalized. Now works on @code{\label},
5607 @code{\ref}, @code{\cite}, @code{\bibitem}, @code{\index}, variations of
5608 these, and from BibTeX buffers.
5609 @item
5610 New option @code{reftex-view-crossref-extra}.
5611 @item
5612 Support for the additional sectioning commands @code{\addchap} and
5613 @code{\addsec} which are defined in the LaTeX KOMA-Script classes.
5614 @item
5615 Files in @code{reftex-default-bibliography} will be searched along
5616 @code{BIBINPUTS} path.
5617 @item
5618 Reading a parse file now checks consistency.
5619 @end itemize
5620
5621 @noindent @b{Version 3.42}
5622 @itemize @bullet
5623 @item
5624 File search further refined. New option @code{reftex-file-extensions}.
5625 @item
5626 @file{*toc*} buffer can show the file boundaries of a multifile
5627 document, all labels and associated context. New keys @kbd{i}, @kbd{l},
5628 and @kbd{c}. New options @code{reftex-toc-include-labels},
5629 @code{reftex-toc-include-context},
5630 @code{reftex-toc-include-file-boundaries}.
5631 @end itemize
5632
5633 @noindent @b{Version 3.41}
5634 @itemize @bullet
5635 @item
5636 New options @code{reftex-texpath-environment-variables},
5637 @code{reftex-use-external-file-finders},
5638 @code{reftex-external-file-finders},
5639 @code{reftex-search-unrecursed-path-first}.
5640 @item
5641 @emph{kpathsearch} support. See new options and
5642 @code{reftex-bibpath-environment-variables}.
5643 @end itemize
5644
5645 @noindent @b{Version 3.38}
5646 @itemize @bullet
5647 @item
5648 @code{reftex-view-crossref} no longer moves to find a macro. Point has
5649 to be on the macro argument.
5650 @end itemize
5651
5652 @noindent @b{Version 3.36}
5653 @itemize @bullet
5654 @item
5655 New value @code{window} for option @code{reftex-auto-view-crossref}.
5656 @end itemize
5657
5658 @noindent @b{Version 3.35}
5659 @itemize @bullet
5660 @item
5661 ISO 8859 Latin-1 chars are converted to ASCII to derive better labels.
5662 This takes back the related changes in 3.34 for safety reasons.
5663 @end itemize
5664
5665 @noindent @b{Version 3.34}
5666 @itemize @bullet
5667 @item
5668 Additional flag in @code{reftex-derive-label-parameters} do make only
5669 lowercase labels (default @code{t}).
5670 @item
5671 All @file{.rel} files have a final newline to avoid queries.
5672 @item
5673 Single byte representations of accented European letters (ISO-8859-1)
5674 are now valid in labels.
5675 @end itemize
5676
5677 @noindent @b{Version 3.33}
5678 @itemize @bullet
5679 @item
5680 Multiple selection buffers are now hidden buffers (they start with a
5681 SPACE).
5682 @item
5683 Fixed bug with file search when TEXINPUTS environment variable is empty.
5684 @end itemize
5685
5686 @noindent @b{Version 3.30}
5687 @itemize @bullet
5688 @item
5689 In @code{reftex-citation}, the regular expression used to scan BibTeX
5690 files can be specified using completion on known citation keys.
5691 @item
5692 New keys @kbd{a} and @kbd{A} in BibTeX selection process to cite @emph{all}
5693 entries.
5694 @item
5695 New command @code{reftex-renumber-simple-labels} to renumber simple
5696 labels like @samp{eq:13} sequentially through a document.
5697 @end itemize
5698
5699 @noindent @b{Version 3.28}
5700 @itemize @bullet
5701 @item
5702 Auto view crossref for XEmacs uses @code{post-command-hook} to restart the
5703 timer, since itimer restart is not reliable.
5704 @item
5705 Option @code{reftex-bibfile-ignore-list} renamed to @code{-regexps}.
5706 @item
5707 Expansion of recursive tex and bib path rewritten.
5708 @item
5709 Fixed problem where @RefTeX{} did not scan unsaved buffers.
5710 @item
5711 Fixed bug with section numbering after *-red sections.
5712 @end itemize
5713
5714 @noindent @b{Version 3.27}
5715 @itemize @bullet
5716 @item
5717 Macros can define @emph{neutral} labels, just like @code{\label}
5718 itself.
5719 @item
5720 New option @code{reftex-allow-detached-macro-args}, default @code{nil}!
5721 @end itemize
5722
5723 @noindent @b{Version 3.26}
5724 @itemize @bullet
5725 @item
5726 [X]Emacs 19 no longer supported. Use 3.22 for Emacs 19.
5727 @item
5728 New hooks @code{reftex-translate-to-ascii-function},
5729 @code{reftex-string-to-label-function}.
5730 @item
5731 Made sure automatic crossref display will not visit/scan files.
5732 @end itemize
5733
5734 @noindent @b{Version 3.25}
5735 @itemize @bullet
5736 @item
5737 Echoing of citation info caches the info for displayed entries.
5738 New option @code{reftex-cache-cite-echo}.
5739 @item
5740 @kbd{M-x reftex-reset-mode} now also removes the file with parsing
5741 info.
5742 @item
5743 Default of @code{reftex-revisit-to-follow} changed to nil.
5744 @end itemize
5745
5746 @noindent @b{Version 3.24}
5747 @itemize @bullet
5748 @item
5749 New option @code{reftex-revisit-to-echo}.
5750 @item
5751 Interface with X-Symbol (>=2.6) is now complete and stable.
5752 @item
5753 Adapted to new outline, which uses overlays.
5754 @item
5755 File names in @code{\bibliography} may now have the @code{.bib}
5756 extension.
5757 @item
5758 Fixed Bug with parsing "single file" from master file buffer.
5759 @end itemize
5760
5761 @noindent @b{Version 3.23}
5762 @itemize @bullet
5763 @item
5764 Parse files @file{MASTER.rel} made compatible between Emacs and XEmacs.
5765 @item
5766 @code{kill-emacs-hook} and @code{kill-buffer-hook} now write the parse
5767 file.
5768 @item
5769 The cursor inside a @code{\ref} or @code{\cite} macro can now trigger
5770 automatic display of crossref information in the echo area. See
5771 variable @code{reftex-auto-view-crossref}.
5772 @item
5773 AUCTeX interface updates:
5774 @itemize @minus
5775 @item
5776 AUCTeX 9.9c and later notifies @RefTeX{} about new sections.
5777 @item
5778 @RefTeX{} notifies AUCTeX about new labels.
5779 @item
5780 @code{TeX-arg-ref} no longer used (introduction was unnecessary).
5781 @item
5782 @code{reftex-arg-label} and @code{reftex-arg-cite} fixed up.
5783 @item
5784 Settings added to @RefTeX{} via style files remain local.
5785 @end itemize
5786 @item
5787 Fixed bug with @code{reftex-citation} in non-latex buffers.
5788 @item
5789 Fixed bug with syntax table and context refontification.
5790 @item
5791 Safety-net for name change of @code{font-lock-reference-face}.
5792 @end itemize
5793
5794 @noindent @b{Version 3.22}
5795 @itemize @bullet
5796 @item
5797 Fixed bug with empty context strings.
5798 @item
5799 @code{reftex-mouse-view-crossref} is now bound by default at
5800 @kbd{S-mouse-2}.
5801 @end itemize
5802
5803 @noindent @b{Version 3.21}
5804 @itemize @bullet
5805 @item
5806 New options for all faces used by @RefTeX{}. They're in the
5807 customization group @code{reftex-fontification-configurations}.
5808 @end itemize
5809
5810 @noindent @b{Version 3.19}
5811 @itemize @bullet
5812 @item
5813 Fixed bug with AUCTeX @code{TeX-master}.
5814 @end itemize
5815
5816 @noindent @b{Version 3.18}
5817 @itemize @bullet
5818 @item
5819 The selection now uses a recursive edit, much like minibuffer input.
5820 This removes all restrictions during selection. E.g., you can now
5821 switch buffers at will, use the mouse etc.
5822 @item
5823 New option @code{reftex-highlight-selection}.
5824 @item
5825 @kbd{mouse-2} can be used to select in selection and @file{*toc*}
5826 buffers.
5827 @item
5828 Fixed some problems regarding the interaction with VIPER mode.
5829 @item
5830 Follow-mode is now only used after point motion.
5831 @item
5832 @RefTeX{} now finally does not fontify temporary files anymore.
5833 @end itemize
5834
5835 @noindent @b{Version 3.17}
5836 @itemize @bullet
5837 @item
5838 Additional bindings in selection and @file{*toc*} buffers. @kbd{g}
5839 redefined.
5840 @item
5841 New command @code{reftex-save-all-document-buffers}.
5842 @item
5843 Magic word matching made more intelligent.
5844 @item
5845 Selection process can switch to completion (with @key{TAB}).
5846 @item
5847 @code{\appendix} is now recognized and influences section numbering.
5848 @item
5849 File commentary shortened considerably (use Info documentation).
5850 @item
5851 New option @code{reftex-no-include-regexps} to skip some include files.
5852 @item
5853 New option @code{reftex-revisit-to-follow}.
5854 @end itemize
5855
5856 @noindent @b{Version 3.16}
5857 @itemize @bullet
5858 @item
5859 New hooks @code{reftex-format-label-function},
5860 @code{reftex-format-ref-function}, @code{reftex-format-cite-function}.
5861 @item
5862 TeXInfo documentation completed.
5863 @item
5864 Some restrictions in Label inserting and referencing removed.
5865 @item
5866 New variable @code{reftex-default-bibliography}.
5867 @end itemize
5868
5869 @noindent @b{Version 3.14}
5870 @itemize @bullet
5871 @item
5872 Selection buffers can be kept between selections: this is faster.
5873 See new variable @code{reftex-use-multiple-selection-buffers}.
5874 @item
5875 Prefix interpretation of reftex-view-crossref changed.
5876 @item
5877 Support for the @code{varioref} package (@kbd{v} key in selection
5878 buffer).
5879 @end itemize
5880
5881 @noindent @b{Version 3.12}
5882 @itemize @bullet
5883 @item
5884 There are 3 new keymaps for customization: @code{reftex-toc-map},
5885 @code{reftex-select-label-map}, @code{reftex-select-bib-map}.
5886 @item
5887 Refontification uses more standard font-lock stuff.
5888 @item
5889 When no BibTeX database files are specified, citations can also use
5890 @code{\bibitem} entries from a @code{thebibliography} environment.
5891 @end itemize
5892
5893 @noindent @b{Version 3.11}
5894 @itemize @bullet
5895 @item
5896 Fixed bug which led to naked label in (e.g.@:) footnotes.
5897 @item
5898 Added scroll-other-window functions to RefTeX-Select.
5899 @end itemize
5900
5901 @noindent @b{Version 3.10}
5902 @itemize @bullet
5903 @item
5904 Fixed a bug which made reftex 3.07 fail on [X]Emacs version 19.
5905 @item
5906 Removed unimportant code which caused OS/2 Emacs to crash.
5907 @item
5908 All customization variables now accessible from menu.
5909 @end itemize
5910
5911 @noindent @b{Version 3.07}
5912 @itemize @bullet
5913 @item
5914 @code{Ref} menu improved.
5915 @end itemize
5916
5917 @noindent @b{Version 3.05}
5918 @itemize @bullet
5919 @item
5920 Compatibility code now first checks for XEmacs feature.
5921 @end itemize
5922
5923 @noindent @b{Version 3.04}
5924 @itemize @bullet
5925 @item
5926 Fixed BUG in the @emph{xr} support.
5927 @end itemize
5928
5929 @noindent @b{Version 3.03}
5930 @itemize @bullet
5931 @item
5932 Support for the LaTeX package @code{xr}, for inter-document
5933 references.
5934 @item
5935 A few (minor) Mule-related changes.
5936 @item
5937 Fixed bug which could cause @emph{huge} @file{.rel} files.
5938 @item
5939 Search for input and @file{.bib} files with recursive path definitions.
5940 @end itemize
5941
5942 @noindent @b{Version 3.00}
5943 @itemize @bullet
5944 @item
5945 @RefTeX{} should work better for very large projects:
5946 @item
5947 The new parser works without creating a master buffer.
5948 @item
5949 Rescanning can be limited to a part of a multifile document.
5950 @item
5951 Information from the parser can be stored in a file.
5952 @item
5953 @RefTeX{} can deal with macros having a naked label as an argument.
5954 @item
5955 Macros may have white space and newlines between arguments.
5956 @item
5957 Multiple identical section headings no longer confuse
5958 @code{reftex-toc}.
5959 @item
5960 @RefTeX{} should work correctly in combination with buffer-altering
5961 packages like outline, folding, x-symbol, iso-cvt, isotex, etc.
5962 @item
5963 All labeled environments discussed in @emph{The LaTeX Companion} by
5964 Goossens, Mittelbach & Samarin, Addison-Wesley 1994) are part of
5965 @RefTeX{}'s defaults.
5966 @end itemize
5967
5968 @noindent @b{Version 2.17}
5969 @itemize @bullet
5970 @item
5971 Label prefix expands % escapes with current file name and other stuff.
5972 @item
5973 Citation format now with % escapes. This is not backward
5974 compatible!
5975 @item
5976 TEXINPUTS variable recognized when looking for input files.
5977 @item
5978 Context can be the nth argument of a macro.
5979 @item
5980 Searching in the select buffer is now possible (@kbd{C-s} and
5981 @kbd{C-r}).
5982 @item
5983 Display and derive-label can use two different context methods.
5984 @item
5985 AMSmath @code{xalignat} and @code{xxalignat} added.
5986 @end itemize
5987
5988 @noindent @b{Version 2.14}
5989 @itemize @bullet
5990 @item
5991 Variable @code{reftex-plug-into-AUCTeX} simplifies cooperation with
5992 AUCTeX.
5993 @end itemize
5994
5995 @noindent @b{Version 2.11}
5996 @itemize @bullet
5997 @item
5998 Submitted for inclusion to Emacs and XEmacs.
5999 @end itemize
6000
6001 @noindent @b{Version 2.07}
6002 @itemize @bullet
6003 @item
6004 New functions @code{reftex-search-document},
6005 @code{reftex-query-replace-document}.
6006 @end itemize
6007
6008 @noindent @b{Version 2.05}
6009 @itemize @bullet
6010 @item
6011 Support for @file{custom.el}.
6012 @item
6013 New function @code{reftex-grep-document} (thanks to Stephen Eglen).
6014 @end itemize
6015
6016 @noindent @b{Version 2.03}
6017 @itemize @bullet
6018 @item
6019 @code{figure*}, @code{table*}, @code{sidewaysfigure/table} added to
6020 default environments.
6021 @item
6022 @code{reftex-bibfile-ignore-list} introduced (thanks to Rory Molinari).
6023 @item
6024 New functions @code{reftex-arg-label}, @code{reftex-arg-ref},
6025 @code{reftex-arg-cite}.
6026 @item
6027 Emacs/XEmacs compatibility reworked. XEmacs 19.15 now is
6028 required.
6029 @item
6030 @code{reftex-add-to-label-alist} (to be called from AUCTeX style
6031 files).
6032 @item
6033 Finding context with a hook function.
6034 @item
6035 Sorting BibTeX entries (new variable:
6036 @code{reftex-sort-bibtex-matches}).
6037 @end itemize
6038
6039 @noindent @b{Version 2.00}
6040 @itemize @bullet
6041 @item
6042 Labels can be derived from context (default for sections).
6043 @item
6044 Configuration of label insertion and label referencing revised.
6045 @item
6046 Crossref fields in BibTeX database entries.
6047 @item
6048 @code{reftex-toc} introduced (thanks to Stephen Eglen).
6049 @end itemize
6050
6051 @noindent @b{Version 1.09}
6052 @itemize @bullet
6053 @item
6054 Support for @code{tex-main-file}, an analogue for
6055 @code{TeX-master}.
6056 @item
6057 MS-DOS support.
6058 @end itemize
6059
6060 @noindent @b{Version 1.07}
6061 @itemize @bullet
6062 @item
6063 @RefTeX{} gets its own menu.
6064 @end itemize
6065
6066 @noindent @b{Version 1.05}
6067 @itemize @bullet
6068 @item
6069 XEmacs port.
6070 @end itemize
6071
6072 @noindent @b{Version 1.04}
6073 @itemize @bullet
6074 @item
6075 Macros as wrappers, AMSTeX support, delayed context parsing for
6076 new labels.
6077 @end itemize
6078 @end ignore
6079
6080 @noindent @b{Version 1.00}
6081 @itemize @bullet
6082 @item
6083 released on 7 Jan 1997.
6084 @end itemize
6085
6086 @node GNU Free Documentation License
6087 @appendix GNU Free Documentation License
6088 @include doclicense.texi
6089
6090 @node Index
6091 @unnumbered Index
6092 @printindex cp
6093
6094 @bye