1;;; reftex-vars.el --- configuration variables for RefTeX
2
3;; Copyright (C) 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
4;;   2006, 2007 Free Software Foundation, Inc.
5
6;; Author: Carsten Dominik <dominik@science.uva.nl>
7;; Maintainer: auctex-devel@gnu.org
8;; Version: 4.31
9
10;; This file is part of GNU Emacs.
11
12;; GNU Emacs is free software; you can redistribute it and/or modify
13;; it under the terms of the GNU General Public License as published by
14;; the Free Software Foundation; either version 2, or (at your option)
15;; any later version.
16
17;; GNU Emacs is distributed in the hope that it will be useful,
18;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE   See the
20;; GNU General Public License for more details.
21
22;; You should have received a copy of the GNU General Public License
23;; along with GNU Emacs; see the file COPYING  If not, write to the
24;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25;; Boston, MA 02110-1301, USA.
26
27;;; Commentary:
28
29;;; Code:
30(eval-when-compile (defvar reftex-tables-dirty))
31(eval-when-compile (require 'cl))
32(eval-and-compile
33  (defun reftex-set-dirty (symbol value)
34    (setq reftex-tables-dirty t)
35    (set symbol value)))
36
37;; Define the two constants which are needed during compilation
38
39(eval-and-compile
40(defconst reftex-label-alist-builtin
41  '(
42    ;; Some aliases, mostly for backward compatibility
43    (Sideways    "Alias for -->rotating" (rotating))
44    (AMSTeX      "amsmath with eqref macro"
45                 ((nil ?e nil "~\\eqref{%s}")
46                  amsmath))
47
48    ;; Individual package defaults
49    (amsmath "AMS-LaTeX math environments"
50     (("align"        ?e nil nil eqnarray-like)
51      ("gather"       ?e nil nil eqnarray-like)
52      ("multline"     ?e nil nil t)
53      ("flalign"      ?e nil nil eqnarray-like)
54      ("alignat"      ?e nil nil alignat-like)
55      ("xalignat"     ?e nil nil alignat-like)
56      ("xxalignat"    ?e nil nil alignat-like)
57      ("subequations" ?e nil nil t)))
58
59    (endnotes "The \\endnote macro"
60     (("\\endnote[]{}" ?N "en:" "~\\ref{%s}" 2
61       (regexp "endnotes?" "notes?" "Anmerkung\\(en\\)?" "Anm\\."))))
62
63    (fancybox "The Beqnarray environment"
64     (("Beqnarray" ?e nil nil eqnarray-like)))
65
66    (floatfig "The floatingfigure environment"
67     (("floatingfigure" ?f nil nil caption)))
68
69    (longtable   "The longtable environment"
70     (("longtable"  ?t nil nil caption)))
71
72    (picinpar    "The figwindow and tabwindow environments"
73     (("figwindow" ?f nil nil 1)
74      ("tabwindow" ?f nil nil 1)))
75
76    (rotating    "Sidewaysfigure and table"
77     (("sidewaysfigure" ?f nil nil caption)
78      ("sidewaystable"  ?t nil nil caption)))
79
80    (sidecap      "CSfigure and SCtable"
81     (("SCfigure"       ?f nil nil caption)
82      ("SCtable"        ?t nil nil caption)))
83
84    (subfigure   "Subfigure environments/macro"
85     (("subfigure"   ?f nil nil caption)
86      ("subfigure*"  ?f nil nil caption)
87      ("\\subfigure[]{}" ?f nil nil 1)))
88
89    (supertab    "Supertabular environment"
90     (("supertabular" ?t nil nil "\\tablecaption{")))
91
92    (wrapfig     "The wrapfigure environment"
93     (("wrapfigure" ?f nil nil caption)))
94
95    ;; The LaTeX core stuff
96    (LaTeX       "LaTeX default environments"
97     (("section"   ?s "%S" "~\\ref{%s}" (nil . t)
98       (regexp "parts?" "chapters?" "chap\\." "sections?" "sect?\\."
99               "paragraphs?" "par\\."
100               "\\\\S" "\247" "Teile?" "Kapitel" "Kap\\." "Abschnitte?"
101               "appendi\\(x\\|ces\\)" "App\\."  "Anh\"?ange?" "Anh\\."))
102
103      ("enumerate" ?i "item:" "~\\ref{%s}" item
104       (regexp "items?" "Punkte?"))
105
106      ("equation"  ?e "eq:" "~(\\ref{%s})" t
107       (regexp "equations?" "eqs?\\." "eqn\\." "Gleichung\\(en\\)?"  "Gl\\."))
108      ("eqnarray"  ?e "eq:" nil eqnarray-like)
109
110      ("figure"    ?f "fig:" "~\\ref{%s}" caption
111       (regexp "figure?[sn]?" "figs?\\." "Abbildung\\(en\\)?" "Abb\\."))
112      ("figure*"   ?f nil nil caption)
113
114      ("table"     ?t "tab:" "~\\ref{%s}" caption
115       (regexp "tables?" "tab\\." "Tabellen?"))
116      ("table*"    ?t nil nil caption)
117
118      ("\\footnote[]{}" ?n "fn:" "~\\ref{%s}" 2
119       (regexp "footnotes?" "Fussnoten?"))
120
121      ("any"       ?\  " "   "~\\ref{%s}" nil)
122
123      ;; The label macro is hard coded, but it *could* be defined like this:
124      ;;("\\label{*}" nil nil nil nil)
125      ))
126
127    )
128  "The default label environment descriptions.
129Lower-case symbols correspond to a style file of the same name in the LaTeX
130distribution.  Mixed-case symbols are convenience aliases.")
131
132(defconst reftex-cite-format-builtin
133  '((default "Default macro \\cite{%l}"
134      "\\cite[]{%l}")
135    (natbib "The Natbib package"
136     ((?\C-m . "\\cite[][]{%l}")
137      (?t    . "\\citet[][]{%l}")
138      (?T    . "\\citet*[][]{%l}")
139      (?p    . "\\citep[][]{%l}")
140      (?P    . "\\citep*[][]{%l}")
141      (?e    . "\\citep[e.g.][]{%l}")
142      (?s    . "\\citep[see][]{%l}")
143      (?a    . "\\citeauthor{%l}")
144      (?A    . "\\citeauthor*{%l}")
145      (?y    . "\\citeyear{%l}")
146      (?n    . "\\nocite{%l}")))
147    (amsrefs "The AMSRefs package"
148     ((?\C-m . "\\cite{%l}")
149      (?p    . "\\cite{%l}")
150      (?P    . "\\cites{%l}")
151      (?t    . "\\ocite{%l}")
152      (?T    . "\\ocites{%l}")
153      (?y    . "\\ycite{%l}")
154      (?Y    . "\\ycites{%l}")
155      (?a    . "\\citeauthor{%l}")
156      (?A    . "\\citeauthory{%l}")
157      (?f    . "\\fullcite{%l}")
158      (?F    . "\\fullocite{%l}")
159      (?n    . "\\nocite{%l}")))
160    (jurabib "The Jurabib package"
161     ((?\C-m . "\\cite{%l}")
162      (?c    . "\\cite[][]{%l}")
163      (?t    . "\\citet{%l}")
164      (?p    . "\\citep{%l}")
165      (?e    . "\\citep[e.g.][]{%l}")
166      (?s    . "\\citep[see][]{%l}")
167      (?u    . "\\fullcite{%l}")
168      (?i    . "\\citetitle{%l}")
169      (?a    . "\\citeauthor{%l}")
170      (?e    . "\\citefield{}{%l}")
171      (?y    . "\\citeyear{%l}")
172      (?f    . "\\footcite{%l}")
173      (?F    . "\\footcite[][]{%l}")
174      (?l    . "\\footfullcite{%l}")))
175    (bibentry "The Bibentry package"
176      "\\bibentry{%l}")
177    (harvard "The Harvard package"
178     ((?\C-m . "\\cite[]{%l}")
179      (?p    . "\\cite[]{%l}")
180      (?t    . "\\citeasnoun{%l}")
181      (?n    . "\\citeasnoun{%l}")
182      (?s    . "\\possessivecite{%l}")
183      (?e    . "\\citeaffixed{%l}{?}")
184      (?y    . "\\citeyear{%l}")
185      (?a    . "\\citename{%l}")))
186    (chicago "The Chicago package"
187     ((?\C-m . "\\cite[]{%l}")
188      (?t    . "\\citeN[]{%l}")
189      (?T    . "\\shortciteN{%l}")
190      (?p    . "\\cite[]{%l}")
191      (?P    . "\\shortcite{%l}")
192      (?a    . "\\citeA{%l}")
193      (?A    . "\\shortciteA{%l}")
194      (?y    . "\\citeyear{%l}")))
195    (astron "The Astron package"
196     ((?\C-m . "\\cite[]{%l}")
197      (?p    . "\\cite[]{%l}" )
198      (?t    . "%2a (\\cite{%l})")))
199    (author-year "Do-it-yourself Author-year"
200     ((?\C-m . "\\cite{%l}")
201      (?t    . "%2a (%y)\\nocite{%l}")
202      (?p    . "(%2a %y\\nocite{%l})")))
203    (locally     "Full info in parenthesis"
204     "(%2a %y, %j %v, %P, %e: %b, %u, %s %<)")
205    )
206  "Builtin versions of the citation format.
207The following conventions are valid for all alist entries:
208`?\C-m' should always point to a straight \\cite{%l} macro.
209`?t'    should point to a textual citation (citation as a noun).
210`?p'    should point to a parenthetical citation.")
211
212(defconst reftex-index-macros-builtin
213  '((default "Default \\index and \\glossary macros"
214      (("\\index{*}" "idx" ?i "" nil t)
215       ("\\glossary{*}" "glo" ?g "" nil t)))
216    (multind "The multind.sty package"
217       (("\\index{}{*}" 1 ?i "" nil t)))
218    (index "The index.sty package"
219           (("\\index[]{*}" 1 ?i "" nil t)
220            ("\\index*[]{*}" 1 ?I "" nil nil)))
221    (Index-Shortcut "index.sty with \\shortindexingon"
222       (("\\index[]{*}" 1 ?i "" nil t)
223        ("\\index*[]{*}" 1 ?I "" nil nil)
224        ("^[]{*}" 1 ?^ "" texmathp t)
225        ("_[]{*}" 1 ?_ "" texmathp nil))))
226  "Builtin stuff for reftex-index-macros.
227Lower-case symbols correspond to a style file of the same name in the LaTeX
228distribution.  Mixed-case symbols are convenience aliases.")
229)
230
231;; Configuration Variables and User Options for RefTeX ------------------
232
233(defgroup reftex nil
234  "LaTeX label and citation support."
235  :tag "RefTeX"
236  :link '(url-link :tag "Home Page"
237                   "http://staff.science.uva.nl/~dominik/Tools/reftex/")
238  :link '(emacs-commentary-link :tag "Commentary in reftex.el" "reftex.el")
239  :link '(custom-manual "(reftex)Top")
240  :prefix "reftex-"
241  :group 'tex)
242
243
244;; Table of contents configuration --------------------------------------
245
246(defgroup reftex-table-of-contents-browser nil
247  "A multifile table of contents browser."
248  :group 'reftex)
249
250(defcustom reftex-include-file-commands '("include" "input")
251  "LaTeX commands which input another file.
252The file name is expected after the command, either in braces or separated
253by whitespace."
254  :group 'reftex-table-of-contents-browser
255  :type '(repeat string))
256
257(defcustom reftex-max-section-depth 12
258  "Maximum depth of section levels in document structure.
259Standard LaTeX needs default is 7, but there are packages for which this
260needs to be larger."
261  :group 'reftex-table-of-contents-browser
262  :type 'integer)
263
264;; LaTeX section commands and level numbers
265(defcustom reftex-section-levels
266  '(
267    ("part"            .  0)
268    ("chapter"         .  1)
269    ("section"         .  2)
270    ("subsection"      .  3)
271    ("subsubsection"   .  4)
272    ("paragraph"       .  5)
273    ("subparagraph"    .  6)
274    ("addchap"         . -1) ; KOMA-Script
275    ("addsec"          . -2) ; KOMA-Script
276;;; ("minisec"         . -7) ; KOMA-Script
277    )
278  "Commands and levels used for defining sections in the document.
279This is an alist with each element like (COMMAND-NAME . LEVEL).
280The car of each cons cell is the name of the section macro (without
281the backslash).  The cdr is a number indicating its level.  A negative
282level means the same level as the positive value, but the section will
283never get a number.  The cdr may also be a function which will be called
284to after the section-re matched to determine the level.
285This list is also used for promotion and demption of sectioning commands.
286If you are using a document class which has several sets of sectioning
287commands, promotion only works correctly if this list is sorted first
288by set, then within each set by level.  The promotion commands always
289select the nearest entry with the correct new level."
290  :group 'reftex-table-of-contents-browser
291  :set 'reftex-set-dirty
292  :type '(repeat
293          (cons (string :tag "sectioning macro" "")
294                (choice
295                 (number :tag "level           " 0)
296                 (symbol :tag "function        " my-level-func)))))
297
298(defcustom reftex-toc-max-level 100
299  "*The maximum level of toc entries which will be included in the TOC.
300Section headings with a bigger level will be ignored.  In RefTeX, chapters
301are level 1, sections are level 2 etc.
302This variable can be changed from within the *toc* buffer with the `t' key."
303  :group 'reftex-table-of-contents-browser
304  :type 'integer)
305
306(defcustom reftex-part-resets-chapter nil
307  "*Non-nil means, \\part is like any other sectioning command.
308This means, part numbers will be included in the numbering of chapters, and
309chapter counters will be reset for each part.
310When nil (the default), parts are special, do not reset the chapter counter
311and also do not show up in chapter numbers."
312  :group 'reftex-table-of-contents-browser
313  :type 'boolean)
314
315
316(defcustom reftex-auto-recenter-toc 'frame
317  "*Non-nil means, turn automatic recentering of *TOC* window on.
318When active, the *TOC* window will always show the section you
319are currently working in.  Recentering happens whenever Emacs is idle for
320more than `reftex-idle-time' seconds.
321
322Value t means, turn on immediately when RefTeX gets started.  Then,
323recentering will work for any toc window created during the session.
324
325Value 'frame (the default) means, turn automatic recentering on only while the
326dedicated TOC frame does exist, and do the recentering only in that frame.  So
327when creating that frame (with \"d\" key in an ordinary TOC window), the
328automatic recentering is turned on.  When the frame gets destroyed, automatic
329recentering is turned off again.
330
331This feature can be turned on and off from the menu
332\(Ref->Options)."
333  :group 'reftex-table-of-contents-browser
334  :type '(choice
335          (const :tag "never" nil)
336          (const :tag "always" t)
337          (const :tag "in dedicated frame only" frame)))
338
339(defcustom reftex-toc-split-windows-horizontally nil
340  "*Non-nil means, create TOC window by splitting window horizontally."
341  :group 'reftex-table-of-contents-browser
342  :type 'boolean)
343
344(defcustom reftex-toc-split-windows-fraction .3
345  "*Fraction of the width or height of the frame to be used for TOC window.
346See also `reftex-toc-split-windows-horizontally'."
347  :group 'reftex-table-of-contents-browser
348  :type 'number)
349
350(defvar reftex-toc-split-windows-horizontally-fraction 0.5
351  "This variable is obsolete, use `reftex-toc-split-windows-fraction' instead.")
352
353(defcustom reftex-toc-keep-other-windows t
354  "*Non-nil means, split the selected window to display the *toc* buffer.
355This helps to keep the window configuration, but makes the *toc* small.
356When nil, all other windows except the selected one will be deleted, so
357that the *toc* window fills half the frame."
358  :group 'reftex-table-of-contents-browser
359  :type 'boolean)
360
361(defcustom reftex-toc-include-file-boundaries nil
362  "*Non-nil means, include file boundaries in *toc* buffer.
363This flag can be toggled from within the *toc* buffer with the `F' key."
364  :group 'reftex-table-of-contents-browser
365  :type 'boolean)
366
367(defcustom reftex-toc-include-labels nil
368  "*Non-nil means, include labels in *toc* buffer.
369This flag can be toggled from within the *toc* buffer with the `l' key."
370  :group 'reftex-table-of-contents-browser
371  :type 'boolean)
372
373(defcustom reftex-toc-include-index-entries nil
374  "*Non-nil means, include index entries in *toc* buffer.
375This flag can be toggled from within the *toc* buffer with the `i' key."
376  :group 'reftex-table-of-contents-browser
377  :type 'boolean)
378
379(defcustom reftex-toc-confirm-promotion 2
380  "*Non-nil means, promotion/demotion commands first prompt for confirmation.
381When nil, the command is executed immediately.  When this is an integer
382N, ask for confirmation only if N or more section commands are going to be
383changed."
384  :group 'reftex-table-of-contents-browser
385  :type '(choice
386          (const  :tag "Never" nil)
387          (const  :tag "Always" t)
388          (number :tag "When more than N sections" :value 2)))
389
390(defcustom reftex-toc-include-context nil
391  "*Non-nil means, include context with labels in the *toc* buffer.
392Context will only be shown when labels are visible as well.
393This flag can be toggled from within the *toc* buffer with the `c' key."
394  :group 'reftex-table-of-contents-browser
395  :type 'boolean)
396
397(defcustom reftex-toc-follow-mode nil
398  "*Non-nil means, point in *toc* buffer will cause other window to follow.
399The other window will show the corresponding part of the document.
400This flag can be toggled from within the *toc* buffer with the `f' key."
401  :group 'reftex-table-of-contents-browser
402  :type 'boolean)
403
404(defcustom reftex-revisit-to-follow nil
405  "*Non-nil means, follow-mode will revisit files if necessary.
406When nil, follow-mode will be suspended for stuff in unvisited files."
407  :group 'reftex-table-of-contents-browser
408  :group 'reftex-referencing-labels
409  :type 'boolean)
410
411(defcustom reftex-toc-mode-hook nil
412  "Mode hook for reftex-toc-mode."
413  :group 'reftex-table-of-contents-browser
414  :type 'hook)
415
416;; Label Support Configuration
417
418(defgroup reftex-label-support nil
419  "Support for creation, insertion and referencing of labels in LaTeX."
420  :group 'reftex)
421
422(defgroup reftex-defining-label-environments nil
423  "Definition of environments and macros to do with label."
424  :group 'reftex-label-support)
425
426(defcustom reftex-default-label-alist-entries
427  '(amsmath endnotes fancybox floatfig longtable picinpar
428            rotating sidecap subfigure supertab wrapfig LaTeX)
429  "Default label alist specifications.  LaTeX should always be the last entry.
430The value of this variable is a list of symbols with associations in the
431constant `reftex-label-alist-builtin'.  Check that constant for a full list
432of options."
433  :group 'reftex-defining-label-environments
434  :set   'reftex-set-dirty
435  :type `(set
436          :indent 4
437          :inline t
438          :greedy t
439          ,@(mapcar
440             (lambda (x)
441               (list 'const :tag (concat (symbol-name (nth 0 x))
442                                         ": " (nth 1 x))
443                     (nth 0 x)))
444             reftex-label-alist-builtin)))
445
446(defcustom reftex-label-alist nil
447  "Alist with information on environments for \\label-\\ref use.
448
449This docstring is easier to understand after reading the configuration
450examples in `reftex.el'.  Looking at the builtin defaults in the constant
451`reftex-label-alist-builtin' may also be instructive.
452
453Set this variable to define additions and changes to the default.  The only
454things you MUST NOT change is that `?s' is the type indicator for section
455labels, and SPC for the `any' label type.  These are hard-coded at other
456places in the code.
457
458The value of the variable must be a list of items.  Each item is a list
459itself and has the following structure:
460
461 (ENV-OR-MACRO TYPE-KEY LABEL-PREFIX REFERENCE-FORMAT CONTEXT-METHOD
462           (MAGIC-WORD ... ) TOC-LEVEL)
463
464Each list entry describes either an environment carrying a counter for use
465with \\label and \\ref, or a LaTeX macro defining a label as (or inside)
466one of its arguments.  The elements of each list entry are:
467
468ENV-OR-MACRO
469    Name of the environment (like \"table\") or macro (like \"\\\\myfig\").
470    For macros, indicate the macro arguments for best results, as in
471    \"\\\\myfig[]{}{}{*}{}\".  Use square brackets for optional arguments,
472    a star to mark the label argument, if any.  The macro does not have to
473    have a label argument - you could also use \\label{..} inside one of
474    its arguments.
475    Special names: `section' for section labels, `any' to define a group
476    which contains all labels.
477
478    This may also be a function to do local parsing and identify point
479    to be in a non-standard label environment.  The function must take
480    an argument BOUND and limit backward searches to this value.  It
481    should return either nil or a cons cell (FUNCTION . POSITION) with
482    the function symbol and the position where the special environment
483    starts.  See the Info documentation for an example.
484
485    Finally this may also be nil if the entry is only meant to change
486    some settings associated with the type indicator character (see below).
487
488TYPE-KEY
489    Type indicator character, like `?t', must be a printable ASCII character.
490    The type indicator is a single character which defines a label type.
491    Any label inside the environment or macro is assumed to belong to this
492    type.  The same character may occur several times in this list, to cover
493    cases in which different environments carry the same label type (like
494    `equation' and `eqnarray').
495    If the type indicator is nil and the macro has a label argument {*},
496    the macro defines neutral labels just like \\label.  In this case
497    the reminder of this entry is ignored.
498
499LABEL-PREFIX
500    Label prefix string, like \"tab:\".
501    The prefix is a short string used as the start of a label.  It may be the
502    empty string.  The prefix may contain the following `%' escapes:
503       %f   Current file name with directory and extension stripped.
504       %F   Current file name relative to directory of master file.
505       %m   Master file name, directory and extension stripped.
506       %M   Directory name (without path) where master file is located.
507       %u   User login name, on systems which support this.
508       %S   A section prefix derived with variable `reftex-section-prefixes'.
509
510    Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\").
511
512REFERENCE-FORMAT
513    Format string for reference insert in buffer.  `%s' will be replaced by
514    the label.
515    When the format starts with `~', the `~' will only be inserted if
516    there is not already a whitespace before point.
517
518CONTEXT-METHOD
519    Indication on how to find the short context.
520    - If nil, use the text following the \\label{...} macro.
521    - If t, use
522       - the section heading for section labels.
523       - text following the \\begin{...} statement of environments.
524         (not a good choice for environments like eqnarray or enumerate,
525         where one has several labels in a single environment).
526       - text after the macro name (starting with the first arg) for macros.
527    - If an integer, use the nth argument of the macro.  As a special case,
528      1000 means to get text after the last macro argument.
529    - If a string, use as regexp to search *backward* from the label.  Context
530      is then the text following the end of the match.  E.g. putting this to
531      \"\\\\\\\\caption[[{]\" will use the caption in a figure or table
532      environment.
533      \"\\\\\\\\begin{eqnarray}\\\\|\\\\\\\\\\\\\\\\\" works for eqnarrays.
534    - If any of `caption', `item', `eqnarray-like', `alignat-like', this
535      symbol will internally be translated into an appropriate regexp
536      (see also the variable `reftex-default-context-regexps').
537    - If a function, call this function with the name of the environment/macro
538      as argument.  On call, point will be just after the \\label macro.  The
539      function is expected to return a suitable context string.  It should
540      throw an exception (error) when failing to find context.
541      As an example, here is a function returning the 10 chars following
542      the label macro as context:
543
544        (defun my-context-function (env-or-mac)
545          (if (> (point-max) (+ 10 (point)))
546              (buffer-substring (point) (+ 10 (point)))
547            (error \"Buffer too small\")))
548
549    Label context is used in two ways by RefTeX: For display in the label
550    menu, and to derive a label string.  If you want to use a different
551    method for each of these, specify them as a dotted pair.
552    E.g. `(nil . t)' uses the text after the label (nil) for display, and
553    text from the default position (t) to derive a label string.  This is
554    actually used for section labels.
555
556MAGIC-WORDS
557    List of magic words which identify a reference to be of this type.
558    If the word before point is equal to one of these words when calling
559    `reftex-reference', the label list offered will be automatically
560    restricted to labels of the correct type.
561    If the first element of this wordlist is the symbol `regexp', the
562    strings are interpreted as regular expressions.  RefTeX will add
563    a \"\\\\W\" to the beginning and other stuff to the end of the regexp.
564
565TOC-LEVEL
566    The integer level at which this environment should be added to the
567    table of contents.  See also `reftex-section-levels'.  A positive
568    value will number the entries mixed with the sectioning commands of
569    the same level.  A negative value will make unnumbered entries.
570    Useful only for theorem-like environments, will be ignored for macros.
571    When omitted or nil, no TOC entries will be made.
572
573If the type indicator characters of two or more entries are the same, RefTeX
574will use
575 - the first non-nil format and prefix
576 - the magic words of all involved entries.
577
578Any list entry may also be a symbol.  If that has an association in
579`reftex-label-alist-builtin', the cddr of that association is spliced into the
580list.  However, builtin defaults should normally be set with the variable
581`reftex-default-label-alist-entries."
582  :group 'reftex-defining-label-environments
583  :set 'reftex-set-dirty
584  :type
585  `(repeat
586    (choice :tag "Package or Detailed   "
587     :value ("" ?a nil nil nil nil)
588     (list :tag "Detailed Entry"
589           :value ("" ?a nil nil nil nil)
590           (choice    :tag "Environment or \\macro "
591                      (const  :tag "Ignore, just use typekey" nil)
592                      (string "")
593                      (symbol :tag "Special parser" my-parser))
594           (choice    :tag "Type specification    "
595                      (const :tag "unspecified, like in \\label" nil)
596                      (character :tag "Char  " ?a))
597           (choice    :tag "Label prefix string   "
598                      (const  :tag "Default" nil)
599                      (string :tag "String" "lab:"))
600           (choice    :tag "Label reference format"
601                      (const  :tag "Default" nil)
602                      (string :tag "String" "~\\ref{%s}"))
603           (choice    :tag "Context method        "
604                      (const  :tag "Default position" t)
605                      (const  :tag "After label"      nil)
606                      (number :tag "Macro arg nr" 1)
607                      (regexp :tag "Regexp" "")
608                      (const  :tag "Caption in float" caption)
609                      (const  :tag "Item in list" item)
610                      (const  :tag "Eqnarray-like" eqnarray-like)
611                      (const  :tag "Alignat-like" alignat-like)
612                      (symbol :tag "Function" my-func))
613           (repeat :tag "Magic words" :extra-offset 2 (string))
614           (option (choice :tag "Make TOC entry     "
615                           (const :tag "No entry" nil)
616                           (integer :tag "Level" :value -3))))
617     (choice
618      :tag "Package"
619      :value AMSTeX
620      ,@(mapcar
621         (lambda (x)
622           (list 'const :tag (concat (symbol-name (nth 0 x)))
623                 (nth 0 x)))
624         reftex-label-alist-builtin)))))
625
626(defcustom reftex-section-prefixes '((0 . "part:") (1 . "cha:") (t . "sec:"))
627  "Prefixes for section labels.
628When the label prefix given in an entry in `reftex-label-alist' contains `%S',
629this list is used to determine the correct prefix string depending on the
630current section level.
631The list is an alist, with each entry of the form (KEY . PREFIX)
632Possible keys are sectioning macro names like `chapter', section levels
633\(as given in `reftex-section-levels'), and t for the default."
634  :group 'reftex-defining-label-environments
635  :type '(repeat
636          (cons :value (0 . "")
637                (choice
638                 (string :tag  "macro name")
639                 (integer :tag "section level")
640                 (const :tag "default" t))
641                (string :tag "Prefix"))))
642
643(defcustom reftex-default-context-regexps
644  '((caption       . "\\\\\\(rot\\)?caption\\*?[[{]")
645    (item          . "\\\\item\\(\\[[^]]*\\]\\)?")
646    (eqnarray-like . "\\\\begin{%s}\\|\\\\\\\\")
647    (alignat-like  . "\\\\begin{%s}{[0-9]*}\\|\\\\\\\\"))
648"Alist with default regular expressions for finding context.
649The form (format regexp (regexp-quote environment)) is used to calculate
650the final regular expression - so %s will be replaced with the environment
651or macro."
652  :group 'reftex-defining-label-environments
653  :type '(repeat (cons (symbol) (regexp))))
654
655(defcustom reftex-trust-label-prefix nil
656  "Non-nil means, trust the label prefix when determining label type.
657It is customary to use special label prefixes to distinguish different label
658types.  The label prefixes have no syntactic meaning in LaTeX (unless
659special packages like fancyref are being used).  RefTeX can and by
660default does parse around each label to detect the correct label type,
661but this process can be slow when a document contains thousands of
662labels.  If you use label prefixes consistently, you may speed up
663document parsing by setting this variable to a non-nil value.  RefTeX
664will then compare the label prefix with the prefixes found in
665`reftex-label-alist' and derive the correct label type in this way.
666Possible values for this option are:
667
668t          This means to trust any label prefixes found.
669regexp     If a regexp, only prefixes matched by the regexp are trusted.
670list       List of accepted prefixes, as strings.  The colon is part of
671           the prefix, e.g. (\"fn:\" \"eqn:\" \"item:\").
672nil        Never trust a label prefix.
673
674The only disadvantage of using this feature is that the label context
675displayed in the label selection buffer along with each label is
676simply some text after the label definition.  This is no problem if you
677place labels keeping this in mind (e.g. *before* the equation, *at
678the beginning* of a fig/tab caption ...).  Anyway, it is probably best
679to use the regexp or the list value types to fine-tune this feature.
680For example, if your document contains thousands of footnotes with
681labels fn:xxx, you may want to set this variable to the value \"^fn:$\" or
682\(\"fn:\").  Then RefTeX will still do extensive parsing for any
683non-footnote labels."
684  :group 'reftex-defining-label-environments
685  :type '(choice
686          (const :tag "Always" t)
687          (const :tag "Never" nil)
688          (regexp)
689          (repeat :tag "List"
690                  (string :tag "prefix (with colon)"))))
691
692(defcustom reftex-special-environment-functions nil
693  "List of functions to be called when trying to figure out current environment.
694These are special functions to detect \"environments\" which do not
695start with \\begin and end with \\end.  Some LaTeX packages seem to
696use such non-standard ways to set up environment-like constructs.  The
697purpose of each function in this list is to detect if point is
698currently inside such a special \"environment\".  If the environment
699carries a label, you must also set up an entry for it in
700`reftex-label-alist'.
701
702The function should check if point is currently in the special
703environment it was written to detect.  If so, the function must return
704a cons cell (NAME . POSITION).  NAME is the name of the environment
705detected and POSITION is the buffer position where the environment
706starts.  The function must return nil on failure to detect the
707environment.
708
709The function must take an argument BOUND.  If non-nil, BOUND is a
710boundary for backwards searches which should be observed.
711
712Here is an example.  The LaTeX package linguex.sty defines list macros
713`\\ex.', `\\a.', etc for lists which are terminated by `\\z.' or an empty
714line.
715
716    \\ex.  \\label{ex:12} Some text in an exotic language ...
717          \\a. \\label{ex:13} more stuff
718          \\b. \\label{ex:14} still more stuff
719
720    ... more text after the empty line terminating all lists
721
722And here is the setup for RefTeX:
723
7241. Define a dummy environment for this in `reftex-label-alist'.  Dummy means,
725   make up an environment name even though it is not used with \\begin and
726   \\end.  Here we use \"linguex\" as this name.
727
728   (setq reftex-label-alist
729         '((\"linguex\" ?x \"ex:\" \"~\\\\ref{%s}\" nil (\"Example\" \"Ex.\"))))
730
7312. Write a function to detect the list macros and the determinators as well.
732
733   (defun my-detect-linguex-list (bound)
734     (let ((pos (point)) p1)
735       (save-excursion
736         ;; Search for any of the linguex item macros at the beginning of a line
737         (if (re-search-backward
738              \"^[ \\t]*\\\\(\\\\\\\\\\\\(ex\\\\|a\\\\|b\\\\|c\\\\|d\\\\|e\\\\|f\\\\)g?\\\\.\\\\)\" bound t)
739             (progn
740               (setq p1 (match-beginning 1))
741               ;; Make sure no empty line or \\z. is between us and the item macro
742               (if (re-search-forward \"\\n[ \\t]*\\n\\\\|\\\\\\\\z\\\\.\" pos t)
743                   ;; Return nil because list was already closed
744                   nil
745                 ;; OK, we got it
746                 (cons \"linguex\" p1)))
747           ;; Return nil for not found
748           nil))))
749
7503. Tell RefTeX to use this function
751
752   (setq reftex-special-environment-functions '(my-detect-linguex-list))
753"
754  :group 'reftex-defining-label-environments
755  :type 'hook)
756
757;; Label insertion
758
759(defgroup reftex-making-and-inserting-labels nil
760  "Options on how to create new labels."
761  :group 'reftex-label-support)
762
763(defcustom reftex-insert-label-flags '("s" "sft")
764  "Flags governing label insertion.  First flag DERIVE, second flag PROMPT.
765
766If DERIVE is t, RefTeX will try to derive a sensible label from context.
767A section label for example will be derived from the section heading.
768The conversion of the context to a valid label is governed by the
769specifications given in `reftex-derive-label-parameters'.
770If RefTeX fails to derive a label, it will prompt the user.
771If DERIVE is nil, the label generated will consist of the prefix and a
772unique number, like `eq:23'.
773
774If PROMPT is t, the user will be prompted for a label string.  The prompt will
775already contain the prefix, and (if DERIVE is t) a default label derived from
776context.  When PROMPT is nil, the default label will be inserted without
777query.
778
779So the combination of DERIVE and PROMPT controls label insertion.  Here is a
780table describing all four possibilities:
781
782DERIVE   PROMPT      ACTION
783-------------------------------------------------------------------------
784 nil     nil     Insert simple label, like eq:22 or sec:13.  No query.
785 nil     t       Prompt for label.
786 t       nil     Derive a label from context and insert without query.
787 t       t       Derive a label from context and prompt for confirmation.
788
789Each flag may be set to t, nil, or a string of label type letters
790indicating the label types for which it should be true.  The strings work
791like character classes.
792Thus, the combination may be set differently for each label type.  The
793default settings \"s\" and \"sft\" mean: Derive section labels from headings
794\(with confirmation).  Prompt for figure and table labels.  Use simple labels
795without confirmation for everything else.
796The available label types are: s (section), f (figure), t (table), i (item),
797e (equation), n (footnote), N (endnote), plus any definitions in
798`reftex-label-alist'."
799  :group 'reftex-making-and-inserting-labels
800  :type  '(list (choice :tag "Derive label from context"
801                         (const  :tag "always" t)
802                         (const  :tag "never" nil)
803                         (string :tag "selected label types" ""))
804                (choice :tag "Prompt for label string  "
805                        :entry-format "  %b %v"
806                        (const  :tag "always" t)
807                        (const  :tag "never" nil)
808                        (string :tag "selected label types" ""))))
809
810(defcustom reftex-string-to-label-function 'reftex-string-to-label
811  "Function to turn an arbitrary string into a valid label.
812RefTeX's default function uses the variable `reftex-derive-label-parameters'."
813  :group 'reftex-making-and-inserting-labels
814  :type 'symbol)
815
816(defcustom reftex-translate-to-ascii-function 'reftex-latin1-to-ascii
817  "Filter function which will process a context string before it is used
818to derive a label from it.  The intended application is to convert ISO or
819Mule characters into something valid in labels.  The default function
820removes the accents from Latin-1 characters.  X-Symbol (>=2.6) sets this
821variable to the much more general `x-symbol-translate-to-ascii'."
822  :group 'reftex-making-and-inserting-labels
823  :type 'symbol)
824
825(defcustom reftex-derive-label-parameters '(3 20 t 1 "-"
826         ("the" "on" "in" "off" "a" "for" "by" "of" "and" "is" "to") t)
827  "Parameters for converting a string into a label.
828This variable is a list of the following items.
829
830NWORDS      Number of words to use.
831MAXCHAR     Maximum number of characters in a label string.
832INVALID     nil: Throw away any words containing characters invalid in labels.
833            t:   Throw away only the invalid characters, not the whole word.
834ABBREV      nil: Never abbreviate words.
835            t:   Always abbreviate words (see `reftex-abbrev-parameters').
836            not t and not nil: Abbreviate words if necessary to shorten
837                               label string below MAXCHAR.
838SEPARATOR   String separating different words in the label.
839IGNOREWORDS List of words which should not be part of labels.
840DOWNCASE    t:   Downcase words before using them."
841  :group 'reftex-making-and-inserting-labels
842  :type  '(list (integer :tag "Number of words            "  3)
843                (integer :tag "Maximum label length       " 20)
844                (choice  :tag "Invalid characters in words"
845                         (const :tag "throw away entire word" nil)
846                         (const :tag "throw away single chars" t))
847                (choice  :tag "Abbreviate words           "
848                         (const :tag "never" nil)
849                         (const :tag "always" t)
850                         (const :tag "when label is too long" 1))
851                (string  :tag "Separator between words    " "-")
852                (repeat  :tag "Ignore words"
853                         :entry-format "           %i %d %v"
854                         (string :tag ""))
855                (option (boolean :tag "Downcase words          "))))
856
857(defcustom reftex-label-illegal-re "[^-a-zA-Z0-9_+=:;,.]"
858  "Regexp matching characters not valid in labels."
859  :group 'reftex-making-and-inserting-labels
860  :type '(regexp :tag "Regular Expression"))
861
862(defcustom reftex-abbrev-parameters '(4 2 "^aeiou" "aeiou")
863  "Parameters for abbreviation of words.
864This variable is a list of the following items.
865
866MIN-CHARS    Minimum number of characters remaining after abbreviation.
867MIN-KILL     Minimum number of characters to remove when abbreviating words.
868BEFORE       Character class before abbrev point in word.
869AFTER        Character class after  abbrev point in word."
870  :group 'reftex-making-and-inserting-labels
871  :type '(list
872          (integer :tag "Minimum chars per word" 4)
873          (integer :tag "Shorten by at least   " 2)
874          (string  :tag "cut before char class " "^saeiou")
875          (string  :tag "cut after  char class " "aeiou")))
876
877(defcustom reftex-format-label-function nil
878  "Function which produces the string to insert as a label definition.
879Normally should be nil, unless you want to do something fancy.
880The function will be called with two arguments, the LABEL and the DEFAULT
881FORMAT, which usually is `\\label{%s}'.  The function should return the
882string to insert into the buffer."
883  :group 'reftex-making-and-inserting-labels
884  :type 'function)
885
886;; Label referencing
887
888(defgroup reftex-referencing-labels nil
889  "Options on how to reference labels."
890  :group 'reftex-label-support)
891
892(eval-and-compile
893  (defconst reftex-tmp
894    '((const :tag "on" t)
895      (const :tag "off" nil)
896      (string :tag "Selected label types"))))
897
898(defcustom reftex-label-menu-flags '(t t nil nil nil nil t nil)
899  "List of flags governing the label menu makeup.
900The flags are:
901
902TABLE-OF-CONTENTS  Show the labels embedded in a table of context.
903SECTION-NUMBERS    Include section numbers (like 4.1.3) in table of contents.
904COUNTERS           Show counters.  This just numbers the labels in the menu.
905NO-CONTEXT         Non-nil means do NOT show the short context.
906FOLLOW             Follow full context in other window.
907SHOW-COMMENTED     Show labels from regions which are commented out.
908MATCH-IN-TOC       Obsolete flag.
909SHOW FILES         Show begin and end of included files.
910
911Each of these flags can be set to t or nil, or to a string of type letters
912indicating the label types for which it should be true.  These strings work
913like character classes in regular expressions.  Thus, setting one of the
914flags to \"sf\" makes the flag true for section and figure labels, nil
915for everything else.  Setting it to \"^sf\" makes it the other way round.
916The available label types are: s (section), f (figure), t (table), i (item),
917e (equation), n (footnote), plus any definitions in `reftex-label-alist'.
918
919Most options can also be switched from the label menu itself - so if you
920decide here to not have a table of contents in the label menu, you can still
921get one interactively during selection from the label menu."
922  :group 'reftex-referencing-labels
923  :type
924  `(list
925    (choice :tag "Embed in table of contents      " ,@reftex-tmp)
926    (choice :tag "Show section numbers            " ,@reftex-tmp)
927    (choice :tag "Show individual counters        " ,@reftex-tmp)
928    (choice :tag "Hide short context              " ,@reftex-tmp)
929    (choice :tag "Follow context in other window  " ,@reftex-tmp)
930    (choice :tag "Show commented labels           " ,@reftex-tmp)
931    (choice :tag "Obsolete flag,  Don't use.      " ,@reftex-tmp)
932    (choice :tag "Show begin/end of included files" ,@reftex-tmp)))
933
934(defcustom reftex-multiref-punctuation '((?, . ", ") (?- . "--") (?+ . " and "))
935  "Punctuation strings for multiple references.
936When marking is used in the selection buffer to select several references,
937this variable associates the 3 marking characters `,-+' with prefix strings
938to be inserted into the buffer before the corresponding \\ref macro.
939This is used to string together whole reference sets, like
940`eqs. 1,2,3-5,6 and 7' in a single call to `reftex-reference'. See manual."
941  :group 'reftex-referencing-labels
942  :type '(repeat (cons (character) (string))))
943
944(defcustom reftex-vref-is-default nil
945  "*Non-nil means, the varioref macro \\vref is used as default.
946In the selection buffer, the `v' key toggles the reference macro between
947`\\ref' and `\\vref'.  The value of this variable determines the default
948which is active when entering the selection process.
949Instead of nil or t, this may also be a string of type letters indicating
950the label types for which it should be true."
951  :group  'reftex-referencing-labels
952  :type `(choice :tag "\\vref is default macro" ,@reftex-tmp))
953;;;###autoload(put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
954
955(defcustom reftex-fref-is-default nil
956  "*Non-nil means, the fancyref macro \\fref is used as default.
957In the selection buffer, the `V' key toggles the reference macro between
958`\\ref', `\\fref' and `\\Fref'.  The value of this variable determines
959the default which is active when entering the selection process.
960Instead of nil or t, this may also be a string of type letters indicating
961the label types for which it should be true."
962  :group  'reftex-referencing-labels
963  :type `(choice :tag "\\fref is default macro" ,@reftex-tmp))
964;;;###autoload(put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x))))
965
966(defcustom reftex-level-indent 2
967  "*Number of spaces to be used for indentation per section level."
968  :group 'reftex-referencing-labels
969  :type 'integer)
970;;;###autoload(put 'reftex-level-indent 'safe-local-variable 'integerp)
971
972(defcustom reftex-guess-label-type t
973  "*Non-nil means, `reftex-reference' will try to guess the label type.
974To do that, RefTeX will look at the word before the cursor and compare it with
975the words given in `reftex-label-alist'.  When it finds a match, RefTeX will
976immediately offer the correct label menu - otherwise it will prompt you for
977a label type.  If you set this variable to nil, RefTeX will always prompt."
978  :group 'reftex-referencing-labels
979  :type 'boolean)
980;;;###autoload(put 'reftex-guess-label-type 'safe-local-variable (lambda (x) (memq x '(nil t))))
981
982(defcustom reftex-format-ref-function nil
983  "Function which produces the string to insert as a reference.
984Normally should be nil, because the format to insert a reference can
985already be specified in `reftex-label-alist'.
986This hook also is used by the special commands to insert `\\vref' and `\\fref'
987references, so even if you set this, your setting will be ignored by
988the special commands.
989The function will be called with two arguments, the LABEL and the DEFAULT
990FORMAT, which normally is `~\\ref{%s}'.  The function should return the
991string to insert into the buffer."
992  :group 'reftex-referencing-labels
993  :type 'function)
994
995(defcustom reftex-select-label-mode-hook nil
996  "Mode hook for reftex-select-label-mode."
997  :group 'reftex-referencing-labels
998  :type 'hook)
999
1000;; BibteX citation configuration ----------------------------------------
1001
1002(defgroup reftex-citation-support nil
1003  "Support for referencing bibliographic data with BibTeX."
1004  :group 'reftex)
1005
1006(defcustom reftex-bibliography-commands '("bibliography" "nobibliography")
1007  "LaTeX commands which specify the BibTeX databases to use with the document."
1008  :group 'reftex-citation-support
1009  :type '(repeat string))
1010
1011
1012(defvar reftex-bibfile-ignore-list nil) ; compatibility
1013(defcustom reftex-bibfile-ignore-regexps nil
1014  "*List of regular expressions to exclude files in \\bibliography{..}.
1015File names matched by these regexps will not be parsed by RefTeX.
1016Intended for files which contain only `@string' macro definitions and the
1017like, which are ignored by RefTeX anyway."
1018  :group 'reftex-citation-support
1019  :set 'reftex-set-dirty
1020  :type '(repeat (regexp)))
1021
1022(defcustom reftex-default-bibliography nil
1023  "*List of BibTeX database files which should be used if none are specified.
1024When `reftex-citation' is called from a document which has neither a
1025`\\bibliography{..}' statement nor a `thebibliography' environment,
1026RefTeX will scan these files instead.  Intended for using `reftex-citation'
1027in non-LaTeX files.  The files will be searched along the BIBINPUTS or TEXBIB
1028path."
1029  :group 'reftex-citation-support
1030  :type '(repeat (file)))
1031
1032(defcustom reftex-sort-bibtex-matches 'reverse-year
1033  "*Sorting of the entries found in BibTeX databases by reftex-citation.
1034Possible values:
1035nil            Do not sort entries.
1036'author        Sort entries by author name.
1037'year          Sort entries by increasing year.
1038'reverse-year  Sort entries by decreasing year."
1039  :group 'reftex-citation-support
1040  :type '(choice (const :tag "not" nil)
1041                 (const :tag "by author" author)
1042                 (const :tag "by year"   year)
1043                 (const :tag "by year, reversed" reverse-year)))
1044
1045(defcustom reftex-cite-format 'default
1046  "*The format of citations to be inserted into the buffer.
1047It can be a string or an alist or a symbol.  In the simplest case this
1048is just the string \"\\cite{%l}\", which is also the default.  See the
1049definition of `reftex-cite-format-builtin' for more complex examples.
1050
1051If `reftex-cite-format' is a string, it will be used as the format.
1052In the format, the following percent escapes will be expanded.
1053
1054%l   The BibTeX label of the citation.
1055%a   List of author names, see also `reftex-cite-punctuation'.
1056%2a  Like %a, but abbreviate more than 2 authors like Jones et al.
1057%A   First author name only.
1058%e   Works like %a, but on list of editor names. (%2e and %E work a well)
1059
1060It is also possible to access all other BibTeX database fields:
1061%b booktitle     %c chapter        %d edition    %h howpublished
1062%i institution   %j journal        %k key        %m month
1063%n number        %o organization   %p pages      %P first page
1064%r address       %s school         %u publisher  %t title
1065%v volume        %y year
1066%B booktitle, abbreviated          %T title, abbreviated
1067
1068Usually, only %l is needed.  The other stuff is mainly for the echo area
1069display, and for (setq reftex-comment-citations t).
1070
1071%< as a special operator kills punctuation and space around it after the
1072string has been formatted.
1073
1074A pair of square brackets indicates an optional argument, and RefTeX
1075will prompt for the values of these arguments.
1076
1077Beware that all this only works with BibTeX database files.  When
1078citations are made from the \\bibitems in an explicit thebibliography
1079environment, only %l is available.
1080
1081If `reftex-cite-format' is an alist of characters and strings, the user
1082will be prompted for a character to select one of the possible format
1083strings.
1084  In order to configure this variable, you can either set
1085`reftex-cite-format' directly yourself or set it to the SYMBOL of one of
1086the predefined styles.  The predefined symbols are those which have an
1087association in the constant `reftex-cite-format-builtin'.
1088E.g.: (setq reftex-cite-format 'natbib)"
1089  :group 'reftex-citation-support
1090  :type
1091  `(choice
1092    :format "%{%t%}: \n%[Value Menu%] %v"
1093    (radio :tag "Symbolic Builtins"
1094           :indent 4
1095           :value default
1096           ,@(mapcar
1097              (lambda (x)
1098                (list 'const :tag (concat (symbol-name (nth 0 x))
1099                                           ": " (nth 1 x))
1100                      (nth 0 x)))
1101              reftex-cite-format-builtin))
1102    (string :tag "format string" "\\cite{%l}")
1103    (repeat :tag "key-ed format strings"
1104            :value ((?\r . "\\cite{%l}")
1105                    (?t  . "\\cite{%l}") (?p . "\\cite{%l}"))
1106            (cons (character :tag "Key character" ?\r)
1107                  (string    :tag "Format string" "")))))
1108
1109(defcustom reftex-cite-prompt-optional-args 'maybe
1110  "*Non-nil means, prompt for empty optional arguments in cite macros.
1111When an entry in `reftex-cite-format' ist given with square brackets to
1112indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
1113prompt for values.  Possible values are:
1114
1115nil     Never prompt for optional arguments
1116t       Always prompt
1117maybe   Prompt only if `reftex-citation' was called with C-u prefix arg
1118
1119Unnecessary empty optional arguments are removed before insertion into
1120the buffer.  See `reftex-cite-cleanup-optional-args'."
1121  :group 'reftex-citation-support
1122  :type '(choice
1123          (const :tag "Always" t)
1124          (const :tag "When called with prefix arg" maybe)
1125          (const :tag "Never" nil)))
1126
1127(defcustom reftex-cite-cleanup-optional-args t
1128  "*Non-nil means, remove unnecessary empty optional arguments in cite macros.
1129The cite macros provided by some packages (for example
1130natbib) allow specifying two optional arguments, one for a prefix to
1131the citation, and a second for a postfix.  When only one optional
1132argument is given, it is interpreted as postfix.  When this option is
1133t, RefTeX removes unnecessary empty optional arguments from the cite
1134macro before insertion.  For example, it will change
1135    \\cite[][]{Jones}              -> \\cite{Jones}
1136    \\cite[][Chapter 1]{Jones}     -> \\cite[Chapter 1]{Jones}
1137    \\cite[see][]{Jones}           -> \\cite[see][]{Jones}
1138    \\cite[see][Chapter 1]{Jones}  -> \\cite{Jones}
1139Is is possible that other packages have other conventions about which
1140optional argument is interpreted how - that is why this cleaning up
1141can be turned off."
1142  :group 'reftex-citation-support
1143  :type 'boolean)
1144
1145(defcustom reftex-comment-citations nil
1146  "*Non-nil means add a comment for each citation describing the full entry.
1147The comment is formatted according to `reftex-cite-comment-format'."
1148  :group 'reftex-citation-support
1149  :type 'boolean)
1150
1151(defcustom reftex-cite-comment-format
1152  "%% %2a %y, %j %v, %P, %b, %e, %u, %s %<\n"
1153  "Citation format used for commented citations.  Must NOT contain %l.
1154See the variable `reftex-cite-format' for possible percent escapes."
1155  :group 'reftex-citation-support
1156  :type 'string)
1157
1158(defcustom reftex-cite-view-format "%2a %y, %T, %B, %j %v:%P, %s %<"
1159  "Citation format used to display citation info in the message area.
1160Must NOT contain %l.  See the variable `reftex-cite-format' for
1161possible percent escapes."
1162  :group 'reftex-citation-support
1163  :group 'reftex-viewing-cross-references
1164  :type 'string)
1165
1166(defcustom reftex-cite-punctuation '(", " " \\& " " {\\it et al.}")
1167  "Punctuation for formatting of name lists in citations.
1168This is a list of 3 strings.
11691. normal names separator, like \", \"     in Jones, Brown and Miller
11702. final names separator,  like \" and \"  in Jones, Brown and Miller
11713. The \"et al\" string,   like \" {\\it et al.}\" in Jones {\\it et al.}"
1172  :group 'reftex-citation-support
1173  :type '(list
1174          (string :tag "Separator for names            ")
1175          (string :tag "Separator for last name in list")
1176          (string :tag "string used as et al.          ")))
1177
1178(defcustom reftex-format-cite-function nil
1179  "Function which produces the string to insert as a citation.
1180Normally should be nil, because the format to insert a reference can
1181already be specified in `reftex-cite-format'.
1182The function will be called with two arguments, the CITATION KEY and the
1183DEFAULT FORMAT, which is taken from `reftex-cite-format'.  The function
1184should return the string to insert into the buffer."
1185  :group 'reftex-citation-support
1186  :type 'function)
1187
1188(defcustom reftex-select-bib-mode-hook nil
1189  "Mode hook for reftex-select-bib-mode."
1190  :group 'reftex-citation-support
1191  :type 'hook)
1192
1193;; Index Support Configuration
1194
1195(defgroup reftex-index-support nil
1196  "Support for viewing and editing the index."
1197  :group 'reftex)
1198
1199(defcustom reftex-support-index t
1200  "*Non-nil means, index entries are parsed as well.
1201Index support is resource intensive and the internal structure holding the
1202parsed information can become quite big.  Therefore it can be turned off.
1203When this is nil and you execute a command which requires index support,
1204you will be asked for confirmation to turn it on and rescan the document."
1205  :group 'reftex-index-support
1206  :type 'boolean)
1207
1208(defcustom reftex-index-special-chars '("!" "|" "@" "\"" "\\")
1209  "Special characters in index entries.  The value is a list of five strings.
1210These correspond to the makeindex keywords LEVEL ENCAP ACTUAL QUOTE ESCAPE."
1211  :group 'reftex-index-support
1212  :type '(list
1213          (string :tag "LEVEL  separator")
1214          (string :tag "ENCAP  char     ")
1215          (string :tag "ACTUAL char     ")
1216          (string :tag "QUOTE  char     ")
1217          (string :tag "ESCAPE char     ")))
1218
1219(defcustom reftex-index-macros nil
1220  "Macros which define index entries.  The structure is
1221
1222\(MACRO INDEX-TAG KEY PREFIX EXCLUDE REPEAT)
1223
1224MACRO is the macro.  Arguments should be denoted by empty braces like
1225\\index[]{*}.  Use square brackets to denote optional arguments.  The star
1226marks where the index key is.
1227
1228INDEX-TAG is a short name of the index.  \"idx\" and \"glo\" are
1229reserved for the default index and the glossary.  Other indices can be
1230defined as well.  If this is an integer, the Nth argument of the macro
1231holds the index tag.
1232
1233KEY is a character which is used to identify the macro for input with
1234\\[reftex-index].  ?i, ?I, and ?g are reserved for default index and glossary.
1235
1236PREFIX can be a prefix which is added to the KEY part of the index entry.
1237If you have a macro \\newcommand{\\molec}[1]{#1\\index{Molecules!#1}}, this
1238prefix should be \"Molecules!\".  See the manual for details.
1239
1240EXCLUDE can be a function.  If this function exists and returns a non-nil
1241value, the index entry at point is ignored.  This was implemented to support
1242the (deprecated) `^' and `_' shortcuts in the LaTeX2e `index' package.
1243
1244REPEAT, if non-nil, means the index macro does not typeset the entry in
1245the text, so that the text has to be repeated outside the index macro.
1246Needed for `reftex-index-selection-or-word' and for indexing from the
1247phrase buffer.
1248
1249The final entry may also be a symbol if this entry has a association
1250in the variable `reftex-index-macros-builtin' to specify the main
1251indexing package you are using.  Valid values are currently
1252default         The LaTeX default - unnecessary to specify this one
1253multind         The multind.sty package
1254index           The index.sty package
1255index-shortcut  The index.sty packages with the ^ and _ shortcuts.
1256                Should not be used - only for old documents.
1257Note that AUCTeX sets these things internally for RefTeX as well, so
1258with a sufficiently new version of AUCTeX, you should not set the
1259package here."
1260  :group 'reftex-index-support
1261  :set 'reftex-set-dirty
1262  :type `(list
1263          (repeat
1264           :inline t
1265           (list :value ("" "idx" ?a "" nil)
1266                 (string  :tag "Macro with args")
1267                 (choice  :tag "Index Tag      "
1268                         (string)
1269                         (integer :tag "Macro arg Nr" :value 1))
1270                 (character :tag "Access Key     ")
1271                 (string  :tag "Key Prefix     ")
1272                 (symbol  :tag "Exclusion hook ")
1273                 (boolean :tag "Repeat Outside ")))
1274          (option
1275           :tag "Package:"
1276           (choice :tag "Package"
1277                   :value index
1278                   ,@(mapcar
1279                      (lambda (x)
1280                        (list 'const :tag (concat (symbol-name (nth 0 x))
1281                                                  ": " (nth 1 x))
1282                              (nth 0 x)))
1283                      reftex-index-macros-builtin)))))
1284
1285(defcustom reftex-index-default-macro '(?i "idx")
1286  "The default index macro for \\[reftex-index-selection-or-word].
1287This is a list with (MACRO-KEY DEFAULT-TAG).
1288
1289MACRO-KEY:   Character identifying an index macro - see `reftex-index-macros'.
1290DEFAULT-TAG: This is the tag to be used if the macro requires a TAG argument.
1291             When this is nil and a TAG is needed, RefTeX will ask for it.
1292             When this is the empty string and the TAG argument of the index
1293             macro is optional, the TAG argument will be omitted."
1294  :group 'reftex-index-support
1295  :type '(list
1296          (character :tag "Character identifying default macro")
1297          (choice    :tag "Default index tag                  "
1298                  (const nil)
1299                  (string))))
1300
1301(defcustom reftex-index-default-tag "idx"
1302  "Default index tag.
1303When working with multiple indexes, RefTeX queries for an index tag when
1304creating index entries or displaying a specific index.  This variable controls
1305the default offered for these queries.  The default can be selected with RET
1306during selection or completion.  Valid values of this variable are:
1307
1308nil       Do not provide a default index
1309\"tag\"     The default index tag given as a string, e.g. \"idx\".
1310last      The last used index tag will be offered as default."
1311  :group 'reftex-index-support
1312  :type '(choice
1313          (const :tag  "no default" nil)
1314          (const :tag  "last used " 'last)
1315          (string :tag "index tag " "idx")))
1316
1317(defcustom reftex-index-math-format "$%s$"
1318  "Format of index entries when copied from inside math mode.
1319When `reftex-index-selection-or-word' is executed inside TeX math mode,
1320the index key copied from the buffer is processed with this format string
1321through the `format' function.  This can be used to add the math delimiters
1322\(e.g. `$') to the string.
1323Requires the `texmathp.el' library which is part of AUCTeX."
1324  :group 'reftex-index-support
1325  :type 'string)
1326
1327(defcustom reftex-index-phrase-file-extension ".rip"
1328  "File extension for the index phrase file.
1329This extension will be added to the base name of the master file."
1330  :group 'reftex-index-support
1331  :type 'string)
1332
1333(defcustom reftex-index-phrases-logical-and-regexp " *&& *"
1334  "Regexp matching the `and' operator for index arguments in phrases file.
1335When several index arguments in a phrase line are separated by this
1336operator, each part will generate an index macro.  So each match of
1337the search phrase will produce *several* different index entries.
1338
1339Note: make sure this does no match things which are not separators.
1340This logical `and' has higher priority than the logical `or' specified in
1341`reftex-index-phrases-logical-or-regexp'."
1342  :group 'reftex-index-support
1343  :type 'regexp)
1344
1345(defcustom reftex-index-phrases-logical-or-regexp " *|| *"
1346  "Regexp matching the `or' operator for index arguments in phrases file.
1347When several index arguments in a phrase line are separated by this
1348operator, the user will be asked to select one of them at each match
1349of the search phrase.  The first index arg will be the default - a
1350number key 1-9 must be pressed to switch to another.
1351
1352Note: make sure this does no match things which are not separators.
1353The logical `and' specified in `reftex-index-phrases-logical-or-regexp'
1354has higher priority than this logical `or'."
1355  :group 'reftex-index-support
1356  :type 'regexp)
1357
1358(defcustom reftex-index-phrases-search-whole-words t
1359  "*Non-nil means phrases search will look for whole words, not subwords.
1360This works by requiring word boundaries at the beginning and end of
1361the search string.  When the search phrase already has a non-word-char
1362at one of these points, no word boundary is required there."
1363  :group 'reftex-index-support
1364  :type 'boolean)
1365
1366(defcustom reftex-index-phrases-case-fold-search t
1367  "*Non-nil means, searching for index phrases will ignore case."
1368  :group 'reftex-index-support
1369  :type 'boolean)
1370
1371(defcustom reftex-index-verify-function nil
1372  "A function which is called  at each match during global indexing.
1373If the function returns nil, the current match is skipped."
1374  :group 'reftex-index-support
1375  :type '(choice
1376          (const :tag "No verification" nil)
1377          (function)))
1378
1379(defcustom reftex-index-phrases-skip-indexed-matches nil
1380  "*Non-nil means, skip matches which appear to be indexed already.
1381When doing global indexing from the phrases buffer, searches for some
1382phrases may match at places where that phrase was already indexed.  In
1383particular when indexing an already processed document again, this
1384will even be the norm.  When this variable is non-nil, RefTeX checks if
1385the match is inside an index macro argument, or if an index macro is directly
1386before or after the phrase.  If that is the case, that match will
1387be ignored."
1388  :group 'reftex-index-support
1389  :type 'boolean)
1390
1391(defcustom reftex-index-phrases-wrap-long-lines nil
1392  "*Non-nil means, when indexing from the phrases buffer, wrap lines.
1393Inserting indexing commands in a line makes the line longer - often
1394so long that it does not fit onto the screen.  When this variable is
1395non-nil, newlines will be added as necessary before and/or after the
1396indexing command to keep lines short.  However, the matched text
1397phrase and its index command will always end up on a single line."
1398  :group 'reftex-index-support
1399  :type 'boolean)
1400
1401(defcustom reftex-index-phrases-sort-prefers-entry nil
1402  "*Non-nil means when sorting phrase lines, the explicit index entry is used.
1403Phrase lines in the phrases buffer contain a search phrase, and
1404sorting is normally based on these.  Some phrase lines also have
1405an explicit index argument specified.  When this variable is non-nil,
1406the index argument will be used for sorting."
1407  :group 'reftex-index-support
1408  :type 'boolean)
1409
1410(defcustom reftex-index-phrases-sort-in-blocks t
1411  "*Non-nil means, empty and comment lines separate phrase buffer into blocks.
1412Sorting will then preserve blocks, so that lines are re-arranged only
1413within blocks."
1414  :group 'reftex-index-support
1415  :type 'boolean)
1416
1417(defcustom reftex-index-section-letters "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
1418  "The letters which denote sections in the index.
1419Usually these are all capital letters.  Don't use any downcase letters.
1420Order is not significant, the index will be sorted by whatever the sort
1421function thinks is correct.
1422In addition to these letters, RefTeX will create a group `!' which
1423contains all entries sorted below the lowest specified letter.
1424In the index buffer, pressing any of these capital letters or `!' will jump
1425to that section."
1426  :group 'reftex-index-support
1427  :type '(string :tag "Capital letters"))
1428
1429(defcustom reftex-index-include-context nil
1430  "*Non-nil means, display the index definition context in the index buffer.
1431This flag may also be toggled from the index buffer with the `c' key."
1432  :group 'reftex-index-support
1433  :type 'boolean)
1434
1435(defcustom reftex-index-follow-mode nil
1436  "*Non-nil means, point in *Index* buffer will cause other window to follow.
1437The other window will show the corresponding part of the document.
1438This flag can be toggled from within the *Index* buffer with the `f' key."
1439  :group 'reftex-table-of-contents-browser
1440  :type 'boolean)
1441
1442;; Viewing Cross References
1443
1444(defgroup reftex-viewing-cross-references nil
1445  "Displaying cross references and citations."
1446  :group 'reftex)
1447
1448(defcustom reftex-view-crossref-extra nil
1449  "Macros which can be used for the display of cross references.
1450This is used when `reftex-view-crossref' is called with point in an
1451argument of a macro.  Note that crossref viewing for citations,
1452references (both ways) and index entries is hard-coded.  This variable
1453is only to configure additional structures for which crossreference
1454viewing can be useful.  Each entry has the structure
1455
1456\(MACRO-RE SEARCH-RE HIGHLIGHT).
1457
1458MACRO-RE is matched against the macro.  SEARCH-RE is the regexp used
1459to search for cross references.  `%s' in this regexp is replaced with
1460with the macro argument at point.  HIGHLIGHT is an integer indicating
1461which subgroup of the match should be highlighted."
1462  :group 'reftex-viewing-cross-references
1463  :type '(repeat (group (regexp  :tag "Macro  Regexp  ")
1464                        (string  :tag "Search Regexp  ")
1465                        (integer :tag "Highlight Group"))))
1466
1467(defcustom reftex-auto-view-crossref t
1468  "*Non-nil means, initially turn automatic viewing of crossref info on.
1469Automatic viewing of crossref info normally uses the echo area.
1470Whenever point is idle for more than `reftex-idle-time' seconds on the
1471argument of a \\ref or \\cite macro, and no other message is being
1472displayed, the echo area will display information about that cross
1473reference.  You can also set the variable to the symbol `window'.  In
1474this case a small temporary window is used for the display.
1475This feature can be turned on and off from the menu
1476\(Ref->Options)."
1477  :group 'reftex-viewing-cross-references
1478  :type '(choice (const :tag "off" nil)
1479                 (const :tag "in Echo Area" t)
1480                 (const :tag "in Other Window" window)))
1481
1482(defcustom reftex-idle-time 1.2
1483  "*Time (secs) Emacs has to be idle before automatic crossref display is done.
1484Applies also to toc recentering."
1485  :group 'reftex-viewing-cross-references
1486  :type 'number)
1487
1488(defcustom reftex-revisit-to-echo nil
1489  "*Non-nil means, automatic citation display will revisit files if necessary.
1490When nil, citation display in echo area will only be active for cached
1491entries and for BibTeX database files with live associated buffers."
1492  :group 'reftex-viewing-cross-references
1493  :type 'boolean)
1494
1495(defcustom reftex-cache-cite-echo t
1496  "*Non-nil means, the information displayed in the echo area for cite macros
1497is cached and even saved along with the parsing information.  The cache
1498survives document scans.  In order to clear it, use M-x reftex-reset-mode."
1499  :group 'reftex-viewing-cross-references
1500  :type 'boolean)
1501
1502(defcustom reftex-display-copied-context-hook nil
1503  "Normal Hook which is run before context is displayed anywhere.  Designed
1504for X-Symbol, but may have other uses as well."
1505  :group 'reftex-viewing-cross-references
1506  :group 'reftex-referencing-labels
1507  :type 'hook)
1508
1509;; Finding Files --------------------------------------------------------
1510
1511(defgroup reftex-finding-files nil
1512  "Finding files on search paths."
1513  :group 'reftex)
1514
1515(defcustom reftex-texpath-environment-variables '("TEXINPUTS")
1516  "*List of specifications how to retrieve the search path for TeX files.
1517Several entries are possible.
1518- If an element is the name of an environment variable, its content is used.
1519- If an element starts with an exclamation mark, it is used as a command
1520  to retrieve the path.  A typical command with the kpathsearch library would
1521  be `!kpsewhich -show-path=.tex'.
1522- Otherwise the element itself is interpreted as a path.
1523Multiple directories can be separated by the system dependent `path-separator'.
1524Directories ending in `//' or `!!' will be expanded recursively.
1525See also `reftex-use-external-file-finders'."
1526  :group 'reftex-finding-files
1527  :set 'reftex-set-dirty
1528  :type '(repeat (string :tag "Specification")))
1529
1530(defcustom reftex-bibpath-environment-variables '("BIBINPUTS" "TEXBIB")
1531  "*List of specifications how to retrieve search path for .bib database files.
1532Several entries are possible.
1533- If an element is the name of an environment variable, its content is used.
1534- If an element starts with an exclamation mark, it is used as a command
1535  to retrieve the path.  A typical command with the kpathsearch library would
1536  be `!kpsewhich -show-path=.bib'.
1537- Otherwise the element itself is interpreted as a path.
1538Multiple directories can be separated by the system dependent `path-separator'.
1539Directories ending in `//' or `!!' will be expanded recursively.
1540See also `reftex-use-external-file-finders'."
1541  :group 'reftex-citation-support
1542  :group 'reftex-finding-files
1543  :set 'reftex-set-dirty
1544  :type '(repeat (string :tag "Specification")))
1545
1546(defcustom reftex-file-extensions '(("tex" . (".tex" ".ltx"))
1547                                    ("bib" . (".bib")))
1548  "*Association list with file extensions for different file types.
1549This is a list of items, each item is like: (TYPE . (DEF-EXT OTHER-EXT ...))
1550
1551TYPE:       File type like \"bib\" or \"tex\".
1552DEF-EXT:    The default extension for that file type, like \".tex\" or \".bib\".
1553OTHER-EXT:  Any number of other valid extensions for this file type.
1554
1555When a files is searched and it does not have any of the legal extensions,
1556we try the default extension first, and then the naked file name.
1557
1558If you are using AUCTeX, you also need to add new extensions to
1559TeX-file-extensions."
1560  :group 'reftex-finding-files
1561  :type '(repeat (cons (string :tag "File type")
1562                       (repeat (string :tag "Extension")))))
1563
1564(defcustom reftex-try-all-extensions nil
1565  "Non-nil means, try all extensions listed in `reftex-file-extensions'.
1566When searching for a file, LaTeX uses only the default extension.  However,
1567if you are working with a noweb system that produces the .tex files from
1568some other file, and you want RefTeX to scan the web file instead of the
1569tex file, you need to set this option.  You also need to make the noweb
1570extension the default extension, i.e. the first in the list in
1571`reftex-file-extensions'.
1572Note that if you are using external file finders, this option has no effect."
1573  :group 'reftex-finding-files
1574  :type 'boolean)
1575
1576(defcustom reftex-search-unrecursed-path-first t
1577  "*Non-nil means, search all specified directories before trying recursion.
1578Thus, in a path \".//:/tex/\", search first \"./\", then \"/tex/\" and then
1579all subdirectories of \"./\".  If this option is nil, the subdirectories of
1580\"./\" are searched before \"/tex/\". This is mainly for speed - most of the
1581time the recursive path is for the system files and not for the user files.
1582Set this to nil if the default makes RefTeX finding files with equal names
1583in wrong sequence."
1584  :group 'reftex-finding-files
1585  :type 'boolean)
1586
1587(defcustom reftex-use-external-file-finders nil
1588  "*Non-nil means, use external programs to find files.
1589Normally, RefTeX searches the paths given in the environment variables
1590TEXINPUTS and BIBINPUTS to find TeX files and BibTeX database files.
1591With this option turned on, it calls an external program specified in the
1592option `reftex-external-file-finders' instead.  As a side effect,
1593the variables `reftex-texpath-environment-variables' and
1594`reftex-bibpath-environment-variables' will be ignored."
1595  :group 'reftex-finding-files
1596  :type 'boolean)
1597
1598(defcustom reftex-external-file-finders '(("tex" . "kpsewhich -format=.tex %f")
1599                                          ("bib" . "kpsewhich -format=.bib %f"))
1600  "*Association list with external programs to call for finding files.
1601Each entry is a cons cell (TYPE . PROGRAM).
1602TYPE is either \"tex\" or \"bib\".  PROGRAM is the external program to use with
1603any arguments.  %f will be replaced by the name of the file to be found.
1604Note that these commands will be executed directly, not via a shell.
1605Only relevant when `reftex-use-external-file-finders' is non-nil."
1606  :group 'reftex-finding-files
1607  :type '(repeat (cons (string :tag "File type")
1608                       (string :tag "Program  "))))
1609
1610;; Tuning the parser ----------------------------------------------------
1611
1612(defgroup reftex-optimizations-for-large-documents nil
1613  "Configuration of parser speed and memory usage."
1614  :group 'reftex)
1615
1616(defcustom reftex-keep-temporary-buffers 1
1617  "*Non-nil means, keep buffers created for parsing and lookup.
1618RefTeX sometimes needs to visit files related to the current document.
1619We distinguish files visited for
1620PARSING: Parts of a multifile document loaded when (re)-parsing the document.
1621LOOKUP:  BibTeX database files and TeX files loaded to find a reference,
1622         to display label context, etc.
1623The created buffers can be kept for later use, or be thrown away immediately
1624after use, depending on the value of this variable:
1625
1626nil  Throw away as much as possible.
1627t    Keep everything.
16281    Throw away buffers created for parsing, but keep the ones created
1629     for lookup.
1630
1631If a buffer is to be kept, the file is visited normally (which is potentially
1632slow but will happen only once).
1633If a buffer is to be thrown away, the initialization of the buffer depends
1634upon the variable `reftex-initialize-temporary-buffers'."
1635  :group 'reftex-optimizations-for-large-documents
1636  :type '(choice
1637          (const :tag "Throw away everything" nil)
1638          (const :tag "Keep everything" t)
1639          (const :tag "Keep lookup buffers only" 1)))
1640
1641(defcustom reftex-initialize-temporary-buffers nil
1642  "*Non-nil means do initializations even when visiting file temporarily.
1643When nil, RefTeX may turn off find-file hooks and other stuff to briefly
1644visit a file.
1645When t, the full default initializations are done (find-file-hook etc.).
1646Instead of t or nil, this variable may also be a list of hook functions to
1647do a minimal initialization."
1648  :group 'reftex-optimizations-for-large-documents
1649  :type '(choice
1650          (const :tag "Read files literally" nil)
1651          (const :tag "Fully initialize buffers" t)
1652          (repeat :tag "Hook functions" :value (nil)
1653           (function-item))))
1654
1655(defcustom reftex-no-include-regexps '("\\.pstex_t\\'")
1656  "*List of regular expressions to exclude certain input files from parsing.
1657If the name of a file included via \\include or \\input is matched by any
1658of the regular expressions in this list, that file is not parsed by RefTeX."
1659  :group 'reftex-optimizations-for-large-documents
1660  :type '(repeat (regexp)))
1661
1662(defcustom reftex-enable-partial-scans nil
1663  "*Non-nil means, re-parse only 1 file when asked to re-parse.
1664Re-parsing is normally requested with a `C-u' prefix to many RefTeX commands,
1665or with the `r' key in menus.  When this option is t in a multifile document,
1666we will only parse the current buffer, or the file associated with the label
1667or section heading near point in a menu.  Requesting re-parsing of an entire
1668multifile document then requires a `C-u C-u' prefix or the capital `R' key
1669in menus."
1670  :group 'reftex-optimizations-for-large-documents
1671  :type 'boolean)
1672
1673(defcustom reftex-allow-automatic-rescan t
1674  "*Non-nil means, RefTeX may rescan the document when this seems necessary.
1675Currently this applies only to rescanning after label insertion, when
1676the new label cannot be inserted correctly into the internal label
1677list."
1678  :group 'reftex-optimizations-for-large-documents
1679  :type 'boolean)
1680
1681(defcustom reftex-save-parse-info nil
1682  "*Non-nil means, save information gathered with parsing in a file.
1683The file MASTER.rel in the same directory as MASTER.tex is used to save the
1684information.  When this variable is t,
1685- accessing the parsing information for the first time in an editing session
1686  will read that file (if available) instead of parsing the document.
1687- exiting Emacs or killing a buffer in reftex-mode will cause a new version
1688  of the file to be written."
1689  :group 'reftex-optimizations-for-large-documents
1690  :type 'boolean)
1691
1692(defcustom reftex-parse-file-extension ".rel"
1693  "*File extension for the file in which parser information is stored.
1694This extension is added to the base name of the master file."
1695  :group 'reftex-optimizations-for-large-documents
1696  :type 'string)
1697
1698(defcustom reftex-use-multiple-selection-buffers nil
1699  "*Non-nil means use a separate selection buffer for each label type.
1700These buffers are kept from one selection to the next and need not to be
1701created for each use - so the menu generally comes up faster.  The
1702selection buffers will be erased (and therefore updated) automatically
1703when new labels in its category are added.  See the variable
1704`reftex-auto-update-selection-buffers'."
1705  :group 'reftex-optimizations-for-large-documents
1706  :group 'reftex-referencing-labels
1707  :type 'boolean)
1708
1709(defcustom reftex-auto-update-selection-buffers t
1710  "*Non-nil means, selection buffers will be updated automatically.
1711When a new label is defined with `reftex-label', all selection buffers
1712associated with that label category are emptied, in order to force an
1713update upon next use.  When nil, the buffers are left alone and have to be
1714updated by hand, with the `g' key from the label selection process.
1715The value of this variable will only have any effect when
1716`reftex-use-multiple-selection-buffers' is non-nil."
1717  :group 'reftex-optimizations-for-large-documents
1718  :group 'reftex-referencing-labels
1719  :type 'boolean)
1720
1721;; Fontification and Faces ----------------------------------------------
1722
1723(defgroup reftex-fontification-configurations nil
1724  "Options concerning the faces used in RefTeX."
1725  :link '(custom-group-link :tag "Font Lock Faces group" font-lock-faces)
1726  :group 'reftex)
1727
1728(defcustom reftex-use-fonts t
1729  "*Non-nil means, use fonts in *toc* and selection buffers.
1730Font-lock must be loaded as well to actually get fontified display.
1731When changing this option, a rescan may be necessary to activate the change."
1732  :group 'reftex-fontification-configurations
1733  :type 'boolean)
1734
1735(defcustom reftex-refontify-context 1
1736  "*Non-nil means, re-fontify the context in the label menu with font-lock.
1737This slightly slows down the creation of the label menu.  It is only necessary
1738when you definitely want the context fontified.
1739
1740This option may have 3 different values:
1741nil  Never refontify.
1742t    Always refontify.
17431    Refontify when absolutely necessary, e.g. when old versions of X-Symbol.
1744The option is ignored when `reftex-use-fonts' is nil."
1745  :group 'reftex-fontification-configurations
1746  :group 'reftex-referencing-labels
1747  :type '(choice
1748          (const :tag "Never" nil)
1749          (const :tag "Always" t)
1750          (const :tag "When necessary" 1)))
1751
1752(defcustom reftex-highlight-selection 'cursor
1753  "*Non-nil mean, highlight selected text in selection and *toc* buffers.
1754Normally, the text near the cursor is the selected text, and it is
1755highlighted.  This is the entry most keys in the selction and *toc*
1756buffers act on.  However, if you mainly use the mouse to select an
1757item, you may find it nice to have mouse-triggered highlighting
1758instead or as well. The variable may have one of these values:
1759
1760   nil      No highlighting.
1761   cursor   Highlighting is cursor driven.
1762   mouse    Highlighting is mouse driven.
1763   both     Both cursor and mouse trigger highlighting.
1764
1765Changing this variable requires to rebuild the selection and *toc* buffers
1766to become effective (keys `g' or `r')."
1767  :group 'reftex-fontification-configurations
1768  :type '(choice
1769          (const :tag "Never" nil)
1770          (const :tag "Cursor driven" cursor)
1771          (const :tag "Mouse driven" mouse)
1772          (const :tag "Mouse and Cursor driven." both)))
1773
1774(defcustom reftex-cursor-selected-face 'highlight
1775  "Face name to highlight cursor selected item in toc and selection buffers.
1776See also the variable `reftex-highlight-selection'."
1777  :group 'reftex-fontification-configurations
1778  :type 'symbol)
1779(defcustom reftex-mouse-selected-face 'secondary-selection
1780  "Face name to highlight mouse selected item in toc and selection buffers.
1781See also the variable `reftex-highlight-selection'."
1782  :group 'reftex-fontification-configurations
1783  :type 'symbol)
1784(defcustom reftex-file-boundary-face 'font-lock-comment-face
1785  "Face name for file boundaries in selection buffer."
1786  :group 'reftex-fontification-configurations
1787  :type 'symbol)
1788(defcustom reftex-label-face 'font-lock-constant-face
1789  "Face name for labels in selection buffer."
1790  :group 'reftex-fontification-configurations
1791  :type 'symbol)
1792(defcustom reftex-section-heading-face 'font-lock-function-name-face
1793  "Face name for section headings in toc and selection buffers."
1794  :group 'reftex-fontification-configurations
1795  :type 'symbol)
1796(defcustom reftex-toc-header-face 'font-lock-comment-face
1797  "Face name for the header of a toc buffer."
1798  :group 'reftex-fontification-configurations
1799  :type 'symbol)
1800(defcustom reftex-bib-author-face 'font-lock-keyword-face
1801  "Face name for author names in bib selection buffer."
1802  :group 'reftex-fontification-configurations
1803  :type 'symbol)
1804(defcustom reftex-bib-year-face 'font-lock-comment-face
1805  "Face name for year in bib selection buffer."
1806  :group 'reftex-fontification-configurations
1807  :type 'symbol)
1808(defcustom reftex-bib-title-face 'font-lock-function-name-face
1809  "Face name for article title in bib selection buffer."
1810  :group 'reftex-fontification-configurations
1811  :type 'symbol)
1812(defcustom reftex-bib-extra-face 'font-lock-comment-face
1813  "Face name for bibliographic information in bib selection buffer."
1814  :group 'reftex-fontification-configurations
1815  :type 'symbol)
1816(defcustom reftex-select-mark-face 'bold
1817  "Face name for marked entries in the selection buffers."
1818  :group 'reftex-fontification-configurations
1819  :type 'symbol)
1820(defcustom reftex-index-header-face 'font-lock-comment-face
1821  "Face name for the header of an index buffer."
1822  :group 'reftex-fontification-configurations
1823  :type 'symbol)
1824(defcustom reftex-index-section-face 'font-lock-function-name-face
1825  "Face name for the start of a new letter section in the index."
1826  :group 'reftex-fontification-configurations
1827  :type 'symbol)
1828(defcustom reftex-index-tag-face 'font-lock-keyword-face
1829  "Face name for index names (for multiple indices)."
1830  :group 'reftex-fontification-configurations
1831  :type 'symbol)
1832(defcustom reftex-index-face 'font-lock-constant-face
1833  "Face name for index entries."
1834  :group 'reftex-fontification-configurations
1835  :type 'symbol)
1836
1837(defcustom reftex-pre-refontification-functions nil
1838  "X-Symbol specific hook.
1839Functions get two arguments, the buffer from where the command started and a
1840symbol indicating in what context the hook is called."
1841  :group 'reftex-fontification-configurations
1842  :type 'hook)
1843
1844;; Miscellaneous configurations -----------------------------------------
1845
1846(defgroup reftex-miscellaneous-configurations nil
1847  "Collection of further configurations."
1848  :group 'reftex)
1849
1850(defcustom reftex-extra-bindings nil
1851  "Non-nil means, make additional key bindings on startup.
1852These extra bindings are located in the users `C-c letter' map."
1853  :group 'reftex-miscellaneous-configurations
1854  :type 'boolean)
1855
1856(defcustom reftex-plug-into-AUCTeX nil
1857  "*Plug-in flags for AUCTeX interface.
1858This variable is a list of 4 boolean flags.  When a flag is non-nil,
1859RefTeX will
1860
1861  - supply labels in new sections and environments  (flag 1)
1862  - supply arguments for macros like `\\label'.      (flag 2)
1863  - supply arguments for macros like `\\ref'.        (flag 3)
1864  - supply arguments for macros like `\\cite'.       (flag 4)
1865  - supply arguments for macros like `\\index'.      (flag 5)
1866
1867You may also set the variable itself to t or nil in order to turn all
1868plug-ins on or off, respectively.
1869\\<LaTeX-mode-map>Supplying labels in new sections and environments applies when creating
1870sections with \\[LaTeX-section] and environments with \\[LaTeX-environment].
1871Supplying macro arguments applies when you insert such a macro interactively
1872with \\[TeX-insert-macro].
1873See the AUCTeX documentation for more information.
1874RefTeX uses `fset' to take over the function calls.  Changing the variable
1875may require a restart of Emacs in order to become effective."
1876  :group 'reftex-miscellaneous-configurations
1877  :group 'LaTeX
1878  :type '(choice
1879          (const :tag "No plug-ins" nil)
1880          (const :tag "All possible plug-ins" t)
1881          (list
1882           :tag "Individual choice"
1883           :value (t t t t t)
1884           (boolean :tag "supply label in new sections and environments")
1885           (boolean :tag "supply argument for macros like `\\label'     ")
1886           (boolean :tag "supply argument for macros like `\\ref'       ")
1887           (boolean :tag "supply argument for macros like `\\cite'      ")
1888           (boolean :tag "supply argument for macros like `\\index'     ")
1889           )))
1890
1891(defcustom reftex-allow-detached-macro-args nil
1892  "*Non-nil means, allow arguments of macros to be detached by whitespace.
1893When this is t, `aaa' will be considered as argument of \\bb in the following
1894construct:  \\bbb [xxx] {aaa}."
1895  :group 'reftex-miscellaneous-configurations
1896  :type 'boolean)
1897
1898
1899(defcustom reftex-load-hook nil
1900  "Hook which is being run when loading reftex.el."
1901  :group 'reftex-miscellaneous-configurations
1902  :type 'hook)
1903
1904(defcustom reftex-mode-hook nil
1905  "Hook which is being run when turning on RefTeX mode."
1906  :group 'reftex-miscellaneous-configurations
1907  :type 'hook)
1908
1909
1910(provide 'reftex-vars)
1911
1912;;; arch-tag: 9591ea34-ef39-4431-90b7-c115eaf5e16f
1913;;; reftex-vars.el ends here
1914