| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 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 |
|
|---|
| 38 |
|
|---|
| 39 |
(eval-and-compile |
|---|
| 40 |
(defconst reftex-label-alist-builtin |
|---|
| 41 |
'( |
|---|
| 42 |
|
|---|
| 43 |
(Sideways "Alias for -->rotating" (rotating)) |
|---|
| 44 |
(AMSTeX "amsmath with eqref macro" |
|---|
| 45 |
((nil ?e nil "~\\eqref{%s}") |
|---|
| 46 |
amsmath)) |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 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 |
|
|---|
| 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 |
|
|---|
| 124 |
|
|---|
| 125 |
)) |
|---|
| 126 |
|
|---|
| 127 |
) |
|---|
| 128 |
"The default label environment descriptions. |
|---|
| 129 |
Lower-case symbols correspond to a style file of the same name in the LaTeX |
|---|
| 130 |
distribution. 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. |
|---|
| 207 |
The 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. |
|---|
| 227 |
Lower-case symbols correspond to a style file of the same name in the LaTeX |
|---|
| 228 |
distribution. Mixed-case symbols are convenience aliases.") |
|---|
| 229 |
) |
|---|
| 230 |
|
|---|
| 231 |
|
|---|
| 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 |
|
|---|
| 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. |
|---|
| 252 |
The file name is expected after the command, either in braces or separated |
|---|
| 253 |
by 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. |
|---|
| 259 |
Standard LaTeX needs default is 7, but there are packages for which this |
|---|
| 260 |
needs to be larger." |
|---|
| 261 |
:group 'reftex-table-of-contents-browser |
|---|
| 262 |
:type 'integer) |
|---|
| 263 |
|
|---|
| 264 |
|
|---|
| 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) |
|---|
| 275 |
("addsec" . -2) |
|---|
| 276 |
|
|---|
| 277 |
) |
|---|
| 278 |
"Commands and levels used for defining sections in the document. |
|---|
| 279 |
This is an alist with each element like (COMMAND-NAME . LEVEL). |
|---|
| 280 |
The car of each cons cell is the name of the section macro (without |
|---|
| 281 |
the backslash). The cdr is a number indicating its level. A negative |
|---|
| 282 |
level means the same level as the positive value, but the section will |
|---|
| 283 |
never get a number. The cdr may also be a function which will be called |
|---|
| 284 |
to after the section-re matched to determine the level. |
|---|
| 285 |
This list is also used for promotion and demption of sectioning commands. |
|---|
| 286 |
If you are using a document class which has several sets of sectioning |
|---|
| 287 |
commands, promotion only works correctly if this list is sorted first |
|---|
| 288 |
by set, then within each set by level. The promotion commands always |
|---|
| 289 |
select 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. |
|---|
| 300 |
Section headings with a bigger level will be ignored. In RefTeX, chapters |
|---|
| 301 |
are level 1, sections are level 2 etc. |
|---|
| 302 |
This 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. |
|---|
| 308 |
This means, part numbers will be included in the numbering of chapters, and |
|---|
| 309 |
chapter counters will be reset for each part. |
|---|
| 310 |
When nil (the default), parts are special, do not reset the chapter counter |
|---|
| 311 |
and 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. |
|---|
| 318 |
When active, the *TOC* window will always show the section you |
|---|
| 319 |
are currently working in. Recentering happens whenever Emacs is idle for |
|---|
| 320 |
more than `reftex-idle-time' seconds. |
|---|
| 321 |
|
|---|
| 322 |
Value t means, turn on immediately when RefTeX gets started. Then, |
|---|
| 323 |
recentering will work for any toc window created during the session. |
|---|
| 324 |
|
|---|
| 325 |
Value 'frame (the default) means, turn automatic recentering on only while the |
|---|
| 326 |
dedicated TOC frame does exist, and do the recentering only in that frame. So |
|---|
| 327 |
when creating that frame (with \"d\" key in an ordinary TOC window), the |
|---|
| 328 |
automatic recentering is turned on. When the frame gets destroyed, automatic |
|---|
| 329 |
recentering is turned off again. |
|---|
| 330 |
|
|---|
| 331 |
This 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. |
|---|
| 346 |
See 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. |
|---|
| 355 |
This helps to keep the window configuration, but makes the *toc* small. |
|---|
| 356 |
When nil, all other windows except the selected one will be deleted, so |
|---|
| 357 |
that 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. |
|---|
| 363 |
This 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. |
|---|
| 369 |
This 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. |
|---|
| 375 |
This 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. |
|---|
| 381 |
When nil, the command is executed immediately. When this is an integer |
|---|
| 382 |
N, ask for confirmation only if N or more section commands are going to be |
|---|
| 383 |
changed." |
|---|
| 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. |
|---|
| 392 |
Context will only be shown when labels are visible as well. |
|---|
| 393 |
This 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. |
|---|
| 399 |
The other window will show the corresponding part of the document. |
|---|
| 400 |
This 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. |
|---|
| 406 |
When 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 |
|
|---|
| 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. |
|---|
| 430 |
The value of this variable is a list of symbols with associations in the |
|---|
| 431 |
constant `reftex-label-alist-builtin'. Check that constant for a full list |
|---|
| 432 |
of 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 |
|
|---|
| 449 |
This docstring is easier to understand after reading the configuration |
|---|
| 450 |
examples in `reftex.el'. Looking at the builtin defaults in the constant |
|---|
| 451 |
`reftex-label-alist-builtin' may also be instructive. |
|---|
| 452 |
|
|---|
| 453 |
Set this variable to define additions and changes to the default. The only |
|---|
| 454 |
things you MUST NOT change is that `?s' is the type indicator for section |
|---|
| 455 |
labels, and SPC for the `any' label type. These are hard-coded at other |
|---|
| 456 |
places in the code. |
|---|
| 457 |
|
|---|
| 458 |
The value of the variable must be a list of items. Each item is a list |
|---|
| 459 |
itself and has the following structure: |
|---|
| 460 |
|
|---|
| 461 |
(ENV-OR-MACRO TYPE-KEY LABEL-PREFIX REFERENCE-FORMAT CONTEXT-METHOD |
|---|
| 462 |
(MAGIC-WORD ... ) TOC-LEVEL) |
|---|
| 463 |
|
|---|
| 464 |
Each list entry describes either an environment carrying a counter for use |
|---|
| 465 |
with \\label and \\ref, or a LaTeX macro defining a label as (or inside) |
|---|
| 466 |
one of its arguments. The elements of each list entry are: |
|---|
| 467 |
|
|---|
| 468 |
ENV-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 |
|
|---|
| 488 |
TYPE-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 |
|
|---|
| 499 |
LABEL-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 |
|
|---|
| 512 |
REFERENCE-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 |
|
|---|
| 518 |
CONTEXT-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 |
|
|---|
| 556 |
MAGIC-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 |
|
|---|
| 565 |
TOC-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 |
|
|---|
| 573 |
If the type indicator characters of two or more entries are the same, RefTeX |
|---|
| 574 |
will use |
|---|
| 575 |
- the first non-nil format and prefix |
|---|
| 576 |
- the magic words of all involved entries. |
|---|
| 577 |
|
|---|
| 578 |
Any 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 |
|---|
| 580 |
list. 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. |
|---|
| 628 |
When the label prefix given in an entry in `reftex-label-alist' contains `%S', |
|---|
| 629 |
this list is used to determine the correct prefix string depending on the |
|---|
| 630 |
current section level. |
|---|
| 631 |
The list is an alist, with each entry of the form (KEY . PREFIX) |
|---|
| 632 |
Possible 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. |
|---|
| 649 |
The form (format regexp (regexp-quote environment)) is used to calculate |
|---|
| 650 |
the final regular expression - so %s will be replaced with the environment |
|---|
| 651 |
or 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. |
|---|
| 657 |
It is customary to use special label prefixes to distinguish different label |
|---|
| 658 |
types. The label prefixes have no syntactic meaning in LaTeX (unless |
|---|
| 659 |
special packages like fancyref are being used). RefTeX can and by |
|---|
| 660 |
default does parse around each label to detect the correct label type, |
|---|
| 661 |
but this process can be slow when a document contains thousands of |
|---|
| 662 |
labels. If you use label prefixes consistently, you may speed up |
|---|
| 663 |
document parsing by setting this variable to a non-nil value. RefTeX |
|---|
| 664 |
will then compare the label prefix with the prefixes found in |
|---|
| 665 |
`reftex-label-alist' and derive the correct label type in this way. |
|---|
| 666 |
Possible values for this option are: |
|---|
| 667 |
|
|---|
| 668 |
t This means to trust any label prefixes found. |
|---|
| 669 |
regexp If a regexp, only prefixes matched by the regexp are trusted. |
|---|
| 670 |
list List of accepted prefixes, as strings. The colon is part of |
|---|
| 671 |
the prefix, e.g. (\"fn:\" \"eqn:\" \"item:\"). |
|---|
| 672 |
nil Never trust a label prefix. |
|---|
| 673 |
|
|---|
| 674 |
The only disadvantage of using this feature is that the label context |
|---|
| 675 |
displayed in the label selection buffer along with each label is |
|---|
| 676 |
simply some text after the label definition. This is no problem if you |
|---|
| 677 |
place labels keeping this in mind (e.g. *before* the equation, *at |
|---|
| 678 |
the beginning* of a fig/tab caption ...). Anyway, it is probably best |
|---|
| 679 |
to use the regexp or the list value types to fine-tune this feature. |
|---|
| 680 |
For example, if your document contains thousands of footnotes with |
|---|
| 681 |
labels 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 |
|---|
| 683 |
non-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. |
|---|
| 694 |
These are special functions to detect \"environments\" which do not |
|---|
| 695 |
start with \\begin and end with \\end. Some LaTeX packages seem to |
|---|
| 696 |
use such non-standard ways to set up environment-like constructs. The |
|---|
| 697 |
purpose of each function in this list is to detect if point is |
|---|
| 698 |
currently inside such a special \"environment\". If the environment |
|---|
| 699 |
carries a label, you must also set up an entry for it in |
|---|
| 700 |
`reftex-label-alist'. |
|---|
| 701 |
|
|---|
| 702 |
The function should check if point is currently in the special |
|---|
| 703 |
environment it was written to detect. If so, the function must return |
|---|
| 704 |
a cons cell (NAME . POSITION). NAME is the name of the environment |
|---|
| 705 |
detected and POSITION is the buffer position where the environment |
|---|
| 706 |
starts. The function must return nil on failure to detect the |
|---|
| 707 |
environment. |
|---|
| 708 |
|
|---|
| 709 |
The function must take an argument BOUND. If non-nil, BOUND is a |
|---|
| 710 |
boundary for backwards searches which should be observed. |
|---|
| 711 |
|
|---|
| 712 |
Here 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 |
|---|
| 714 |
line. |
|---|
| 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 |
|
|---|
| 722 |
And here is the setup for RefTeX: |
|---|
| 723 |
|
|---|
| 724 |
1. 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 |
|
|---|
| 731 |
2. 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 |
|
|---|
| 750 |
3. 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 |
|
|---|
| 758 |
|
|---|
| 759 |
(defgroup reftex-making-and-inserting-labels nil |
|---|
| 760 |
"Options on how to create new labels." |
|---|
| 761 |
:group 'reftex-label-support) |
|---|
| 762 |
|
|---|
|
|---|