comparison lisp/textmodes/reftex-vars.el @ 59534:9bad65481674

2005-01-14 Carsten Dominik <dominik@science.uva.nl> * reftex-cite.el (reftex-bib-sort-year): Catch the case if the year is not given. * reftex-ref.el (reftex-replace-prefix-escapes): Added new escapes %m and %M, fixed bug with %F by adding save-match-data. (reftex-reference): Removed ?. from list of spaces. (reftex-label-info): Added automatic label prefix recognition * reftex-index.el (reftex-index-next-phrase): Added slave parameter to call of `reftex-index-this-phrase' (reftex-index-this-phrase): New optional argument (reftex-index-region-phrases): Added slave parameter to call of `reftex-index-this-phrase' (reftex-display-index): New argument redo (reftex-index-rescan): Added 'redo to arguments of `reftex-display-index' (reftex-index-Rescan, reftex-index-revert) (reftex-index-switch-index-tag): Added 'redo to arguments of `reftex-display-index' (reftex-index-make-phrase-regexp): Fixed bug with case-sensitive indexing. Fixed bug with matching is there is a quote before or after the word. * reftex-cite.el (reftex-all-used-citation-keys): Fix bug when collecting citation keys in lines with comments. (reftex-citation): Prefix argument no longer rescans the document, but forces prompting for optional arguments of cite macros. (reftex-do-citation): Prompting for optional arguments implemented. * reftex-vars.el (reftex-cite-format-builtin): Added optional arguments to most cite commands. (reftex-cite-cleanup-optional-args): New option (reftex-cite-prompt-optional-args): New option. (reftex-trust-label-prefix): New option * reftex-toc.el (reftex-toc-find-section): Added push-mark before changing the position in the buffer. * reftex.el (reftex-prefix-to-typekey-alist): New variable (reftex-compile-variables): Compute reftex-prefix-to-typekey-alist
author Carsten Dominik <dominik@science.uva.nl>
date Fri, 14 Jan 2005 10:12:03 +0000
parents 695cf19ef79e
children 58a53f588384 cb67264d6096
comparison
equal deleted inserted replaced
59533:2a346f1b2a9f 59534:9bad65481674
1 ;;; reftex-vars.el --- configuration variables for RefTeX 1 ;;; reftex-vars.el --- configuration variables for RefTeX
2 ;; Copyright (c) 1997, 1998, 1999, 2003 Free Software Foundation, Inc. 2 ;; Copyright (c) 1997, 1998, 1999, 2003, 2004 Free Software Foundation, Inc.
3 3
4 ;; Author: Carsten Dominik <dominik@science.uva.nl> 4 ;; Author: Carsten Dominik <dominik@science.uva.nl>
5 ;; Version: 4.21 5 ;; Version: 4.26
6 6
7 ;; This file is part of GNU Emacs. 7 ;; This file is part of GNU Emacs.
8 8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify 9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by 10 ;; it under the terms of the GNU General Public License as published by
126 Lower-case symbols correspond to a style file of the same name in the LaTeX 126 Lower-case symbols correspond to a style file of the same name in the LaTeX
127 distribution. Mixed-case symbols are convenience aliases.") 127 distribution. Mixed-case symbols are convenience aliases.")
128 128
129 (defconst reftex-cite-format-builtin 129 (defconst reftex-cite-format-builtin
130 '((default "Default macro \\cite{%l}" 130 '((default "Default macro \\cite{%l}"
131 "\\cite{%l}") 131 "\\cite[]{%l}")
132 (natbib "The Natbib package" 132 (natbib "The Natbib package"
133 ((?\C-m . "\\cite{%l}") 133 ((?\C-m . "\\cite[][]{%l}")
134 (?t . "\\citet{%l}") 134 (?t . "\\citet[][]{%l}")
135 (?T . "\\citet*{%l}") 135 (?T . "\\citet*[][]{%l}")
136 (?p . "\\citep{%l}") 136 (?p . "\\citep[][]{%l}")
137 (?P . "\\citep*{%l}") 137 (?P . "\\citep*[][]{%l}")
138 (?e . "\\citep[e.g.][]{%l}") 138 (?e . "\\citep[e.g.][]{%l}")
139 (?s . "\\citep[see][]{%l}") 139 (?s . "\\citep[see][]{%l}")
140 (?a . "\\citeauthor{%l}") 140 (?a . "\\citeauthor{%l}")
141 (?A . "\\citeauthor*{%l}") 141 (?A . "\\citeauthor*{%l}")
142 (?y . "\\citeyear{%l}") 142 (?y . "\\citeyear{%l}")
155 (?F . "\\fullocite{%l}") 155 (?F . "\\fullocite{%l}")
156 (?n . "\\nocite{%l}"))) 156 (?n . "\\nocite{%l}")))
157 (bibentry "The Bibentry package" 157 (bibentry "The Bibentry package"
158 "\\bibentry{%l}") 158 "\\bibentry{%l}")
159 (harvard "The Harvard package" 159 (harvard "The Harvard package"
160 ((?\C-m . "\\cite{%l}") 160 ((?\C-m . "\\cite[]{%l}")
161 (?p . "\\cite{%l}") 161 (?p . "\\cite[]{%l}")
162 (?t . "\\citeasnoun{%l}") 162 (?t . "\\citeasnoun{%l}")
163 (?n . "\\citeasnoun{%l}") 163 (?n . "\\citeasnoun{%l}")
164 (?s . "\\possessivecite{%l}") 164 (?s . "\\possessivecite{%l}")
165 (?e . "\\citeaffixed{%l}{?}") 165 (?e . "\\citeaffixed{%l}{?}")
166 (?y . "\\citeyear{%l}") 166 (?y . "\\citeyear{%l}")
167 (?a . "\\citename{%l}"))) 167 (?a . "\\citename{%l}")))
168 (chicago "The Chicago package" 168 (chicago "The Chicago package"
169 ((?\C-m . "\\cite{%l}") 169 ((?\C-m . "\\cite[]{%l}")
170 (?t . "\\citeN{%l}") 170 (?t . "\\citeN[]{%l}")
171 (?T . "\\shortciteN{%l}") 171 (?T . "\\shortciteN{%l}")
172 (?p . "\\cite{%l}") 172 (?p . "\\cite[]{%l}")
173 (?P . "\\shortcite{%l}") 173 (?P . "\\shortcite{%l}")
174 (?a . "\\citeA{%l}") 174 (?a . "\\citeA{%l}")
175 (?A . "\\shortciteA{%l}") 175 (?A . "\\shortciteA{%l}")
176 (?y . "\\citeyear{%l}"))) 176 (?y . "\\citeyear{%l}")))
177 (astron "The Astron package" 177 (astron "The Astron package"
178 ((?\C-m . "\\cite{%l}") 178 ((?\C-m . "\\cite[]{%l}")
179 (?p . "\\cite{%l}" ) 179 (?p . "\\cite[]{%l}" )
180 (?t . "%2a (\\cite{%l})"))) 180 (?t . "%2a (\\cite{%l})")))
181 (author-year "Do-it-yourself Author-year" 181 (author-year "Do-it-yourself Author-year"
182 ((?\C-m . "\\cite{%l}") 182 ((?\C-m . "\\cite{%l}")
183 (?t . "%2a (%y)\\nocite{%l}") 183 (?t . "%2a (%y)\\nocite{%l}")
184 (?p . "(%2a %y\\nocite{%l})"))) 184 (?p . "(%2a %y\\nocite{%l})")))
482 Label prefix string, like \"tab:\". 482 Label prefix string, like \"tab:\".
483 The prefix is a short string used as the start of a label. It may be the 483 The prefix is a short string used as the start of a label. It may be the
484 empty string. The prefix may contain the following `%' escapes: 484 empty string. The prefix may contain the following `%' escapes:
485 %f Current file name with directory and extension stripped. 485 %f Current file name with directory and extension stripped.
486 %F Current file name relative to directory of master file. 486 %F Current file name relative to directory of master file.
487 %m Master file name, directory and extension stripped.
488 %M Directory name (without path) where master file is located.
487 %u User login name, on systems which support this. 489 %u User login name, on systems which support this.
488 %S A section prefix derived with variable `reftex-section-prefixes'. 490 %S A section prefix derived with variable `reftex-section-prefixes'.
489 491
490 Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\"). 492 Example: In a file `intro.tex', \"eq:%f:\" will become \"eq:intro:\").
491 493
629 The form (format regexp (regexp-quote environment)) is used to calculate 631 The form (format regexp (regexp-quote environment)) is used to calculate
630 the final regular expression - so %s will be replaced with the environment 632 the final regular expression - so %s will be replaced with the environment
631 or macro." 633 or macro."
632 :group 'reftex-defining-label-environments 634 :group 'reftex-defining-label-environments
633 :type '(repeat (cons (symbol) (regexp)))) 635 :type '(repeat (cons (symbol) (regexp))))
636
637 (defcustom reftex-trust-label-prefix nil
638 "Non-nil means, trust the label prefix when determining label type.
639 It is customary to use special label prefixes to distinguish different label
640 types. The label prefixes have no syntactic meaning in LaTeX (unless
641 special packages like fancyref) are being used. RefTeX can and by
642 default does parse around each label to detect the correct label type,
643 but this process can be slow when a document contains thousands of
644 labels. If you use label prefixes consistently, you may speed up
645 document parsing by setting this variable to a non-nil value. RefTeX
646 will then compare the label prefix with the prefixes found in
647 `reftex-label-alist' and derive the correct label type in this way.
648 Possible values for this option are:
649
650 t This means to trust any label prefixes found.
651 regexp If a regexp, only prefixes matched by the regexp are trusted.
652 list List of accepted prefixes, as strings. The colon is part of
653 the prefix, e.g. (\"fn:\" \"eqn:\" \"item:\").
654 nil Never trust a label prefix.
655
656 The only disadvantage of using this feature is that the label context
657 displayed in the label selection buffer along with each label is
658 simply some text after the label definition. This is no problem if you
659 place labels keeping this in mind (e.g. *before* the equation, *at
660 the beginning* of a fig/tab caption ...). Anyway, it is probably best
661 to use the regexp or the list value types to fine-tune this feature.
662 For example, if your document contains thousands of footnotes with
663 labels fn:xxx, you may want to set this variable to the value \"^fn:$\" or
664 \(\"fn:\"). Then RefTeX will still do extensive parsing for any
665 non-footnote labels."
666 :group 'reftex-defining-label-environments
667 :type '(choice
668 (const :tag "Always" t)
669 (const :tag "Never" nil)
670 (regexp)
671 (repeat :tag "List"
672 (string :tag "prefix (with colon)"))))
634 673
635 (defcustom reftex-special-environment-functions nil 674 (defcustom reftex-special-environment-functions nil
636 "List of functions to be called when trying to figure out current environment. 675 "List of functions to be called when trying to figure out current environment.
637 These are special functions to detect \"environments\" which do not 676 These are special functions to detect \"environments\" which do not
638 start with \\begin and end with \\end. Some LaTeX packages seem to 677 start with \\begin and end with \\end. Some LaTeX packages seem to
1007 Usually, only %l is needed. The other stuff is mainly for the echo area 1046 Usually, only %l is needed. The other stuff is mainly for the echo area
1008 display, and for (setq reftex-comment-citations t). 1047 display, and for (setq reftex-comment-citations t).
1009 1048
1010 %< as a special operator kills punctuation and space around it after the 1049 %< as a special operator kills punctuation and space around it after the
1011 string has been formatted. 1050 string has been formatted.
1051
1052 A pair of square brackets indicates an optional argument, and RefTeX
1053 will prompt for the values of these arguments.
1012 1054
1013 Beware that all this only works with BibTeX database files. When 1055 Beware that all this only works with BibTeX database files. When
1014 citations are made from the \\bibitems in an explicit thebibliography 1056 citations are made from the \\bibitems in an explicit thebibliography
1015 environment, only %l is available. 1057 environment, only %l is available.
1016 1058
1039 (repeat :tag "key-ed format strings" 1081 (repeat :tag "key-ed format strings"
1040 :value ((?\r . "\\cite{%l}") 1082 :value ((?\r . "\\cite{%l}")
1041 (?t . "\\cite{%l}") (?p . "\\cite{%l}")) 1083 (?t . "\\cite{%l}") (?p . "\\cite{%l}"))
1042 (cons (character :tag "Key character" ?\r) 1084 (cons (character :tag "Key character" ?\r)
1043 (string :tag "Format string" ""))))) 1085 (string :tag "Format string" "")))))
1086
1087 (defcustom reftex-cite-prompt-optional-args 'maybe
1088 "*Non-nil means, prompt for empty optional arguments in cite macros.
1089 When an entry in `reftex-cite-format' ist given with square brackets to
1090 indicate optional arguments (for example \\cite[][]{%l}), RefTeX can
1091 prompt for values. Possible values are:
1092
1093 nil Never prompt for optional arguments
1094 t Always prompt
1095 maybe Prompt only if `reftex-citation' was called with C-u prefix arg
1096
1097 Unnecessary empty optional arguments are removed before insertion into
1098 the buffer. See `reftex-cite-cleanup-optional-args'."
1099 :group 'reftex-citation-support
1100 :type '(choice
1101 (const :tag "Always" t)
1102 (const :tag "When called with prefix arg" maybe)
1103 (const :tag "Never" nil)))
1104
1105 (defcustom reftex-cite-cleanup-optional-args t
1106 "*Non-nil means, remove unnecessary empty optional arguments in cite macros.
1107 The cite macros provided by some packages (for example
1108 natbib) allow specifying two optional arguments, one for a prefix to
1109 the citation, and a second for a postfix. When only one optional
1110 argument is given, it is interpreted as postfix. When this option is
1111 t, RefTeX removes unnecessary empty optional arguments from the cite
1112 macro before insertion. For example, it will change
1113 \\cite[][]{Jones} -> \\cite{Jones}
1114 \\cite[][Chapter 1]{Jones} -> \\cite[Chapter 1]{Jones}
1115 \\cite[see][]{Jones} -> \\cite[see][]{Jones}
1116 \\cite[see][Chapter 1]{Jones} -> \\cite{Jones}
1117 Is is possible that other packages have other conventions about which
1118 optional argument is interpreted how - that is why this cleaning up
1119 can be turned off."
1120 :group 'reftex-citation-support
1121 :type 'boolean)
1044 1122
1045 (defcustom reftex-comment-citations nil 1123 (defcustom reftex-comment-citations nil
1046 "*Non-nil means add a comment for each citation describing the full entry. 1124 "*Non-nil means add a comment for each citation describing the full entry.
1047 The comment is formatted according to `reftex-cite-comment-format'." 1125 The comment is formatted according to `reftex-cite-comment-format'."
1048 :group 'reftex-citation-support 1126 :group 'reftex-citation-support