24
|
1 ;;; latex.el --- Support for LaTeX documents.
|
|
2 ;;
|
|
3 ;; Maintainer: Per Abrahamsen <auc-tex@sunsite.auc.dk>
|
153
|
4 ;; Version: 9.7p
|
24
|
5 ;; Keywords: wp
|
|
6 ;; X-URL: http://sunsite.auc.dk/auctex
|
|
7
|
|
8 ;; Copyright 1991 Kresten Krab Thorup
|
|
9 ;; Copyright 1993, 1994, 1995, 1996, 1997 Per Abrahamsen
|
|
10 ;;
|
|
11 ;; This program is free software; you can redistribute it and/or modify
|
|
12 ;; it under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 1, or (at your option)
|
|
14 ;; any later version.
|
|
15 ;;
|
|
16 ;; This program is distributed in the hope that it will be useful,
|
|
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
19 ;; GNU General Public License for more details.
|
|
20 ;;
|
|
21 ;; You should have received a copy of the GNU General Public License
|
|
22 ;; along with this program; if not, write to the Free Software
|
|
23 ;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
24
|
|
25 ;;; Code:
|
|
26
|
|
27 (require 'tex)
|
|
28
|
|
29 ;;; Syntax
|
|
30
|
|
31 (defvar LaTeX-optop "["
|
|
32 "The LaTeX optional argument opening character.")
|
|
33 (make-variable-buffer-local 'LaTeX-optop)
|
|
34
|
|
35 (defvar LaTeX-optcl "]"
|
|
36 "The LaTeX optional argument closeing character.")
|
|
37 (make-variable-buffer-local 'LaTeX-optcl)
|
|
38
|
|
39 ;;; Style
|
|
40
|
153
|
41 (defcustom LaTeX-default-style "article"
|
|
42 "*Default when creating new documents."
|
|
43 :group 'LaTeX-environment
|
|
44 :type 'string)
|
24
|
45
|
|
46 (make-variable-buffer-local 'LaTeX-default-style)
|
|
47
|
153
|
48 (defcustom LaTeX-default-options nil
|
|
49 "Default options to documentstyle.
|
|
50 A list of strings."
|
|
51 :group 'LaTeX-environment
|
|
52 :type '(repeat (string :format "%v")))
|
24
|
53
|
|
54 (make-variable-buffer-local 'LaTeX-default-options)
|
|
55
|
|
56 ;;; Syntax Table
|
|
57
|
|
58 (defvar LaTeX-mode-syntax-table (copy-syntax-table TeX-mode-syntax-table)
|
|
59 "Syntax table used in LaTeX mode.")
|
|
60
|
|
61 (progn ; set [] to match for LaTeX.
|
|
62 (modify-syntax-entry (string-to-char LaTeX-optop)
|
|
63 (concat "(" LaTeX-optcl)
|
|
64 LaTeX-mode-syntax-table)
|
|
65 (modify-syntax-entry (string-to-char LaTeX-optcl)
|
|
66 (concat ")" LaTeX-optop)
|
|
67 LaTeX-mode-syntax-table))
|
|
68
|
|
69 ;;; Sections
|
|
70
|
|
71 (defun LaTeX-section (arg)
|
|
72 "Insert a template for a LaTeX section.
|
|
73 Determinate the type of section to be inserted, by the argument ARG.
|
|
74
|
|
75 If ARG is nil or missing, use the current level.
|
|
76 If ARG is a list (selected by C-u), go downward one level.
|
|
77 If ARG is negative, go up that many levels.
|
|
78 If ARG is positive or zero, use absolute level:
|
|
79
|
|
80 0 : part
|
|
81 1 : chapter
|
|
82 2 : section
|
|
83 3 : subsection
|
|
84 4 : subsubsection
|
|
85 5 : paragraph
|
|
86 6 : subparagraph
|
|
87
|
|
88 The following variables can be set to customize:
|
|
89
|
|
90 LaTeX-section-hook Hooks to run when inserting a section.
|
|
91 LaTeX-section-label Prefix to all section labels."
|
|
92
|
|
93 (interactive "*P")
|
|
94 (let* ((val (prefix-numeric-value arg))
|
|
95 (level (cond ((null arg)
|
|
96 (LaTeX-current-section))
|
|
97 ((listp arg)
|
|
98 (LaTeX-down-section))
|
|
99 ((< val 0)
|
|
100 (LaTeX-up-section (- val)))
|
|
101 (t val)))
|
|
102 (name (LaTeX-section-name level))
|
|
103 (toc nil)
|
|
104 (title "")
|
|
105 (done-mark (make-marker)))
|
|
106 (newline)
|
|
107 (run-hooks 'LaTeX-section-hook)
|
|
108 (newline)
|
|
109 (if (marker-position done-mark)
|
|
110 (goto-char (marker-position done-mark)))
|
|
111 (set-marker done-mark nil)))
|
|
112
|
|
113 (defun LaTeX-current-section ()
|
|
114 "Return the level of the section that contain point.
|
|
115 See also LaTeX-section for description of levels."
|
|
116 (save-excursion
|
|
117 (max (LaTeX-largest-level)
|
|
118 (if (re-search-backward (LaTeX-outline-regexp) nil t)
|
|
119 (- (LaTeX-outline-level) (LaTeX-outline-offset))
|
|
120 (LaTeX-largest-level)))))
|
|
121
|
|
122 (defun LaTeX-down-section ()
|
153
|
123 "Return the value of a section one level under the current.
|
|
124 Tries to find what kind of section that have been used earlier in the
|
|
125 text, if this fail, it will just return one less than the current
|
|
126 section."
|
24
|
127 (save-excursion
|
|
128 (let ((current (LaTeX-current-section))
|
|
129 (next nil)
|
|
130 (regexp (LaTeX-outline-regexp)))
|
|
131 (if (not (re-search-backward regexp nil t))
|
|
132 (1+ current)
|
|
133 (while (not next)
|
|
134 (cond
|
|
135 ((eq (LaTeX-current-section) current)
|
|
136 (if (re-search-forward regexp nil t)
|
|
137 (if (<= (setq next (LaTeX-current-section)) current) ;Wow!
|
|
138 (setq next (1+ current)))
|
|
139 (setq next (1+ current))))
|
|
140 ((not (re-search-backward regexp nil t))
|
|
141 (setq next (1+ current)))))
|
|
142 next))))
|
|
143
|
|
144 (defun LaTeX-up-section (arg)
|
|
145 "Return the value of the section ARG levels above this one."
|
|
146 (save-excursion
|
|
147 (if (zerop arg)
|
|
148 (LaTeX-current-section)
|
|
149 (let ((current (LaTeX-current-section)))
|
|
150 (while (and (>= (LaTeX-current-section) current)
|
|
151 (re-search-backward (LaTeX-outline-regexp)
|
|
152 nil t)))
|
|
153 (LaTeX-up-section (1- arg))))))
|
|
154
|
|
155 (defvar LaTeX-section-list '(("part" 0)
|
|
156 ("chapter" 1)
|
|
157 ("section" 2)
|
|
158 ("subsection" 3)
|
|
159 ("subsubsection" 4)
|
|
160 ("paragraph" 5)
|
|
161 ("subparagraph" 6))
|
|
162 "List which elements is the names of the sections used by LaTeX.")
|
|
163
|
|
164 (defun LaTeX-section-name (level)
|
|
165 "Return the name of the section corresponding to LEVEL."
|
|
166 (let ((entry (TeX-member level LaTeX-section-list
|
|
167 (function (lambda (a b) (equal a (nth 1 b)))))))
|
|
168 (if entry
|
|
169 (nth 0 entry)
|
|
170 nil)))
|
|
171
|
|
172 (defun LaTeX-section-level (name)
|
|
173 "Return the level of the section NAME."
|
|
174 (let ((entry (TeX-member name LaTeX-section-list
|
|
175 (function (lambda (a b) (equal a (nth 0 b)))))))
|
|
176
|
|
177 (if entry
|
|
178 (nth 1 entry)
|
|
179 nil)))
|
|
180
|
153
|
181 (defcustom TeX-outline-extra nil
|
|
182 "List of extra TeX outline levels.
|
24
|
183
|
|
184 Each element is a list with two entries. The first entry is the
|
|
185 regular expression matching a header, and the second is the level of
|
153
|
186 the header. See LaTeX-section-list for existing header levels."
|
|
187 :group 'LaTeX
|
|
188 :type '(repeat (group (regexp :tag "Match")
|
|
189 (integer :tag "Level"))))
|
24
|
190
|
|
191 (defun LaTeX-outline-regexp (&optional anywhere)
|
|
192 "Return regexp for LaTeX sections.
|
|
193
|
|
194 If optional argument ANYWHERE is not nil, do not require that the
|
|
195 header is at the start of a line."
|
|
196 (concat (if anywhere "" "^")
|
|
197 "[ \t]*"
|
|
198 (regexp-quote TeX-esc)
|
|
199 "\\(appendix\\|documentstyle\\|documentclass\\|"
|
|
200 (mapconcat 'car LaTeX-section-list "\\|")
|
|
201 "\\)\\b"
|
|
202 (if TeX-outline-extra
|
|
203 "\\|"
|
|
204 "")
|
|
205 (mapconcat 'car TeX-outline-extra "\\|")
|
|
206 "\\|" TeX-header-end
|
|
207 "\\|" TeX-trailer-start))
|
|
208
|
|
209 (defvar LaTeX-largest-level nil
|
|
210 "Largest sectioning level with current document style")
|
|
211
|
|
212 (make-variable-buffer-local 'LaTeX-largest-level)
|
|
213
|
|
214 (defun LaTeX-largest-level ()
|
|
215 (TeX-update-style)
|
|
216 LaTeX-largest-level)
|
|
217
|
|
218 (defun LaTeX-outline-offset ()
|
|
219 "Offset to add to LaTeX-section-list levels to get outline level."
|
|
220 (- 2 (LaTeX-largest-level)))
|
|
221
|
|
222 (defun TeX-look-at (list)
|
|
223 "Check if we are looking at the first element of a member of LIST.
|
|
224 If so, return the second element, otherwise return nil."
|
|
225 (while (and list
|
|
226 (not (looking-at (nth 0 (car list)))))
|
|
227 (setq list (cdr list)))
|
|
228 (if list
|
|
229 (nth 1 (car list))
|
|
230 nil))
|
|
231
|
|
232 (defun LaTeX-outline-level ()
|
|
233 "Find the level of current outline heading in an LaTeX document."
|
|
234 (cond ((looking-at LaTeX-header-end) 1)
|
|
235 ((looking-at LaTeX-trailer-start) 1)
|
|
236 ((TeX-look-at TeX-outline-extra)
|
|
237 (max 1 (+ (TeX-look-at TeX-outline-extra)
|
|
238 (LaTeX-outline-offset))))
|
|
239 (t
|
|
240 (save-excursion
|
|
241 (skip-chars-forward " \t")
|
|
242 (forward-char 1)
|
|
243 (cond ((looking-at "appendix") 1)
|
|
244 ((looking-at "documentstyle") 1)
|
|
245 ((looking-at "documentclass") 1)
|
|
246 ((TeX-look-at LaTeX-section-list)
|
|
247 (max 1 (+ (TeX-look-at LaTeX-section-list)
|
|
248 (LaTeX-outline-offset))))
|
|
249 (t
|
|
250 (error "Unrecognized header")))))))
|
|
251
|
|
252 (add-hook 'TeX-remove-style-hook
|
|
253 (function (lambda () (setq LaTeX-largest-level nil))))
|
|
254
|
153
|
255 (defcustom LaTeX-section-hook
|
24
|
256 '(LaTeX-section-heading
|
|
257 LaTeX-section-title
|
|
258 ;; LaTeX-section-toc ; Most people won't want this
|
|
259 LaTeX-section-section
|
|
260 LaTeX-section-label)
|
153
|
261 "List of hooks to run when a new section is inserted.
|
24
|
262
|
|
263 The following variables are set before the hooks are run
|
|
264
|
|
265 level - numeric section level, see the documentation of `LaTeX-section'.
|
|
266 name - name of the sectioning command, derived from `level'.
|
|
267 title - The title of the section, default to an empty string.
|
|
268 toc - Entry for the table of contents list, default nil.
|
|
269 done-mark - Position of point afterwards, default nil (meaning end).
|
|
270
|
|
271 The following standard hook exist -
|
|
272
|
|
273 LaTeX-section-heading: Query the user about the name of the
|
|
274 sectioning command. Modifies `level' and `name'.
|
|
275
|
|
276 LaTeX-section-title: Query the user about the title of the
|
|
277 section. Modifies `title'.
|
|
278
|
|
279 LaTeX-section-toc: Query the user for the toc entry. Modifies
|
|
280 `toc'.
|
|
281
|
|
282 LaTeX-section-section: Insert LaTeX section command according to
|
|
283 `name', `title', and `toc'. If `toc' is nil, no toc entry is
|
|
284 enserted. If `toc' or `title' are empty strings, `done-mark' will be
|
|
285 placed at the point they should be inserted.
|
|
286
|
|
287 LaTeX-section-label: Insert a label after the section command.
|
|
288 Controled by the variable `LaTeX-section-label'.
|
|
289
|
|
290 To get a full featured LaTeX-section command, insert
|
|
291
|
|
292 (setq LaTeX-section-hook
|
|
293 '(LaTeX-section-heading
|
|
294 LaTeX-section-title
|
|
295 LaTeX-section-toc
|
|
296 LaTeX-section-section
|
|
297 LaTeX-section-label))
|
|
298
|
153
|
299 in your .emacs file."
|
|
300 :type 'hook
|
|
301 :options '(LaTeX-section-heading
|
|
302 LaTeX-section-title
|
|
303 LaTeX-section-toc
|
|
304 LaTeX-section-section
|
|
305 LaTeX-section-label))
|
24
|
306
|
153
|
307
|
|
308 (defcustom LaTeX-section-label
|
24
|
309 '(("chapter" . "cha:")
|
|
310 ("section" . "sec:")
|
|
311 ("subsection" . "sec:"))
|
153
|
312 "Default prefix when asking for a label.
|
24
|
313
|
|
314 If it is a string, it it used unchanged for all kinds of sections.
|
|
315 If it is nil, no label is inserted.
|
|
316 If it is a list, the list is searched for a member whose car is equal
|
|
317 to the name of the sectioning command being inserted. The cdr is then
|
|
318 used as the prefix. If the name is not found, or if the cdr is nil,
|
153
|
319 no label is inserted."
|
|
320 :group 'LaTeX-label
|
|
321 :type '(choice (const :tag "none" nil)
|
|
322 (string :format "%v" :tag "Common")
|
|
323 (repeat :menu-tag "Level specific"
|
|
324 :format "\n%v%i"
|
|
325 (cons :format "%v"
|
|
326 (string :tag "Type")
|
|
327 (choice :tag "Prefix"
|
|
328 (const :tag "none" nil)
|
|
329 (string :format "%v"))))))
|
24
|
330
|
|
331 ;;; Section Hooks.
|
|
332
|
|
333 (defun LaTeX-section-heading ()
|
|
334 "Hook to prompt for LaTeX section name.
|
|
335 Insert this hook into LaTeX-section-hook to allow the user to change
|
153
|
336 the name of the sectioning command inserted with `\\[LaTeX-section]'."
|
24
|
337 (let ((string (completing-read
|
|
338 (concat "Select level: (default " name ") ")
|
|
339 LaTeX-section-list
|
|
340 nil nil nil)))
|
|
341 ; Update name
|
|
342 (if (not (zerop (length string)))
|
|
343 (setq name string))
|
|
344 ; Update level
|
|
345 (setq level (LaTeX-section-level name))))
|
|
346
|
|
347 (defun LaTeX-section-title ()
|
|
348 "Hook to prompt for LaTeX section title.
|
|
349 Insert this hook into LaTeX-section-hook to allow the user to change
|
153
|
350 the title of the section inserted with `\\[LaTeX-section]."
|
24
|
351 (setq title (read-string "What title: ")))
|
|
352
|
|
353 (defun LaTeX-section-toc ()
|
|
354 "Hook to prompt for the LaTeX section entry in the table of content .
|
|
355 Insert this hook into LaTeX-section-hook to allow the user to insert
|
|
356 a different entry for the section in the table of content."
|
|
357 (setq toc (read-string "Toc Entry: "))
|
|
358 (if (zerop (length toc))
|
|
359 (setq toc nil)))
|
|
360
|
|
361 (defun LaTeX-section-section ()
|
|
362 "Hook to insert LaTeX section command into the file.
|
|
363 Insert this hook into LaTeX-section-hook after those hooks which sets
|
|
364 the `name', `title', and `toc' variables, but before those hooks which
|
|
365 assumes the section already is inserted."
|
|
366 (insert TeX-esc name)
|
|
367 (cond ((null toc))
|
|
368 ((zerop (length toc))
|
|
369 (insert LaTeX-optop)
|
|
370 (set-marker done-mark (point))
|
|
371 (insert LaTeX-optcl))
|
|
372 (t
|
|
373 (insert LaTeX-optop toc LaTeX-optcl)))
|
|
374 (insert TeX-grop)
|
|
375 (if (zerop (length title))
|
|
376 (set-marker done-mark (point)))
|
|
377 (insert title TeX-grcl)
|
|
378 (newline))
|
|
379
|
|
380 (defun LaTeX-section-label ()
|
|
381 "Hook to insert a label after the sectioning command.
|
|
382 Insert this hook into LaTeX-section-hook to prompt for a label to be
|
|
383 inserted after the sectioning command.
|
|
384
|
|
385 The beaviour of this hook is controled by LaTeX-section-label."
|
|
386 (and (LaTeX-label name)
|
|
387 (newline)))
|
|
388
|
|
389 ;;; Environments
|
|
390
|
153
|
391 (defgroup LaTeX-environment nil
|
|
392 "Environments in AUC TeX."
|
|
393 :group 'LaTeX-macro)
|
|
394
|
|
395 (defcustom LaTeX-default-environment "itemize"
|
|
396 "*The default environment when creating new ones with LaTeX-environment."
|
|
397 :group 'LaTeX-environment
|
|
398 :type 'string)
|
24
|
399 (make-variable-buffer-local 'LaTeX-default-environment)
|
|
400
|
|
401 (defun LaTeX-environment (arg)
|
|
402 "Make LaTeX environment (\\begin{...}-\\end{...} pair).
|
|
403 With optional ARG, modify current environment.
|
|
404
|
|
405 It may be customized with the following variables:
|
|
406
|
|
407 LaTeX-default-environment Your favorite environment.
|
|
408 LaTeX-default-style Your favorite document style.
|
|
409 LaTeX-default-options Your favorite document style options.
|
|
410 LaTeX-float Where you want figures and tables to float.
|
|
411 LaTeX-table-label Your prefix to labels in tables.
|
|
412 LaTeX-figure-label Your prefix to labels in figures.
|
|
413 LaTeX-default-format Format for array and tabular.
|
|
414 LaTeX-default-position Position for array and tabular."
|
|
415
|
|
416 (interactive "*P")
|
|
417 (let ((environment (completing-read (concat "Environment type: (default "
|
|
418 (if (TeX-near-bobp)
|
|
419 "document"
|
|
420 LaTeX-default-environment)
|
|
421 ") ")
|
|
422 (LaTeX-environment-list))))
|
|
423 ;; Get default
|
|
424 (cond ((and (zerop (length environment))
|
|
425 (TeX-near-bobp))
|
|
426 (setq environment "document"))
|
|
427 ((zerop (length environment))
|
|
428 (setq environment LaTeX-default-environment))
|
|
429 (t
|
|
430 (setq LaTeX-default-environment environment)))
|
|
431
|
|
432 (let ((entry (assoc environment (LaTeX-environment-list))))
|
|
433 (if (null entry)
|
|
434 (LaTeX-add-environments (list environment)))
|
|
435
|
|
436 (if arg
|
|
437 (LaTeX-modify-environment environment)
|
|
438 (LaTeX-environment-menu environment)))))
|
|
439
|
|
440 (defun LaTeX-environment-menu (environment)
|
|
441 ;; Insert ENVIRONMENT around point or region.
|
|
442 (let ((entry (assoc environment (LaTeX-environment-list))))
|
|
443 (cond ((not (and entry (nth 1 entry)))
|
|
444 (LaTeX-insert-environment environment))
|
|
445 ((numberp (nth 1 entry))
|
|
446 (let ((count (nth 1 entry))
|
|
447 (args ""))
|
|
448 (while (> count 0)
|
|
449 (setq args (concat args TeX-grop TeX-grcl))
|
|
450 (setq count (- count 1)))
|
|
451 (LaTeX-insert-environment environment args)))
|
|
452 ((stringp (nth 1 entry))
|
|
453 (let ((prompts (cdr entry))
|
|
454 (args ""))
|
|
455 (while prompts
|
|
456 (setq args (concat args
|
|
457 TeX-grop
|
|
458 (read-from-minibuffer (concat (car prompts)
|
|
459 ": "))
|
|
460 TeX-grcl))
|
|
461 (setq prompts (cdr prompts)))
|
|
462 (LaTeX-insert-environment environment args)))
|
|
463 (t
|
|
464 (apply (nth 1 entry) environment (nthcdr 2 entry))))))
|
|
465
|
|
466 (defun LaTeX-close-environment ()
|
|
467 "Creates an \\end{...} to match the current environment."
|
|
468 (interactive "*")
|
|
469 (if (> (point)
|
|
470 (save-excursion
|
|
471 (beginning-of-line)
|
|
472 (skip-chars-forward " \t")
|
|
473 (point)))
|
|
474 (insert "\n"))
|
|
475 (insert "\\end{" (LaTeX-current-environment 1) "}")
|
|
476 (LaTeX-indent-line)
|
|
477 (if (not (looking-at "[ \t]*$"))
|
|
478 (insert "\n")
|
|
479 (let ((next-line-add-newlines t))
|
|
480 (next-line 1)
|
|
481 (beginning-of-line)))
|
|
482 (LaTeX-indent-line))
|
|
483
|
|
484 (autoload 'outline-flag-region "outline")
|
|
485
|
|
486 (defun LaTeX-hide-environment ()
|
|
487 "Hide current LaTeX environment using selective display."
|
|
488 (interactive)
|
|
489 (outline-flag-region (save-excursion (LaTeX-find-matching-begin) (point))
|
|
490 (save-excursion (LaTeX-find-matching-end) (point))
|
|
491 ?\r))
|
|
492
|
|
493 (defun LaTeX-show-environment ()
|
|
494 "Show current LaTeX environment."
|
|
495 (interactive)
|
|
496 (outline-flag-region (save-excursion (LaTeX-find-matching-begin) (point))
|
|
497 (save-excursion (LaTeX-find-matching-end) (point))
|
|
498 ?\n))
|
|
499
|
|
500 (defun LaTeX-insert-environment (environment &optional extra)
|
|
501 "Insert environment of type ENV, with optional argument EXTRA."
|
|
502 (if (and (TeX-active-mark)
|
|
503 (not (eq (mark) (point))))
|
|
504 (progn
|
|
505 (if (< (mark) (point))
|
|
506 (exchange-point-and-mark))
|
|
507 (or (TeX-looking-at-backward "^[ \t]*")
|
|
508 (newline))
|
|
509 (insert TeX-esc "begin" TeX-grop environment TeX-grcl)
|
|
510 (LaTeX-indent-line)
|
|
511 (if extra (insert extra))
|
|
512 (newline)
|
|
513 (goto-char (mark))
|
|
514 (or (TeX-looking-at-backward "^[ \t]*")
|
|
515 (newline))
|
|
516 (insert TeX-esc "end" TeX-grop environment TeX-grcl)
|
|
517 (or (looking-at "[ \t]*$")
|
|
518 (save-excursion (newline-and-indent)))
|
|
519 (LaTeX-indent-line)
|
|
520 (end-of-line 0)
|
|
521 (or (assoc environment LaTeX-indent-environment-list)
|
|
522 (LaTeX-fill-environment nil)))
|
|
523 (or (TeX-looking-at-backward "^[ \t]*")
|
|
524 (newline))
|
|
525 (insert TeX-esc "begin" TeX-grop environment TeX-grcl)
|
|
526 (LaTeX-indent-line)
|
|
527 (if extra (insert extra))
|
|
528 (newline-and-indent)
|
|
529 (newline)
|
|
530 (insert TeX-esc "end" TeX-grop environment TeX-grcl)
|
|
531 (or (looking-at "[ \t]*$")
|
|
532 (save-excursion (newline-and-indent)))
|
|
533 (LaTeX-indent-line)
|
|
534 (end-of-line 0)))
|
|
535
|
|
536 (defun LaTeX-modify-environment (environment)
|
|
537 ;; Modify current environment.
|
|
538 (save-excursion
|
|
539 (LaTeX-find-matching-end)
|
|
540 (re-search-backward (concat (regexp-quote TeX-esc)
|
|
541 "end"
|
|
542 (regexp-quote TeX-grop)
|
|
543 " *\\([a-zA-Z*]*\\)"
|
|
544 (regexp-quote TeX-grcl))
|
|
545 (save-excursion (beginning-of-line 1) (point)))
|
|
546 (replace-match (concat TeX-esc "end" TeX-grop environment TeX-grcl) t t)
|
|
547 (beginning-of-line 1)
|
|
548 (LaTeX-find-matching-begin)
|
|
549 (re-search-forward (concat (regexp-quote TeX-esc)
|
|
550 "begin"
|
|
551 (regexp-quote TeX-grop)
|
|
552 " *\\([a-zA-Z*]*\\)"
|
|
553 (regexp-quote TeX-grcl))
|
|
554 (save-excursion (end-of-line 1) (point)))
|
|
555 (replace-match (concat TeX-esc "begin" TeX-grop environment TeX-grcl) t t)))
|
|
556
|
|
557 (defun LaTeX-current-environment (&optional arg)
|
|
558 "Return the name (a string) of the enclosing LaTeX environment.
|
|
559 With optional ARG>=1, find that outer level."
|
|
560 (setq arg (if arg (if (< arg 1) 1 arg) 1))
|
|
561 (save-excursion
|
|
562 (while (and
|
|
563 (/= arg 0)
|
|
564 (re-search-backward
|
|
565 (concat (regexp-quote TeX-esc) "begin" (regexp-quote TeX-grop)
|
|
566 "\\|"
|
|
567 (regexp-quote TeX-esc) "end" (regexp-quote TeX-grop))
|
|
568 nil t 1))
|
|
569 (cond ((TeX-in-comment)
|
|
570 (beginning-of-line 1))
|
|
571 ((looking-at (concat (regexp-quote TeX-esc)
|
|
572 "end" (regexp-quote TeX-grop)))
|
|
573 (setq arg (1+ arg)))
|
|
574 (t
|
|
575 (setq arg (1- arg)))))
|
|
576 (if (/= arg 0)
|
|
577 "document"
|
|
578 (search-forward TeX-grop)
|
|
579 (let ((beg (point)))
|
|
580 (search-forward TeX-grcl)
|
|
581 (backward-char 1)
|
|
582 (buffer-substring beg (point))))))
|
|
583
|
|
584 (defun TeX-near-bobp ()
|
|
585 ;; Return t iff there's nothing but whitespace between (bob) and (point).
|
|
586 (save-excursion
|
|
587 (skip-chars-backward " \t\n")
|
|
588 (bobp)))
|
|
589
|
|
590 ;;; Environment Hooks
|
|
591
|
|
592 (defvar LaTeX-document-style-hook nil
|
|
593 "List of hooks to run when inserting a document style environment.
|
|
594
|
|
595 To insert a hook here, you must insert it in the appropiate style file.")
|
|
596
|
|
597 (defun LaTeX-env-document (&optional ignore)
|
|
598 "Create new LaTeX document."
|
|
599
|
|
600 (TeX-insert-macro (if (string-equal LaTeX-version "2")
|
|
601 "documentstyle"
|
|
602 "documentclass"))
|
|
603
|
|
604 (newline 3)
|
|
605 (end-of-line 0)
|
|
606 (LaTeX-insert-environment "document")
|
|
607 (run-hooks 'LaTeX-document-style-hook)
|
|
608 (setq LaTeX-document-style-hook nil))
|
|
609
|
153
|
610 (defcustom LaTeX-float "htbp"
|
24
|
611 "*Default float when creating figure and table environments.
|
153
|
612 Set to nil if you don't want any float."
|
|
613 :group 'LaTeX-environment
|
|
614 :type '(choice (const :tag "none" nil)
|
|
615 (string :format "%v")))
|
24
|
616 (make-variable-buffer-local 'LaTeX-float)
|
|
617
|
153
|
618 (defgroup LaTeX-label nil
|
|
619 "Adding labels for LaTeX commands in AUC TeX."
|
|
620 :group 'LaTeX)
|
|
621
|
|
622 (defcustom LaTeX-label-function nil
|
24
|
623 "*A function inserting a label at point.
|
|
624 Sole argument of the function is the environment. The function has to return
|
153
|
625 the label inserted, or nil if no label was inserted."
|
|
626 :group 'LaTeX-label
|
|
627 :type 'function)
|
24
|
628
|
153
|
629 (defcustom LaTeX-figure-label "fig:"
|
|
630 "*Default prefix to figure labels."
|
|
631 :group 'LaTeX-label
|
|
632 :group 'LaTeX-environment
|
|
633 :type 'string)
|
24
|
634 (make-variable-buffer-local 'LaTeX-figure-label)
|
|
635
|
153
|
636 (defcustom LaTeX-table-label "tab:"
|
|
637 "*Default prefix to table labels."
|
|
638 :group 'LaTeX-label
|
|
639 :group 'LaTeX-environment
|
|
640 :type 'string)
|
24
|
641 (make-variable-buffer-local 'LaTeX-table-label)
|
|
642
|
153
|
643 (defcustom LaTeX-default-format ""
|
|
644 "Specifies the default format string for array and tabular environments."
|
|
645 :group 'LaTeX-environment
|
|
646 :type 'string)
|
24
|
647 (make-variable-buffer-local 'LaTeX-default-format)
|
|
648
|
153
|
649 (defcustom LaTeX-default-position ""
|
|
650 "Specifies the default position string for array and tabular environments."
|
|
651 :group 'LaTeX-environment
|
|
652 :type 'string)
|
24
|
653 (make-variable-buffer-local 'LaTeX-default-position)
|
|
654
|
153
|
655 (defcustom LaTeX-equation-label "eq:"
|
|
656 "*Default prefix to equation labels."
|
|
657 :group 'LaTeX-label
|
|
658 :type 'string)
|
|
659 (make-variable-buffer-local 'LaTeX-equation-label)
|
|
660
|
|
661 (defcustom LaTeX-eqnarray-label LaTeX-equation-label
|
|
662 "*Default prefix to eqnarray labels."
|
|
663 :group 'LaTeX-label
|
|
664 :type 'string)
|
|
665 (make-variable-buffer-local 'LaTeX-eqnarray-label)
|
|
666
|
24
|
667 (defun LaTeX-env-item (environment)
|
|
668 "Insert ENVIRONMENT and the first item."
|
|
669 (LaTeX-insert-environment environment)
|
|
670 (if (TeX-active-mark)
|
|
671 (progn
|
|
672 (LaTeX-find-matching-begin)
|
|
673 (end-of-line 1))
|
|
674 (end-of-line 0))
|
|
675 (delete-char 1)
|
|
676 (delete-horizontal-space)
|
|
677 (LaTeX-insert-item))
|
|
678
|
|
679 (defun LaTeX-label (environment)
|
|
680 "Insert a label for ENVIRONMENT at point.
|
|
681 If LaTeX-label-function is a valid function, LaTeX label will transfer the
|
|
682 job to this function."
|
|
683 (let (label)
|
|
684 (if (and (boundp 'LaTeX-label-function)
|
|
685 LaTeX-label-function
|
|
686 (fboundp LaTeX-label-function))
|
|
687
|
|
688 (setq label (funcall LaTeX-label-function environment))
|
|
689 (let ((prefix
|
|
690 (cond
|
|
691 ((string= "figure" environment) LaTeX-figure-label)
|
|
692 ((string= "table" environment) LaTeX-table-label)
|
153
|
693 ((string= "figure*" environment) LaTeX-figure-label)
|
|
694 ((string= "table*" environment) LaTeX-table-label)
|
|
695 ((string= "equation" environment) LaTeX-equation-label)
|
|
696 ((string= "eqnarray" environment) LaTeX-eqnarray-label)
|
24
|
697 ((assoc environment LaTeX-section-list)
|
|
698 (cond
|
|
699 ((stringp LaTeX-section-label) LaTeX-section-label)
|
|
700 ((and (listp LaTeX-section-label)
|
|
701 (assoc environment LaTeX-section-label))
|
|
702 (cdr (assoc environment LaTeX-section-label)))
|
|
703 (t nil)))
|
|
704 (t ""))))
|
|
705 (if prefix
|
|
706 (progn
|
|
707 (setq label (read-string "What label: " prefix))
|
|
708 (if (string= prefix label)
|
|
709 (setq label nil) ; No label eneterd
|
|
710 (insert TeX-esc "label" TeX-grop label TeX-grcl)))))
|
|
711 (if label
|
|
712 (progn
|
|
713 (LaTeX-add-labels label)
|
|
714 label)
|
|
715 nil))))
|
|
716
|
|
717
|
|
718 (defun LaTeX-env-figure (environment)
|
|
719 "Create ENVIRONMENT with \\label and \\caption commands."
|
|
720 (let ((float (read-string "Float to: " LaTeX-float))
|
|
721 (caption (read-string "Caption: "))
|
|
722 (center (y-or-n-p "Center: ")))
|
|
723
|
|
724 (setq LaTeX-float (if (zerop (length float))
|
|
725 LaTeX-float
|
|
726 float))
|
|
727
|
|
728 (LaTeX-insert-environment environment
|
|
729 (and LaTeX-float
|
|
730 (concat LaTeX-optop
|
|
731 LaTeX-float
|
|
732 LaTeX-optcl)))
|
|
733
|
|
734 (if center
|
|
735 (progn
|
|
736 (LaTeX-insert-environment "center")))
|
|
737
|
|
738 (newline-and-indent)
|
|
739 (LaTeX-label environment)
|
|
740 (end-of-line 0)
|
|
741 (LaTeX-indent-line)
|
|
742
|
|
743 (if (zerop (length caption))
|
|
744 ()
|
|
745 ;; NOTE: Caption is _inside_ center because that looks best typeset.
|
|
746 (newline-and-indent)
|
|
747 (insert TeX-esc "caption" TeX-grop caption TeX-grcl)
|
|
748 (end-of-line 0)
|
|
749 (LaTeX-indent-line))
|
153
|
750
|
|
751 (if (member environment '("table" "table*"))
|
|
752 (LaTeX-env-array "tabular"))))
|
24
|
753
|
|
754 (defun LaTeX-env-array (environment)
|
153
|
755 "Insert ENVIRONMENT with position and column specifications.
|
|
756 Just like array and tabular."
|
24
|
757 (let ((pos (read-string "Position: "))
|
|
758 (fmt (read-string "Format: " LaTeX-default-format)))
|
|
759 (setq LaTeX-default-position pos)
|
|
760 (setq LaTeX-default-format fmt)
|
|
761 (LaTeX-insert-environment environment
|
|
762 (concat
|
|
763 (if (not (zerop (length pos)))
|
|
764 (format "[%s]" pos))
|
|
765 (format "{%s}" fmt)))
|
|
766 (end-of-line 0)
|
|
767 (next-line 1)
|
|
768 (delete-horizontal-space)))
|
|
769
|
|
770 (defun LaTeX-env-label (environment)
|
|
771 "Insert ENVIRONMENT and prompt for label."
|
|
772 (LaTeX-insert-environment environment)
|
|
773 (and (LaTeX-label environment)
|
|
774 (newline-and-indent)))
|
|
775
|
|
776 (defun LaTeX-env-list (environment)
|
|
777 "Insert ENVIRONMENT and the first item."
|
|
778 (let ((label (read-string "Default Label: ")))
|
|
779 (LaTeX-insert-environment environment
|
|
780 (format "{%s}{}" label))
|
|
781 (end-of-line 0)
|
|
782 (delete-char 1)
|
|
783 (delete-horizontal-space))
|
|
784 (LaTeX-insert-item))
|
|
785
|
|
786 (defun LaTeX-env-minipage (environment)
|
|
787 "Create new LaTeX minipage."
|
|
788 (let ((pos (read-string "Position: " LaTeX-default-position))
|
|
789 (width (read-string "Width: ")))
|
|
790 (setq LaTeX-default-position pos)
|
|
791 (if (zerop (length width))
|
|
792 (setq width "4cm"))
|
|
793 (LaTeX-insert-environment environment
|
|
794 (concat (if (not (zerop (length pos)))
|
|
795 (format "[%s]" pos))
|
|
796 (format "{%s}" width)))
|
|
797 (end-of-line 0)
|
|
798 (next-line 1)
|
|
799 (delete-horizontal-space)))
|
|
800
|
|
801 (defun LaTeX-env-tabular* (environment)
|
|
802 "Insert ENVIRONMENT with width, position and column specifications."
|
|
803 (let ((width (read-string "Width: "))
|
|
804 (pos (read-string "Position: " LaTeX-default-position))
|
|
805 (fmt (read-string "Format: " LaTeX-default-format)))
|
|
806 (setq LaTeX-default-position pos)
|
|
807 (setq LaTeX-default-format fmt)
|
|
808 (LaTeX-insert-environment environment
|
|
809 (concat
|
|
810 (if (not (zerop (length width)))
|
|
811 (format "{%s}" width))
|
|
812 (if (not (zerop (length pos)))
|
|
813 (format "[%s]" pos))
|
|
814 (format "{%s}" fmt)))
|
|
815 (end-of-line 0)
|
|
816 (next-line 1)
|
|
817 (delete-horizontal-space)))
|
|
818
|
|
819 (defun LaTeX-env-picture (environment)
|
|
820 "Insert ENVIRONMENT with width, height specifications."
|
|
821 (let ((width (read-string "Width: "))
|
|
822 (height (read-string "Height: "))
|
|
823 (x-offset (read-string "X Offset: "))
|
|
824 (y-offset (read-string "Y Offset: ")))
|
|
825 (if (zerop (length x-offset))
|
|
826 (setq x-offset "0"))
|
|
827 (if (zerop (length y-offset))
|
|
828 (setq y-offset "0"))
|
|
829 (LaTeX-insert-environment environment
|
|
830 (concat (format "(%s,%s)" width height)
|
|
831 (if (not (and (string= x-offset "0")
|
|
832 (string= y-offset "0")))
|
|
833 (format "(%s,%s)" x-offset y-offset))))
|
|
834
|
|
835 (end-of-line 0)
|
|
836 (next-line 1)
|
|
837 (delete-horizontal-space)))
|
|
838
|
|
839 (defun LaTeX-env-bib (environment)
|
|
840 "Insert ENVIRONMENT with label for bibitem."
|
|
841 (LaTeX-insert-environment environment
|
|
842 (concat TeX-grop
|
|
843 (read-string "Label for BibItem: " "99")
|
|
844 TeX-grcl))
|
|
845 (end-of-line 0)
|
|
846 (delete-char 1)
|
|
847 (delete-horizontal-space)
|
|
848 (LaTeX-insert-item))
|
|
849
|
|
850 ;;; Item hooks
|
|
851
|
|
852 (defvar LaTeX-item-list nil
|
|
853 "An list of environments where items have a special syntax.
|
|
854 The cdr is the name of the function, used to insert this kind of items.")
|
|
855
|
|
856 (defun LaTeX-insert-item ()
|
|
857 "Insert a new item in an environment.
|
|
858 You may use LaTeX-item-list to change the routines used to insert the item."
|
|
859 (interactive "*")
|
|
860 (let ((environment (LaTeX-current-environment)))
|
|
861 (newline)
|
|
862 (if (assoc environment LaTeX-item-list)
|
|
863 (funcall (cdr (assoc environment LaTeX-item-list)))
|
|
864 (TeX-insert-macro "item"))
|
|
865 (LaTeX-indent-line)))
|
|
866
|
|
867 (defun LaTeX-item-argument ()
|
|
868 "Insert a new item with an optional argument."
|
|
869 (let ((TeX-arg-item-label-p t))
|
|
870 (TeX-insert-macro "item")))
|
|
871
|
|
872 (defun LaTeX-item-bib ()
|
|
873 "Insert a new bibitem."
|
|
874 (TeX-insert-macro "bibitem"))
|
|
875
|
|
876 ;;; Parser
|
|
877
|
|
878 (defvar LaTeX-auto-minimal-regexp-list
|
|
879 '(("\\\\document\\(style\\|class\\)\
|
|
880 \\(\\[\\(\\([^#\\\\\\.%]\\|%[^\n\r]*[\n\r]\\)+\\)\\]\\)?\
|
|
881 {\\([^#\\\\\\.\n\r]+\\)}"
|
|
882 (3 5 1) LaTeX-auto-style))
|
|
883 "Minimal list of regular expressions matching LaTeX macro definitions.")
|
|
884
|
|
885 (defvar LaTeX-auto-label-regexp-list
|
|
886 '(("\\\\label{\\([^\n\r%\\{}]+\\)}" 1 LaTeX-auto-label))
|
|
887 "List of regular expression matching LaTeX labels only.")
|
|
888
|
|
889 (defvar LaTeX-auto-regexp-list
|
|
890 (append
|
|
891 '(("\\\\newcommand{?\\\\\\([a-zA-Z]+\\)}?\\[\\([0-9]+\\)\\]\
|
|
892 \\[\\([^\]\\\\\n\r]+\\)\\]"
|
|
893 (1 2 3) LaTeX-auto-optional)
|
|
894 ("\\\\newcommand{?\\\\\\([a-zA-Z]+\\)}?\\[\\([0-9]+\\)\\]"
|
|
895 (1 2) LaTeX-auto-arguments)
|
|
896 ("\\\\newcommand{?\\\\\\([a-zA-Z]+\\)}?" 1 TeX-auto-symbol)
|
|
897 ("\\\\newenvironment{?\\([a-zA-Z]+\\)}?\\[\\([0-9]+\\)\\]\\["
|
|
898 1 LaTeX-auto-environment)
|
|
899 ("\\\\newenvironment{?\\([a-zA-Z]+\\)}?\\[\\([0-9]+\\)\\]"
|
|
900 (1 2) LaTeX-auto-env-args)
|
|
901 ("\\\\newenvironment{?\\([a-zA-Z]+\\)}?" 1 LaTeX-auto-environment)
|
|
902 ("\\\\newtheorem{\\([a-zA-Z]+\\)}" 1 LaTeX-auto-environment)
|
|
903 ("\\\\input{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
|
|
904 1 TeX-auto-file)
|
|
905 ("\\\\include{\\(\\.*[^#}%\\\\\\.\n\r]+\\)\\(\\.[^#}%\\\\\\.\n\r]+\\)?}"
|
|
906 1 TeX-auto-file)
|
|
907 ("\\\\usepackage\\(\\[[^\]\\\\]*\\]\\)?\
|
|
908 {\\(\\([^#}\\\\\\.%]\\|%[^\n\r]*[\n\r]\\)+\\)}"
|
|
909 (2) LaTeX-auto-style)
|
|
910 ("\\\\bibitem{\\([a-zA-Z][^, \n\r\t%\"#'()={}]*\\)}" 1 LaTeX-auto-bibitem)
|
|
911 ("\\\\bibitem\\[[^][\n\r]+\\]{\\([a-zA-Z][^, \n\r\t%\"#'()={}]*\\)}"
|
|
912 1 LaTeX-auto-bibitem)
|
|
913 ("\\\\bibliography{\\([^#}\\\\\n\r]+\\)}" 1 LaTeX-auto-bibliography))
|
|
914 LaTeX-auto-label-regexp-list
|
|
915 LaTeX-auto-minimal-regexp-list)
|
|
916 "List of regular expression matching common LaTeX macro definitions.")
|
|
917
|
|
918 (defun LaTeX-auto-prepare ()
|
|
919 ;; Prepare for LaTeX parsing.
|
|
920 (setq LaTeX-auto-arguments nil
|
|
921 LaTeX-auto-optional nil
|
|
922 LaTeX-auto-env-args nil
|
|
923 LaTeX-auto-style nil
|
|
924 LaTeX-auto-end-symbol nil))
|
|
925
|
|
926 (add-hook 'TeX-auto-prepare-hook 'LaTeX-auto-prepare)
|
|
927
|
|
928 (defun LaTeX-auto-cleanup ()
|
|
929 ;; Cleanup after LaTeX parsing.
|
|
930
|
|
931 ;; Cleanup BibTeX files
|
|
932 (setq LaTeX-auto-bibliography
|
|
933 (apply 'append (mapcar (function (lambda (arg)
|
|
934 (TeX-split-string "," arg)))
|
|
935 LaTeX-auto-bibliography)))
|
|
936
|
|
937 ;; Cleanup document styles and packages
|
|
938 (if (null LaTeX-auto-style)
|
|
939 ()
|
|
940 (while LaTeX-auto-style
|
|
941 (let* ((entry (car LaTeX-auto-style))
|
|
942 (options (nth 0 entry))
|
|
943 (style (nth 1 entry))
|
|
944 (class (nth 2 entry)))
|
|
945
|
|
946 ;; Next document style.
|
|
947 (setq LaTeX-auto-style (cdr LaTeX-auto-style))
|
|
948
|
|
949 ;; Get the options.
|
|
950 (setq options (TeX-split-string
|
|
951 "\\([ \t\r\n]\\|%[^\n\r]*[\n\r]\\|,\\)+"
|
|
952 options))
|
|
953
|
|
954 ;; Strip empty options.
|
|
955 (if (string-equal (car options) "")
|
|
956 (setq options (cdr options)))
|
|
957 (let ((index options))
|
|
958 (while (cdr-safe index)
|
|
959 (if (string-equal (car (cdr index)) "")
|
|
960 (setcdr index (cdr (cdr index)))
|
|
961 (setq index (cdr index)))))
|
|
962
|
|
963 ;; Add them, to the style list.
|
|
964 (setq TeX-auto-file (append options TeX-auto-file))
|
|
965
|
|
966 ;; The second argument if present is a normal style file.
|
|
967 (if (null style)
|
|
968 ()
|
|
969 (setq TeX-auto-file (cons style TeX-auto-file))
|
|
970
|
|
971 ;; And a special "art10" style file combining style and size.
|
|
972 (setq TeX-auto-file
|
|
973 (cons (concat
|
|
974 (cond ((string-equal "article" style)
|
|
975 "art")
|
|
976 ((string-equal "book" style)
|
|
977 "bk")
|
|
978 ((string-equal "report" style)
|
|
979 "rep")
|
|
980 ((string-equal "jarticle" style)
|
|
981 "jart")
|
|
982 ((string-equal "jbook" style)
|
|
983 "jbk")
|
|
984 ((string-equal "jreport" style)
|
|
985 "jrep")
|
|
986 ((string-equal "j-article" style)
|
|
987 "j-art")
|
|
988 ((string-equal "j-book" style)
|
|
989 "j-bk")
|
|
990 ((string-equal "j-report" style )
|
|
991 "j-rep")
|
|
992 (t style))
|
|
993 (cond ((member "11pt" options)
|
|
994 "11")
|
|
995 ((member "12pt" options)
|
|
996 "12")
|
|
997 (t
|
|
998 "10")))
|
|
999 TeX-auto-file)))
|
|
1000
|
|
1001 ;; The third argument if "class" indicates LaTeX2e features.
|
|
1002 (cond ((equal class "class")
|
|
1003 (setq TeX-auto-file (cons "latex2e" TeX-auto-file)))
|
|
1004 ((equal class "style")
|
|
1005 (setq TeX-auto-file (cons "latex2" TeX-auto-file)))))))
|
|
1006
|
|
1007 ;; Cleanup optional arguments
|
|
1008 (mapcar (function (lambda (entry)
|
|
1009 (setq TeX-auto-symbol
|
|
1010 (cons (list (nth 0 entry)
|
|
1011 (string-to-int (nth 1 entry)))
|
|
1012 TeX-auto-symbol))))
|
|
1013 LaTeX-auto-arguments)
|
|
1014
|
|
1015 ;; Cleanup default optional arguments
|
|
1016 (mapcar (function (lambda (entry)
|
|
1017 (setq TeX-auto-symbol
|
|
1018 (cons (list (nth 0 entry)
|
|
1019 (vector "argument")
|
|
1020 (1- (string-to-int (nth 1 entry))))
|
|
1021 TeX-auto-symbol))))
|
|
1022 LaTeX-auto-optional)
|
|
1023
|
|
1024 ;; Cleanup environments arguments
|
|
1025 (mapcar (function (lambda (entry)
|
|
1026 (setq LaTeX-auto-environment
|
|
1027 (cons (list (nth 0 entry)
|
|
1028 (string-to-int (nth 1 entry)))
|
|
1029 LaTeX-auto-environment))))
|
|
1030 LaTeX-auto-env-args)
|
|
1031
|
|
1032 ;; Cleanup use of def to add environments
|
|
1033 ;; NOTE: This uses an O(N^2) algorithm, while an O(N log N)
|
|
1034 ;; algorithm is possible.
|
|
1035 (mapcar (function (lambda (symbol)
|
|
1036 (if (not (TeX-member symbol TeX-auto-symbol 'equal))
|
|
1037 ;; No matching symbol, insert in list
|
|
1038 (setq TeX-auto-symbol
|
|
1039 (cons (concat "end" symbol) TeX-auto-symbol))
|
|
1040 ;; Matching symbol found, remove from list
|
|
1041 (if (equal (car TeX-auto-symbol) symbol)
|
|
1042 ;; Is it the first symbol?
|
|
1043 (setq TeX-auto-symbol (cdr TeX-auto-symbol))
|
|
1044 ;; Nope! Travel the list
|
|
1045 (let ((list TeX-auto-symbol))
|
|
1046 (while (consp (cdr list))
|
|
1047 ;; Until we find it.
|
|
1048 (if (equal (car (cdr list)) symbol)
|
|
1049 ;; Then remove it.
|
|
1050 (setcdr list (cdr (cdr list))))
|
|
1051 (setq list (cdr list)))))
|
|
1052 ;; and add the symbol as an environment.
|
|
1053 (setq LaTeX-auto-environment
|
|
1054 (cons symbol LaTeX-auto-environment)))))
|
|
1055 LaTeX-auto-end-symbol))
|
|
1056
|
|
1057 (add-hook 'TeX-auto-cleanup-hook 'LaTeX-auto-cleanup)
|
|
1058
|
|
1059 (TeX-auto-add-type "label" "LaTeX")
|
|
1060 (TeX-auto-add-type "bibitem" "LaTeX")
|
|
1061 (TeX-auto-add-type "environment" "LaTeX")
|
|
1062 (TeX-auto-add-type "bibliography" "LaTeX" "bibliographies")
|
|
1063
|
|
1064 (fset 'LaTeX-add-bibliographies-auto
|
|
1065 (symbol-function 'LaTeX-add-bibliographies))
|
|
1066 (defun LaTeX-add-bibliographies (&rest bibliographies)
|
|
1067 "Add BIBLIOGRAPHIES to the list of known bibliographies and style files."
|
|
1068 (apply 'LaTeX-add-bibliographies-auto bibliographies)
|
|
1069 (apply 'TeX-run-style-hooks bibliographies))
|
|
1070
|
|
1071 (fset 'LaTeX-add-environments-auto
|
|
1072 (symbol-function 'LaTeX-add-environments))
|
|
1073 (defun LaTeX-add-environments (&rest environments)
|
|
1074 "Add ENVIRONMENTS to the list of known environments."
|
|
1075 (apply 'LaTeX-add-environments-auto environments)
|
|
1076 (setq LaTeX-menu-changed t))
|
|
1077
|
|
1078 ;;; BibTeX
|
|
1079
|
|
1080 ;;;###autoload
|
|
1081 (defun BibTeX-auto-store ()
|
|
1082 "This function should be called from bibtex-mode-hook.
|
|
1083 It will setup BibTeX to store keys in an auto file."
|
|
1084 ;; We want this to be early in the list, so we do not
|
|
1085 ;; add it before we enter BibTeX mode the first time.
|
|
1086 (if (boundp 'local-write-file-hooks)
|
|
1087 (add-hook 'local-write-file-hooks 'TeX-safe-auto-write)
|
|
1088 (add-hook 'write-file-hooks 'TeX-safe-auto-write))
|
|
1089 (make-local-variable 'TeX-auto-update)
|
|
1090 (setq TeX-auto-update 'BibTeX)
|
|
1091 (make-local-variable 'TeX-auto-untabify)
|
|
1092 (setq TeX-auto-untabify nil)
|
|
1093 (make-local-variable 'TeX-auto-parse-length)
|
|
1094 (setq TeX-auto-parse-length 999999)
|
|
1095 (make-local-variable 'TeX-auto-regexp-list)
|
|
1096 (setq TeX-auto-regexp-list BibTeX-auto-regexp-list))
|
|
1097
|
|
1098 (defvar BibTeX-auto-regexp-list
|
|
1099 '(("@[Ss][Tt][Rr][Ii][Nn][Gg]" 1 ignore)
|
|
1100 ("@[a-zA-Z]+[{(][ \t]*\\([a-zA-Z][^, \n\r\t%\"#'()={}]*\\)"
|
|
1101 1 LaTeX-auto-bibitem))
|
|
1102 "List of regexp-list expressions matching BibTeX items.")
|
|
1103
|
|
1104 ;;; Macro Argument Hooks
|
|
1105
|
|
1106 (defun TeX-arg-conditional (optional expr then else)
|
|
1107 "Implement if EXPR THEN ELSE.
|
|
1108
|
|
1109 If EXPR evaluate to true, parse THEN as an argument list, else parse
|
|
1110 ELSE as an argument list."
|
|
1111 (TeX-parse-arguments (if (eval expr) then else)))
|
|
1112
|
|
1113 (defun TeX-arg-free (optional &optional &rest args)
|
|
1114 "Parse its arguments but use no braces when they are inserted."
|
|
1115 (let ((< "")
|
|
1116 (> ""))
|
|
1117 (if (equal (length args) 1)
|
|
1118 (TeX-parse-argument optional (car args))
|
|
1119 (TeX-parse-argument optional args))))
|
|
1120
|
|
1121 (defun TeX-arg-literal (optional &optional &rest args)
|
|
1122 "Insert its arguments into the buffer.
|
|
1123 Used for specifying extra syntax for a macro."
|
|
1124 (apply 'insert args))
|
|
1125
|
|
1126 (defun TeX-arg-eval (optional &rest args)
|
|
1127 "Evaluate args and insert value in buffer."
|
|
1128 (TeX-argument-insert (eval args) optional))
|
|
1129
|
|
1130 (defun TeX-arg-label (optional &optional prompt definition)
|
|
1131 "Prompt for a label completing with known labels."
|
|
1132 (let ((label (completing-read (TeX-argument-prompt optional prompt "Key")
|
|
1133 (LaTeX-label-list))))
|
|
1134 (if (and definition (not (string-equal "" label)))
|
|
1135 (LaTeX-add-labels label))
|
|
1136 (TeX-argument-insert label optional optional)))
|
|
1137
|
|
1138 (defun TeX-arg-macro (optional &optional prompt definition)
|
|
1139 "Prompt for a TeX macro with completion."
|
|
1140 (let ((macro (completing-read (TeX-argument-prompt optional prompt
|
|
1141 (concat "Macro: "
|
|
1142 TeX-esc)
|
|
1143 t)
|
|
1144 (TeX-symbol-list))))
|
|
1145 (if (and definition (not (string-equal "" macro)))
|
|
1146 (TeX-add-symbols macro))
|
|
1147 (TeX-argument-insert macro optional TeX-esc)))
|
|
1148
|
|
1149 (defun TeX-arg-environment (optional &optional prompt definition)
|
|
1150 "Prompt for a LaTeX environment with completion."
|
|
1151 (let ((environment (completing-read (TeX-argument-prompt optional prompt
|
|
1152 "Environment")
|
|
1153 (TeX-symbol-list))))
|
|
1154 (if (and definition (not (string-equal "" environment)))
|
|
1155 (LaTeX-add-environments environment))
|
|
1156
|
|
1157 (TeX-argument-insert environment optional)))
|
|
1158
|
|
1159 (defun TeX-arg-cite (optional &optional prompt definition)
|
|
1160 "Prompt for a BibTeX citation with completion."
|
|
1161 (setq prompt (concat (if optional "(Optional) " "")
|
|
1162 (if prompt prompt "Add key")
|
|
1163 ": (default none) "))
|
|
1164 (let ((items (multi-prompt "," t prompt (LaTeX-bibitem-list))))
|
|
1165 (apply 'LaTeX-add-bibitems items)
|
|
1166 (TeX-argument-insert (mapconcat 'identity items ",") optional optional)))
|
|
1167
|
|
1168 (defun TeX-arg-counter (optional &optional prompt definition)
|
|
1169 "Prompt for a LaTeX counter."
|
|
1170 ;; Completion not implemented yet.
|
|
1171 (TeX-argument-insert
|
|
1172 (read-string (TeX-argument-prompt optional prompt "Counter"))
|
|
1173 optional))
|
|
1174
|
|
1175 (defun TeX-arg-savebox (optional &optional prompt definition)
|
|
1176 "Prompt for a LaTeX savebox."
|
|
1177 ;; Completion not implemented yet.
|
|
1178 (TeX-argument-insert
|
|
1179 (read-string (TeX-argument-prompt optional prompt
|
|
1180 (concat "Savebox: " TeX-esc)
|
|
1181 t))
|
|
1182 optional TeX-esc))
|
|
1183
|
|
1184 (defun TeX-arg-file (optional &optional prompt)
|
|
1185 "Prompt for a filename in the current directory."
|
|
1186 (TeX-argument-insert (read-file-name (TeX-argument-prompt optional
|
|
1187 prompt "File")
|
|
1188 "" "" nil)
|
|
1189 optional))
|
|
1190
|
|
1191 (defun TeX-arg-define-label (optional &optional prompt)
|
|
1192 "Prompt for a label completing with known labels."
|
|
1193 (TeX-arg-label optional prompt t))
|
|
1194
|
|
1195 (defun TeX-arg-define-macro (optional &optional prompt)
|
|
1196 "Prompt for a TeX macro with completion."
|
|
1197 (TeX-arg-macro optional prompt t))
|
|
1198
|
|
1199 (defun TeX-arg-define-environment (optional &optional prompt)
|
|
1200 "Prompt for a LaTeX environment with completion."
|
|
1201 (TeX-arg-environment optional prompt t))
|
|
1202
|
|
1203 (defun TeX-arg-define-cite (optional &optional prompt)
|
|
1204 "Prompt for a BibTeX citation."
|
|
1205 (TeX-arg-cite optional prompt t))
|
|
1206
|
|
1207 (defun TeX-arg-define-counter (optional &optional prompt)
|
|
1208 "Prompt for a LaTeX counter."
|
|
1209 (TeX-arg-counter optional prompt t))
|
|
1210
|
|
1211 (defun TeX-arg-define-savebox (optional &optional prompt)
|
|
1212 "Prompt for a LaTeX savebox."
|
|
1213 (TeX-arg-savebox optional prompt t))
|
|
1214
|
153
|
1215 (defcustom LaTeX-style-list '(("book")
|
|
1216 ("article")
|
|
1217 ("letter")
|
|
1218 ("slides")
|
|
1219 ("report"))
|
|
1220 "List of document styles."
|
|
1221 :group 'LaTeX-environment
|
|
1222 :type '(repeat (group (string :format "%v"))))
|
24
|
1223
|
|
1224 (make-variable-buffer-local 'LaTeX-style-list)
|
|
1225
|
|
1226 (defun TeX-arg-document (optional &optional ignore)
|
|
1227 "Insert arguments to documentstyle and documentclass."
|
|
1228 (let ((style (completing-read
|
|
1229 (concat "Document style: (default " LaTeX-default-style ") ")
|
|
1230 LaTeX-style-list))
|
|
1231 (options (read-string "Options: "
|
|
1232 (if (stringp LaTeX-default-options)
|
|
1233 LaTeX-default-options
|
|
1234 (mapconcat 'identity
|
|
1235 LaTeX-default-options
|
|
1236 ",")))))
|
|
1237 (if (zerop (length style))
|
|
1238 (setq style LaTeX-default-style))
|
|
1239 (if (not (zerop (length options)))
|
|
1240 (insert LaTeX-optop options LaTeX-optcl))
|
|
1241 (insert TeX-grop style TeX-grcl))
|
|
1242
|
|
1243 ;; remove old information
|
|
1244 (TeX-remove-style)
|
|
1245
|
|
1246 ;; defined in individual style hooks
|
|
1247 (TeX-update-style))
|
|
1248
|
|
1249 (defvar TeX-global-input-files nil
|
153
|
1250 "List of the non-local TeX input files.
|
24
|
1251
|
|
1252 Initialized once at the first time you prompt for an input file.
|
|
1253 May be reset with `C-u \\[TeX-normal-mode]'.")
|
|
1254
|
|
1255 (defun TeX-arg-input-file (optionel &optional prompt local)
|
|
1256 "Prompt for a tex or sty file.
|
|
1257
|
|
1258 First optional argument is the promt, the second is a flag.
|
|
1259 If the flag is set, only complete with local files."
|
|
1260 (if (or TeX-global-input-files local)
|
|
1261 ()
|
|
1262 (message "Searching for files...")
|
|
1263 (setq TeX-global-input-files
|
|
1264 (mapcar 'list (TeX-search-files (append TeX-macro-private
|
|
1265 TeX-macro-global)
|
|
1266 TeX-file-extensions t t))))
|
|
1267 (let ((file (if TeX-check-path
|
|
1268 (completing-read
|
|
1269 (TeX-argument-prompt optionel prompt "File")
|
|
1270 (append (mapcar 'list
|
|
1271 (TeX-search-files '(".")
|
|
1272 TeX-file-extensions
|
|
1273 t t))
|
|
1274 (if local
|
|
1275 nil
|
|
1276 TeX-global-input-files)))
|
|
1277 (read-file-name
|
|
1278 (TeX-argument-prompt optionel prompt "File")))))
|
|
1279 (if (null file)
|
|
1280 (setq file ""))
|
|
1281 (if (not (string-equal "" file))
|
|
1282 (TeX-run-style-hooks file))
|
|
1283 (TeX-argument-insert file optionel)))
|
|
1284
|
|
1285 (defvar BibTeX-global-style-files nil
|
153
|
1286 "Association list of BibTeX style files.
|
24
|
1287
|
|
1288 Initialized once at the first time you prompt for an input file.
|
|
1289 May be reset with `C-u \\[TeX-normal-mode]'.")
|
|
1290
|
|
1291 (defun TeX-arg-bibstyle (optional &optional prompt)
|
|
1292 "Prompt for a BibTeX style file."
|
|
1293 (message "Searching for BibTeX styles...")
|
|
1294 (or BibTeX-global-style-files
|
|
1295 (setq BibTeX-global-style-files
|
|
1296 (mapcar 'list
|
|
1297 (TeX-search-files (append TeX-macro-private
|
|
1298 TeX-macro-global)
|
|
1299 BibTeX-style-extensions t t))))
|
|
1300
|
|
1301 (TeX-argument-insert
|
|
1302 (completing-read (TeX-argument-prompt optional prompt "BibTeX style")
|
|
1303 (append (mapcar 'list
|
|
1304 (TeX-search-files '(".")
|
|
1305 BibTeX-style-extensions
|
|
1306 t t))
|
|
1307 BibTeX-global-style-files))
|
|
1308 optional))
|
|
1309
|
|
1310 (defvar BibTeX-global-files nil
|
153
|
1311 "Association list of BibTeX files.
|
24
|
1312
|
|
1313 Initialized once at the first time you prompt for an BibTeX file.
|
|
1314 May be reset with `C-u \\[TeX-normal-mode]'.")
|
|
1315
|
|
1316 (defun TeX-arg-bibliography (optional &optional prompt)
|
|
1317 "Prompt for a BibTeX database file."
|
|
1318 (message "Searching for BibTeX files...")
|
|
1319 (or BibTeX-global-files
|
|
1320 (setq BibTeX-global-files
|
|
1321 (mapcar 'list (TeX-search-files nil BibTeX-file-extensions t t))))
|
|
1322
|
|
1323 (let ((styles (multi-prompt
|
|
1324 "," t
|
|
1325 (TeX-argument-prompt optional prompt "BibTeX files")
|
|
1326 (append (mapcar 'list
|
|
1327 (TeX-search-files '(".")
|
|
1328 BibTeX-file-extensions
|
|
1329 t t))
|
|
1330 BibTeX-global-files))))
|
|
1331 (apply 'LaTeX-add-bibliographies styles)
|
|
1332 (TeX-argument-insert (mapconcat 'identity styles ",") optional)))
|
|
1333
|
|
1334 (defun TeX-arg-corner (optional &optional prompt)
|
|
1335 "Prompt for a LaTeX side or corner position with completion."
|
|
1336 (TeX-argument-insert
|
|
1337 (completing-read (TeX-argument-prompt optional prompt "Position")
|
|
1338 '(("") ("l") ("r") ("t") ("b") ("tl") ("tr") ("bl") ("br"))
|
|
1339 nil t)
|
|
1340 optional))
|
|
1341
|
|
1342 (defun TeX-arg-lr (optional &optional prompt)
|
|
1343 "Prompt for a LaTeX side with completion."
|
|
1344 (TeX-argument-insert
|
|
1345 (completing-read (TeX-argument-prompt optional prompt "Position")
|
|
1346 '(("") ("l") ("r"))
|
|
1347 nil t)
|
|
1348 optional))
|
|
1349
|
|
1350 (defun TeX-arg-tb (optional &optional prompt)
|
|
1351 "Prompt for a LaTeX side with completion."
|
|
1352 (TeX-argument-insert
|
|
1353 (completing-read (TeX-argument-prompt optional prompt "Position")
|
|
1354 '(("") ("t") ("b"))
|
|
1355 nil t)
|
|
1356 optional))
|
|
1357
|
|
1358 (defun TeX-arg-pagestyle (optional &optional prompt)
|
|
1359 "Prompt for a LaTeX pagestyle with completion."
|
|
1360 (TeX-argument-insert
|
|
1361 (completing-read (TeX-argument-prompt optional prompt "Pagestyle")
|
|
1362 '(("plain") ("empty") ("headings") ("myheadings")))
|
|
1363 optional))
|
|
1364
|
|
1365 (defun TeX-arg-verb (optional &optional ignore)
|
|
1366 "Prompt for delimiter and text."
|
|
1367 (let ((del (read-quoted-char "Delimiter: "))
|
|
1368 (text (read-from-minibuffer "Text: ")))
|
|
1369 (insert del text del)))
|
|
1370
|
|
1371 (defun TeX-arg-pair (optional first second)
|
|
1372 "Insert a pair of number, prompted by FIRST and SECOND.
|
|
1373
|
|
1374 The numbers are surounded by parenthesizes and separated with a
|
|
1375 comma."
|
|
1376 (insert "(" (read-string (concat first ": ")) ","
|
|
1377 (read-string (concat second ": ")) ")"))
|
|
1378
|
|
1379 (defun TeX-arg-size (optional)
|
|
1380 "Insert width and height as a pair."
|
|
1381 (TeX-arg-pair optional "Width" "Height"))
|
|
1382
|
|
1383 (defun TeX-arg-coordinate (optional)
|
|
1384 "Insert x and y coordinate as a pair."
|
|
1385 (TeX-arg-pair optional "X position" "Y position"))
|
|
1386
|
|
1387 (defconst TeX-braces-default-association
|
|
1388 '(("[" . "]")
|
|
1389 ("\\{" . "\\}")
|
|
1390 ("(" . ")")
|
|
1391 ("|" . "|")
|
|
1392 ("\\|" . "\\|")
|
|
1393 ("/" . "/")
|
|
1394 ("\\backslash" . "\\backslash")
|
|
1395 ("\\lfloor" . "\\rfloor")
|
|
1396 ("\\lceil" . "\\rceil")
|
|
1397 ("\\langle" . "\\rangle")))
|
|
1398
|
153
|
1399 (defcustom TeX-braces-user-association nil
|
|
1400 "A list of your personal association of brace symbols.
|
|
1401 These are used for \\left and \\right.
|
24
|
1402
|
|
1403 The car of each entry is the brace used with \\left,
|
153
|
1404 the cdr is the brace used with \\right."
|
|
1405 :group 'LaTeX-macro
|
|
1406 :group 'LaTeX-math
|
|
1407 :type '(repeat (cons :format "%v"
|
|
1408 (string :tag "Left")
|
|
1409 (string :tag "Right"))))
|
24
|
1410
|
|
1411 (defvar TeX-braces-association
|
|
1412 (append TeX-braces-user-association
|
|
1413 TeX-braces-default-association)
|
|
1414 "A list of association of brace symbols for \\left and \\right.
|
|
1415 The car of each entry is the brace used with \\left,
|
|
1416 the cdr is the brace used with \\right.")
|
|
1417
|
|
1418 (defvar TeX-left-right-braces
|
|
1419 '(("[") ("]") ("\\{") ("\\}") ("(") (")") ("|") ("\\|")
|
|
1420 ("/") ("\\backslash") ("\\lfloor") ("\\rfloor")
|
|
1421 ("\\lceil") ("\\rceil") ("\\langle") ("\\rangle")
|
|
1422 ("\\uparrow") ("\\Uparrow") ("\\downarrow") ("\\Downarrow")
|
|
1423 ("\\updownarrow") ("\\Updownarrow") ("."))
|
|
1424 "List of symbols which can follow the \\left or \\right command")
|
|
1425
|
|
1426 (defun TeX-arg-insert-braces (optional &optional prompt)
|
|
1427 (save-excursion
|
|
1428 (backward-word 1)
|
|
1429 (backward-char)
|
|
1430 (newline-and-indent)
|
|
1431 (beginning-of-line 0)
|
|
1432 (if (looking-at "^[ \t]*$")
|
|
1433 (progn (delete-horizontal-space)
|
|
1434 (delete-char 1))))
|
|
1435 (let ((left-brace (completing-read
|
|
1436 (TeX-argument-prompt optional prompt "Which brace")
|
|
1437 TeX-left-right-braces)))
|
|
1438 (insert left-brace)
|
|
1439 (newline-and-indent)
|
|
1440 (save-excursion
|
|
1441 (let ((right-brace (cdr (assoc left-brace
|
|
1442 TeX-braces-association))))
|
|
1443 (newline)
|
|
1444 (insert TeX-esc "right")
|
|
1445 (if (and TeX-arg-right-insert-p
|
|
1446 right-brace)
|
|
1447 (insert right-brace)
|
|
1448 (insert (completing-read
|
|
1449 (TeX-argument-prompt optional prompt "Which brace")
|
|
1450 TeX-left-right-braces)))
|
|
1451 (LaTeX-indent-line)))))
|
|
1452
|
|
1453 ;;; Indentation
|
|
1454
|
153
|
1455 (defgroup LaTeX-indentation nil
|
|
1456 "Indentation of LaTeX code in AUC TeX"
|
|
1457 :group 'LaTeX
|
|
1458 :group 'TeX-indentation)
|
|
1459
|
|
1460 (defcustom LaTeX-indent-level 2
|
|
1461 "*Indentation of begin-end blocks in LaTeX."
|
|
1462 :group 'LaTeX-indentation
|
|
1463 :type 'integer)
|
24
|
1464
|
153
|
1465 (defcustom LaTeX-item-indent (- LaTeX-indent-level)
|
|
1466 "*Extra indentation for lines beginning with an item."
|
|
1467 :group 'LaTeX-indentation
|
|
1468 :type 'integer)
|
24
|
1469
|
153
|
1470 (defcustom LaTeX-item-regexp "\\(bib\\)?item\\b"
|
|
1471 "*Regular expression matching macros considered items."
|
|
1472 :group 'LaTeX-indentation
|
|
1473 :type 'regexp)
|
24
|
1474
|
|
1475 (defun LaTeX-indent-line ()
|
|
1476 "Indent the line containing point, as LaTeX source.
|
|
1477 Add LaTeX-indent-level indentation in each \\begin{ - \\end{ block.
|
|
1478 Lines starting with an item is given an extra indentation of
|
|
1479 LaTeX-item-indent."
|
|
1480 (interactive)
|
|
1481 (let ((indent (LaTeX-indent-calculate)))
|
|
1482 (save-excursion
|
|
1483 (if (/= (current-indentation) indent)
|
|
1484 (let ((beg (progn
|
|
1485 (beginning-of-line)
|
|
1486 (point))))
|
|
1487 (back-to-indentation)
|
|
1488 (delete-region beg (point))
|
|
1489 (indent-to indent))))
|
|
1490 (if (< (current-column) indent)
|
|
1491 (back-to-indentation))))
|
|
1492
|
|
1493 (defun LaTeX-fill-region-as-paragraph (from to &optional justify-flag)
|
153
|
1494 "Fill region as one paragraph.
|
|
1495 Break lines to fit fill-column, but leave all lines ending with \\\\
|
|
1496 \(plus its optional argument) alone. Prefix arg means justify too.
|
24
|
1497 From program, pass args FROM, TO and JUSTIFY-FLAG."
|
|
1498 (interactive "*r\nP")
|
|
1499 (or (assoc (LaTeX-current-environment) LaTeX-indent-environment-list)
|
|
1500 (save-restriction
|
|
1501 (narrow-to-region from to)
|
|
1502 (goto-char from)
|
|
1503 (while (not (eobp))
|
|
1504 (LaTeX-indent-line)
|
|
1505 (forward-line))
|
|
1506 (goto-char from)
|
|
1507 (while (not (eobp))
|
|
1508 (if
|
|
1509 (re-search-forward (concat "^.*"
|
|
1510 (regexp-quote TeX-esc)
|
|
1511 (regexp-quote TeX-esc)
|
|
1512 "\\(\\s-*\\*\\)?"
|
|
1513 "\\(\\s-*\\[[^]]*\\]\\)?\\s-*$")
|
|
1514 nil t)
|
|
1515 (progn
|
|
1516 (goto-char (match-end 0))
|
|
1517 (delete-horizontal-space)
|
|
1518 ;; I doubt very much if we want justify -
|
|
1519 ;; this is a line with \\
|
|
1520 ;; if you think otherwise - uncomment the next line
|
|
1521 ;; (and justify-flag (justify-current-line))
|
|
1522 (forward-char)
|
|
1523 ;; keep our position in a buffer
|
|
1524 (save-excursion
|
|
1525 (LaTeX-fill-region-as-para-do
|
|
1526 from (match-beginning 0) justify-flag))
|
|
1527 (setq from (point)))
|
|
1528 ;; ELSE part follows - loop termination relies on a fact
|
|
1529 ;; that (LaTeX-fill-region-as-para-do) moves point past
|
|
1530 ;; the filled region
|
|
1531 (LaTeX-fill-region-as-para-do from to justify-flag)))
|
|
1532 ;; the following four lines are clearly optional, but I like my
|
|
1533 ;; LaTeX code that way
|
|
1534 (goto-char (point-min))
|
|
1535 (while (search-forward "$$ " nil t)
|
|
1536 (replace-match "$$\n" t t)
|
|
1537 (LaTeX-indent-line)))))
|
|
1538
|
|
1539 (defun LaTeX-fill-region-as-para-do (from to justify-flag)
|
|
1540 "Fill region as one paragraph: break lines to fit fill-column."
|
|
1541 (if (< from to)
|
|
1542 (progn
|
|
1543 ;; (save-restriction) here is likely not needed because
|
|
1544 ;; it was done by a caller, but I am not sure - mj
|
|
1545 (save-restriction
|
|
1546 (goto-char from)
|
|
1547 (skip-chars-forward " \n")
|
|
1548 (LaTeX-indent-line)
|
|
1549 (beginning-of-line)
|
|
1550 (narrow-to-region (point) to)
|
|
1551 (setq from (point))
|
|
1552
|
|
1553 ;; from is now before the text to fill,
|
|
1554 ;; but after any fill prefix on the first line.
|
|
1555
|
|
1556 ;; Make sure sentences ending at end of line get an extra space.
|
|
1557 (if (or (not (boundp 'sentence-end-double-space))
|
|
1558 sentence-end-double-space)
|
|
1559 (progn
|
|
1560 (goto-char from)
|
|
1561 (while (re-search-forward "[.?!][]})\"']*$" nil t)
|
|
1562 (insert ? ))))
|
|
1563 ;; The change all newlines to spaces.
|
|
1564 (subst-char-in-region from (point-max) ?\n ?\ )
|
|
1565 ;; Flush excess spaces, except in the paragraph indentation.
|
|
1566 (goto-char from)
|
|
1567 (skip-chars-forward " \t")
|
|
1568 (while (re-search-forward " *" nil t)
|
|
1569 (delete-region
|
|
1570 (+ (match-beginning 0)
|
|
1571 (if (save-excursion
|
|
1572 (skip-chars-backward " ]})\"'")
|
|
1573 (memq (preceding-char) '(?. ?? ?!)))
|
|
1574 2 1))
|
|
1575 (match-end 0)))
|
|
1576 (goto-char (point-max))
|
|
1577 (delete-horizontal-space)
|
|
1578 (insert " ")
|
|
1579 (goto-char (point-min))
|
|
1580 (let ((prefixcol 0))
|
|
1581 (while (not (eobp))
|
|
1582 (move-to-column (1+ fill-column))
|
|
1583 (if (eobp)
|
|
1584 nil
|
|
1585 (skip-chars-backward "^ \n")
|
|
1586 (if (if (zerop prefixcol)
|
|
1587 (bolp)
|
|
1588 (>= prefixcol (current-column)))
|
|
1589 (skip-chars-forward "^ \n")
|
|
1590 (forward-char -1)))
|
|
1591 (delete-horizontal-space)
|
|
1592 (if (equal (preceding-char) ?\\)
|
|
1593 (insert ? ))
|
|
1594 (insert ?\n)
|
|
1595 (LaTeX-indent-line)
|
|
1596 (setq prefixcol (current-column))
|
|
1597 (and justify-flag (not (eobp))
|
|
1598 (progn
|
|
1599 (forward-line -1)
|
|
1600 (justify-current-line)
|
|
1601 (forward-line 1)))
|
|
1602 )
|
|
1603 (goto-char (point-max))
|
|
1604 (delete-horizontal-space))))))
|
|
1605
|
|
1606 (defun LaTeX-fill-paragraph (prefix)
|
|
1607 "Fill and indent paragraph at or after point.
|
|
1608 Prefix arg means justify as well."
|
|
1609 (interactive "*P")
|
|
1610 (save-excursion
|
|
1611 (beginning-of-line)
|
|
1612 (if (looking-at "[ \t]*%]")
|
|
1613 (re-search-forward "^[ \t]*[^% \t\n]"))
|
|
1614 (forward-paragraph)
|
|
1615 (or (bolp) (newline 1))
|
|
1616 (and (eobp) (open-line 1))
|
|
1617 (let ((end (point-marker))
|
|
1618 (start (progn
|
|
1619 (backward-paragraph)
|
|
1620 (point))))
|
|
1621 (LaTeX-fill-region-as-paragraph start end prefix))))
|
|
1622
|
|
1623 (defun LaTeX-fill-region (from to &optional justify what)
|
|
1624 "Fill and indent each of the paragraphs in the region as LaTeX text.
|
|
1625 Prefix arg (non-nil third arg, if called from program)
|
|
1626 means justify as well. Fourth arg WHAT is a word to be displayed when
|
|
1627 formatting."
|
|
1628 (interactive "*r\nP")
|
|
1629 (save-restriction
|
|
1630 (save-excursion
|
|
1631 (let ((length (- to from))
|
|
1632 (to (set-marker (make-marker) to)))
|
|
1633 (goto-char from)
|
|
1634 (beginning-of-line)
|
|
1635 (while (< (point) to)
|
|
1636 (message "Formatting%s ... %d%%"
|
|
1637 (if (not what)
|
|
1638 ""
|
|
1639 what)
|
|
1640 (/ (* 100 (- (point) from)) length))
|
|
1641 (save-excursion (LaTeX-fill-paragraph justify))
|
|
1642 (forward-paragraph 2)
|
|
1643 (if (not (eobp))
|
|
1644 (backward-paragraph)))
|
|
1645 (set-marker to nil)))
|
|
1646 (message "Finished")))
|
|
1647
|
|
1648 (defun LaTeX-find-matching-end ()
|
|
1649 "Move point to the \\end of the current environment"
|
|
1650 (interactive)
|
|
1651 (let ((regexp (concat (regexp-quote TeX-esc) "\\(begin\\|end\\)\\b"))
|
|
1652 (level 1))
|
|
1653 (beginning-of-line 1)
|
|
1654 (if (looking-at (concat " *" (regexp-quote TeX-esc) "begin\\b"))
|
|
1655 (end-of-line 1))
|
|
1656 (while (and (> level 0) (re-search-forward regexp nil t))
|
|
1657 (if (= (char-after (1+ (match-beginning 0))) ?b);;begin
|
|
1658 (setq level (1+ level))
|
|
1659 (setq level (1- level))))
|
|
1660 (if (= level 0)
|
|
1661 (search-forward "}")
|
|
1662 (error "Can't locate end of current environment"))))
|
|
1663
|
|
1664 (defun LaTeX-find-matching-begin ()
|
|
1665 "Move point to the \\begin of the current environment"
|
|
1666 (interactive)
|
|
1667 (let ((regexp (concat (regexp-quote TeX-esc) "\\(begin\\|end\\)\\b"))
|
|
1668 (level 1))
|
|
1669 (beginning-of-line 1)
|
|
1670 (if (looking-at (concat " *" (regexp-quote TeX-esc) "begin\\b"))
|
|
1671 (end-of-line 1))
|
|
1672 (while (and (> level 0) (re-search-backward regexp nil t))
|
|
1673 (if (= (char-after (1+ (match-beginning 0))) ?e);;end
|
|
1674 (setq level (1+ level))
|
|
1675 (setq level (1- level))))
|
|
1676 (or (= level 0)
|
|
1677 (error "Can't locate beginning of current environment"))))
|
|
1678
|
|
1679 (defun LaTeX-mark-environment ()
|
|
1680 "Set mark to end of current environment and point to the matching begin
|
|
1681 will not work properly if there are unbalanced begin-end pairs in
|
|
1682 comments and verbatim environments"
|
|
1683 (interactive)
|
|
1684 (let ((cur (point)))
|
|
1685 (LaTeX-find-matching-end)
|
|
1686 (beginning-of-line 2)
|
|
1687 (set-mark (point))
|
|
1688 (goto-char cur)
|
|
1689 (LaTeX-find-matching-begin)
|
|
1690 (TeX-activate-region)))
|
|
1691
|
|
1692 (defun LaTeX-fill-environment (justify)
|
|
1693 "Fill and indent current environment as LaTeX text."
|
|
1694 (interactive "*P")
|
|
1695 (save-excursion
|
|
1696 (LaTeX-mark-environment)
|
|
1697 (re-search-forward "{\\([^}]+\\)}")
|
|
1698 (LaTeX-fill-region
|
|
1699 (region-beginning)
|
|
1700 (region-end)
|
|
1701 justify
|
|
1702 (concat " environment " (TeX-match-buffer 1)))))
|
|
1703
|
|
1704 (defun LaTeX-fill-section (justify)
|
|
1705 "Fill and indent current logical section as LaTeX text."
|
|
1706 (interactive "*P")
|
|
1707 (save-excursion
|
|
1708 (LaTeX-mark-section)
|
|
1709 (re-search-forward "{\\([^}]+\\)}")
|
|
1710 (LaTeX-fill-region
|
|
1711 (region-beginning)
|
|
1712 (region-end)
|
|
1713 justify
|
|
1714 (concat " section " (TeX-match-buffer 1)))))
|
|
1715
|
|
1716 (defun LaTeX-mark-section ()
|
|
1717 "Set mark at end of current logical section, and point at top."
|
|
1718 (interactive)
|
|
1719 (re-search-forward (concat "\\(" (LaTeX-outline-regexp)
|
|
1720 "\\|\\'\\)"))
|
|
1721 (re-search-backward "^")
|
|
1722 (set-mark (point))
|
|
1723 (re-search-backward (concat "\\(" (LaTeX-outline-regexp)
|
|
1724 "\\|\\`\\)"))
|
|
1725 (TeX-activate-region))
|
|
1726
|
|
1727 (defun LaTeX-fill-buffer (justify)
|
|
1728 "Fill and indent current buffer as LaTeX text."
|
|
1729 (interactive "*P")
|
|
1730 (save-excursion
|
|
1731 (LaTeX-fill-region
|
|
1732 (point-min)
|
|
1733 (point-max)
|
|
1734 justify
|
|
1735 (concat " buffer " (buffer-name)))))
|
|
1736
|
|
1737 (defvar LaTeX-indent-environment-list
|
|
1738 '(("verbatim" current-indentation)
|
|
1739 ("verbatim*" current-indentation)
|
|
1740 ;; The following should have there own, smart indentation function.
|
|
1741 ;; Some other day.
|
|
1742 ("alltt")
|
|
1743 ("array")
|
|
1744 ("displaymath")
|
|
1745 ("eqnarray")
|
|
1746 ("eqnarray*")
|
|
1747 ("equation")
|
|
1748 ("equation*")
|
|
1749 ("picture")
|
|
1750 ("tabbing")
|
|
1751 ("table")
|
|
1752 ("table*")
|
|
1753 ("tabular")
|
|
1754 ("tabular*"))
|
|
1755 "Alist of environments with special indentation.
|
|
1756 The second element in each entry is the function to calculate the
|
|
1757 indentation level in columns.")
|
|
1758
|
153
|
1759 (defcustom LaTeX-indent-environment-check t
|
|
1760 "*If non-nil, check for any special environments."
|
|
1761 :group 'LaTeX-indentation
|
|
1762 :type 'boolean)
|
24
|
1763
|
153
|
1764 (defcustom LaTeX-left-comment-regexp "%%%"
|
|
1765 "*Regexp matching comments that should be placed on the left margin."
|
|
1766 :group 'LaTeX-indentation
|
|
1767 :type 'regexp)
|
24
|
1768
|
153
|
1769 (defcustom LaTeX-right-comment-regexp "%[^%]"
|
|
1770 "*Regexp matching comments that should be placed to the right margin."
|
|
1771 :group 'LaTeX-indentation
|
|
1772 :type 'regexp)
|
24
|
1773
|
153
|
1774 (defcustom LaTeX-ignore-comment-regexp nil
|
|
1775 "*Regexp matching comments that whose indentation should not be touched."
|
|
1776 :group 'LaTeX-indentation
|
|
1777 :type '(choice (const :tag "none" nil)
|
|
1778 (regexp :format "%v")))
|
24
|
1779
|
|
1780 (defun LaTeX-indent-calculate ()
|
|
1781 ;; Return the correct indentation of line of LaTeX source. (I hope...)
|
|
1782 (save-excursion
|
|
1783 (back-to-indentation)
|
|
1784 (cond ((looking-at (concat (regexp-quote TeX-esc)
|
|
1785 "\\(begin\\|end\\){verbatim\\*?}"))
|
|
1786 ;; \end{verbatim} must be flush left, otherwise an unwanted
|
|
1787 ;; empty line appears in LaTeX's output.
|
|
1788 0)
|
|
1789 ((and LaTeX-left-comment-regexp
|
|
1790 (looking-at LaTeX-left-comment-regexp))
|
|
1791 ;; Comments to the left margin.
|
|
1792 0)
|
|
1793 ((and LaTeX-right-comment-regexp
|
|
1794 (looking-at LaTeX-right-comment-regexp))
|
|
1795 ;; Comments to the right margin.
|
|
1796 comment-column)
|
|
1797 ((and LaTeX-ignore-comment-regexp
|
|
1798 (looking-at LaTeX-ignore-comment-regexp))
|
|
1799 ;; Comments best left alone.
|
|
1800 (current-indentation))
|
|
1801 ((and LaTeX-indent-environment-check
|
|
1802 ;; Special environments.
|
|
1803 (let ((entry (assoc (LaTeX-current-environment)
|
|
1804 LaTeX-indent-environment-list)))
|
|
1805 (and entry
|
|
1806 (nth 1 entry)
|
|
1807 (funcall (nth 1 entry))))))
|
|
1808 ((looking-at (concat (regexp-quote TeX-esc) "end\\b"))
|
|
1809 ;; Backindent at \end.
|
|
1810 (- (LaTeX-indent-calculate-last) LaTeX-indent-level))
|
|
1811 ((looking-at (concat (regexp-quote TeX-esc) "right\\b"))
|
|
1812 ;; Backindent at \right.
|
|
1813 (- (LaTeX-indent-calculate-last) LaTeX-left-right-indent-level))
|
|
1814 ((looking-at (concat (regexp-quote TeX-esc) LaTeX-item-regexp))
|
|
1815 ;; Items.
|
|
1816 (+ (LaTeX-indent-calculate-last) LaTeX-item-indent))
|
|
1817 (t (LaTeX-indent-calculate-last)))))
|
|
1818
|
153
|
1819 (defcustom LaTeX-left-right-indent-level LaTeX-indent-level
|
|
1820 "*The level of indentation produced by a \\left macro."
|
|
1821 :group 'LaTeX-indentation
|
|
1822 :type 'integer)
|
24
|
1823
|
|
1824 (defun LaTeX-indent-level-count ()
|
|
1825 ;; Count indentation change caused by all \left, \right, \begin, and
|
|
1826 ;; \end commands in the current line.
|
|
1827 (save-excursion
|
|
1828 (save-restriction
|
|
1829 (let ((count 0))
|
|
1830 (narrow-to-region (point)
|
|
1831 (save-excursion
|
|
1832 (re-search-forward (concat "[^"
|
|
1833 (regexp-quote TeX-esc)
|
|
1834 "]%\\|\n\\|\\'"))
|
|
1835 (backward-char)
|
|
1836 (point)))
|
|
1837 (while (search-forward TeX-esc nil t)
|
|
1838 (cond
|
|
1839 ((looking-at "left\\b")
|
|
1840 (setq count (+ count LaTeX-left-right-indent-level)))
|
|
1841 ((looking-at "right\\b")
|
|
1842 (setq count (- count LaTeX-left-right-indent-level)))
|
|
1843 ((looking-at "begin\\b")
|
|
1844 (setq count (+ count LaTeX-indent-level)))
|
|
1845 ((looking-at "end\\b")
|
|
1846 (setq count (- count LaTeX-indent-level)))
|
|
1847 ((looking-at (regexp-quote TeX-esc))
|
|
1848 (forward-char 1))))
|
|
1849 count))))
|
|
1850
|
|
1851 (defun LaTeX-indent-calculate-last ()
|
|
1852 "Return the correct indentation of a normal line of text.
|
|
1853 The point is supposed to be at the beginning of the current line."
|
|
1854 (save-restriction
|
|
1855 (widen)
|
|
1856 (skip-chars-backward "\n\t ")
|
|
1857 (move-to-column (current-indentation))
|
|
1858
|
|
1859 ;; Ignore comments.
|
|
1860 (while (and (looking-at (regexp-quote comment-start)) (not (bobp)))
|
|
1861 (skip-chars-backward "\n\t ")
|
|
1862 (if (not (bobp))
|
|
1863 (move-to-column (current-indentation))))
|
|
1864
|
|
1865 (cond ((bobp) 0)
|
|
1866 ((looking-at (concat (regexp-quote TeX-esc) "begin{document}"))
|
|
1867 ;; I dislike having all of the document indented...
|
|
1868 (current-indentation))
|
|
1869 ((looking-at (concat (regexp-quote TeX-esc) "begin *"
|
|
1870 (regexp-quote TeX-grop)
|
|
1871 "verbatim\\*?"
|
|
1872 (regexp-quote TeX-grcl)))
|
|
1873 0)
|
|
1874 ((looking-at (concat (regexp-quote TeX-esc) "end"
|
|
1875 (regexp-quote TeX-grop)
|
|
1876 "verbatim\\*?"
|
|
1877 (regexp-quote TeX-grcl)))
|
|
1878 ;; If I see an \end{verbatim} in the previous line I skip
|
|
1879 ;; back to the preceding \begin{verbatim}.
|
|
1880 (save-excursion
|
|
1881 (if (re-search-backward (concat (regexp-quote TeX-esc)
|
|
1882 "begin *"
|
|
1883 (regexp-quote TeX-grop)
|
|
1884 "verbatim\\*?"
|
|
1885 (regexp-quote TeX-grcl)) 0 t)
|
|
1886 (LaTeX-indent-calculate-last)
|
|
1887 0)))
|
|
1888 (t (+ (current-indentation)
|
|
1889 (TeX-brace-count-line)
|
|
1890 (LaTeX-indent-level-count)
|
|
1891 (cond ((looking-at (concat (regexp-quote TeX-esc) "end\\b"))
|
|
1892 LaTeX-indent-level)
|
|
1893 ((looking-at (concat (regexp-quote TeX-esc) "right\\b"))
|
|
1894 LaTeX-left-right-indent-level)
|
|
1895 ((looking-at (concat (regexp-quote TeX-esc)
|
|
1896 LaTeX-item-regexp))
|
|
1897 (- LaTeX-item-indent))
|
|
1898 (t 0)))))))
|
|
1899
|
|
1900 ;;; Math Minor Mode
|
|
1901
|
153
|
1902 (defgroup LaTeX-math nil
|
|
1903 "Mathematics in AUC TeX."
|
|
1904 :group 'LaTeX-macro)
|
|
1905
|
|
1906 (defcustom LaTeX-math-list nil
|
24
|
1907 "AList of your personal LaTeX math symbols.
|
|
1908
|
|
1909 Each entry should be a list with three elements, KEY, VALUE, and MENU.
|
|
1910 KEY is the key to be redefined (under `LaTeX-math-abbrev-prefix' in
|
|
1911 math minor mode, VALUE can be a string with the name of the macro to
|
|
1912 be inserted, or a function to be called. The optional third element is
|
|
1913 the name of the submenu where the command should be added.
|
|
1914
|
153
|
1915 See also `LaTeX-math-menu'."
|
|
1916 :group 'LaTeX-math
|
|
1917 :type '(repeat (group (choice (const :tag "none")
|
|
1918 (character :format "%v\n"))
|
|
1919 (string :tag "Symbol")
|
|
1920 (choice :tag "Menu"
|
|
1921 (string :tag "Name" :format "%v")
|
|
1922 (repeat :tag "Path"
|
|
1923 (string :format "%v"))))))
|
24
|
1924
|
|
1925 (defconst LaTeX-math-default
|
|
1926 '((?a "alpha" "greek")
|
|
1927 (?b "beta" "greek")
|
|
1928 (?c LaTeX-math-cal "Cal-whatever")
|
|
1929 (?d "delta" "greek")
|
|
1930 (?e "epsilon" "greek")
|
|
1931 (?f "phi" "greek")
|
|
1932 (?g "gamma" "greek")
|
|
1933 (?h "eta" "greek")
|
|
1934 (?k "kappa" "greek")
|
|
1935 (?l "lambda" "greek")
|
|
1936 (?m "mu" "greek")
|
|
1937 (?N "nabla" "greek")
|
|
1938 (?n "nu" "greek")
|
|
1939 (?o "omega" "greek")
|
|
1940 (?p "pi" "greek")
|
|
1941 (?q "theta" "greek")
|
|
1942 (?r "rho" "greek")
|
|
1943 (?s "sigma" "greek")
|
|
1944 (?t "tau" "greek")
|
|
1945 (?u "upsilon" "greek")
|
|
1946 (?x "chi" "greek")
|
|
1947 (?y "psi" "greek")
|
|
1948 (?z "zeta" "greek")
|
|
1949 (?D "Delta" "Greek")
|
|
1950 (?F "Phi" "Greek")
|
|
1951 (?G "Gamma" "Greek")
|
|
1952 (?Q "Theta" "Greek")
|
|
1953 (?L "Lambda" "Greek")
|
|
1954 (?Y "Psi" "Greek")
|
|
1955 (?P "Pi" "Greek")
|
|
1956 (?S "Sigma" "Greek")
|
|
1957 (?U "Upsilon" "Greek")
|
|
1958 (?O "Omega" "Greek")
|
|
1959 (nil "pm" "Binary Op")
|
|
1960 (nil "mp" "Binary Op")
|
|
1961 (?* "times" "Binary Op")
|
|
1962 (nil "div" "Binary Op")
|
|
1963 (nil "ast" "Binary Op")
|
|
1964 (nil "star" "Binary Op")
|
|
1965 (nil "circ" "Binary Op")
|
|
1966 (nil "bullet" "Binary Op")
|
|
1967 (?. "cdot" "Binary Op")
|
|
1968 (?- "cap" "Binary Op")
|
|
1969 (?+ "cup" "Binary Op")
|
|
1970 (nil "uplus" "Binary Op")
|
|
1971 (nil "sqcap" "Binary Op")
|
|
1972 (?| "vee" "Binary Op")
|
|
1973 (?& "wedge" "Binary Op")
|
|
1974 (?\\ "setminus" "Binary Op")
|
|
1975 (nil "wr" "Binary Op")
|
|
1976 (nil "diamond" "Binary Op")
|
|
1977 (nil "bigtriangleup" "Binary Op")
|
|
1978 (nil "bigtriangledown" "Binary Op")
|
|
1979 (nil "triangleleft" "Binary Op")
|
|
1980 (nil "triangleright" "Binary Op")
|
|
1981 (nil "lhd" "Binary Op")
|
|
1982 (nil "rhd" "Binary Op")
|
|
1983 (nil "unlhd" "Binary Op")
|
|
1984 (nil "unrhd" "Binary Op")
|
|
1985 (nil "oplus" "Binary Op")
|
|
1986 (nil "ominus" "Binary Op")
|
|
1987 (nil "otimes" "Binary Op")
|
|
1988 (nil "oslash" "Binary Op")
|
|
1989 (nil "odot" "Binary Op")
|
|
1990 (nil "bigcirc" "Binary Op")
|
|
1991 (nil "dagger" "Binary Op")
|
|
1992 (nil "ddagger" "Binary Op")
|
|
1993 (nil "amalg" "Binary Op")
|
|
1994 (?< "leq" "Relational")
|
|
1995 (?> "geq" "Relational")
|
|
1996 (nil "qed" "Relational")
|
|
1997 (nil "equiv" "Relational")
|
|
1998 (nil "models" "Relational")
|
|
1999 (nil "prec" "Relational")
|
|
2000 (nil "succ" "Relational")
|
|
2001 (nil "sim" "Relational")
|
|
2002 (nil "perp" "Relational")
|
|
2003 (nil "preceq" "Relational")
|
|
2004 (nil "succeq" "Relational")
|
|
2005 (nil "simeq" "Relational")
|
|
2006 (nil "mid" "Relational")
|
|
2007 (nil "ll" "Relational")
|
|
2008 (nil "gg" "Relational")
|
|
2009 (nil "asymp" "Relational")
|
|
2010 (nil "parallel" "Relational")
|
|
2011 (?{ "subset" "Relational")
|
|
2012 (?} "supset" "Relational")
|
|
2013 (nil "approx" "Relational")
|
|
2014 (nil "bowtie" "Relational")
|
|
2015 (?\[ "subseteq" "Relational")
|
|
2016 (?\] "supseteq" "Relational")
|
|
2017 (nil "cong" "Relational")
|
|
2018 (nil "Join" "Relational")
|
|
2019 (nil "sqsubset" "Relational")
|
|
2020 (nil "sqsupset" "Relational")
|
|
2021 (nil "neq" "Relational")
|
|
2022 (nil "smile" "Relational")
|
|
2023 (nil "sqsubseteq" "Relational")
|
|
2024 (nil "sqsupseteq" "Relational")
|
|
2025 (nil "doteq" "Relational")
|
|
2026 (nil "frown" "Relational")
|
|
2027 (?i "in" "Relational")
|
|
2028 (nil "ni" "Relational")
|
|
2029 (nil "propto" "Relational")
|
|
2030 (nil "vdash" "Relational")
|
|
2031 (nil "dashv" "Relational")
|
|
2032 (?\C-b "leftarrow" "Arrows")
|
|
2033 (nil "Leftarrow" "Arrows")
|
|
2034 (?\C-f "rightarrow" "Arrows")
|
|
2035 (nil "Rightarrow" "Arrows")
|
|
2036 (nil "leftrightarrow" "Arrows")
|
|
2037 (nil "Leftrightarrow" "Arrows")
|
|
2038 (nil "mapsto" "Arrows")
|
|
2039 (nil "hookleftarrow" "Arrows")
|
|
2040 (nil "leftharpoonup" "Arrows")
|
|
2041 (nil "leftharpoondown" "Arrows")
|
|
2042 (nil "longleftarrow" "Arrows")
|
|
2043 (nil "Longleftarrow" "Arrows")
|
|
2044 (nil "longrightarrow" "Arrows")
|
|
2045 (nil "Longrightarrow" "Arrows")
|
|
2046 (nil "longleftrightarrow" "Arrows")
|
|
2047 (nil "Longleftrightarrow" "Arrows")
|
|
2048 (nil "longmapsto" "Arrows")
|
|
2049 (nil "hookrightarrow" "Arrows")
|
|
2050 (nil "rightharpoonup" "Arrows")
|
|
2051 (nil "rightharpoondown" "Arrows")
|
|
2052 (?\C-p "uparrow" "Arrows")
|
|
2053 (nil "Uparrow" "Arrows")
|
|
2054 (?\C-n "downarrow" "Arrows")
|
|
2055 (nil "Downarrow" "Arrows")
|
|
2056 (nil "updownarrow" "Arrows")
|
|
2057 (nil "Updownarrow" "Arrows")
|
|
2058 (nil "nearrow" "Arrows")
|
|
2059 (nil "searrow" "Arrows")
|
|
2060 (nil "swarrow" "Arrows")
|
|
2061 (nil "nwarrow" "Arrows")
|
|
2062 (nil "ldots" "Misc Symbol")
|
|
2063 (nil "cdots" "Misc Symbol")
|
|
2064 (nil "vdots" "Misc Symbol")
|
|
2065 (nil "ddots" "Misc Symbol")
|
|
2066 (nil "aleph" "Misc Symbol")
|
|
2067 (nil "prime" "Misc Symbol")
|
|
2068 (?A "forall" "Misc Symbol")
|
|
2069 (?I "infty" "Misc Symbol")
|
|
2070 (nil "hbar" "Misc Symbol")
|
|
2071 (?0 "emptyset" "Misc Symbol")
|
|
2072 (?E "exists" "Misc Symbol")
|
|
2073 (nil "nabla" "Misc Symbol")
|
|
2074 (nil "surd" "Misc Symbol")
|
|
2075 (nil "Box" "Misc Symbol")
|
|
2076 (nil "triangle" "Misc Symbol")
|
|
2077 (nil "Diamond" "Misc Symbol")
|
|
2078 (nil "imath" "Misc Symbol")
|
|
2079 (nil "jmath" "Misc Symbol")
|
|
2080 (nil "ell" "Misc Symbol")
|
|
2081 (nil "neg" "Misc Symbol")
|
|
2082 (?/ "not" "Misc Symbol")
|
|
2083 (nil "top" "Misc Symbol")
|
|
2084 (nil "flat" "Misc Symbol")
|
|
2085 (nil "natural" "Misc Symbol")
|
|
2086 (nil "sharp" "Misc Symbol")
|
|
2087 (nil "wp" "Misc Symbol")
|
|
2088 (nil "bot" "Misc Symbol")
|
|
2089 (nil "clubsuit" "Misc Symbol")
|
|
2090 (nil "diamondsuit" "Misc Symbol")
|
|
2091 (nil "heartsuit" "Misc Symbol")
|
|
2092 (nil "spadesuit" "Misc Symbol")
|
|
2093 (nil "mho" "Misc Symbol")
|
|
2094 (nil "Re" "Misc Symbol")
|
|
2095 (nil "Im" "Misc Symbol")
|
|
2096 (nil "angle" "Misc Symbol")
|
|
2097 (nil "partial" "Misc Symbol")
|
|
2098 (nil "sum" "Var Symbol")
|
|
2099 (nil "prod" "Var Symbol")
|
|
2100 (nil "coprod" "Var Symbol")
|
|
2101 (nil "int" "Var Symbol")
|
|
2102 (nil "oint" "Var Symbol")
|
|
2103 (nil "bigcap" "Var Symbol")
|
|
2104 (nil "bigcup" "Var Symbol")
|
|
2105 (nil "bigsqcup" "Var Symbol")
|
|
2106 (nil "bigvee" "Var Symbol")
|
|
2107 (nil "bigwedge" "Var Symbol")
|
|
2108 (nil "bigodot" "Var Symbol")
|
|
2109 (nil "bigotimes" "Var Symbol")
|
|
2110 (nil "bigoplus" "Var Symbol")
|
|
2111 (nil "biguplus" "Var Symbol")
|
|
2112 (nil "arccos" "Log-like")
|
|
2113 (nil "arcsin" "Log-like")
|
|
2114 (nil "arctan" "Log-like")
|
|
2115 (nil "arg" "Log-like")
|
|
2116 (?\C-c "cos" "Log-like")
|
|
2117 (nil "cosh" "Log-like")
|
|
2118 (nil "cot" "Log-like")
|
|
2119 (nil "coth" "Log-like")
|
|
2120 (nil "csc" "Log-like")
|
|
2121 (nil "deg" "Log-like")
|
|
2122 (?\C-d "det" "Log-like")
|
|
2123 (nil "dim" "Log-like")
|
|
2124 (?\C-e "exp" "Log-like")
|
|
2125 (nil "gcd" "Log-like")
|
|
2126 (nil "hom" "Log-like")
|
|
2127 (?\C-_ "inf" "Log-like")
|
|
2128 (nil "ker" "Log-like")
|
|
2129 (nil "lg" "Log-like")
|
|
2130 (?\C-l "lim" "Log-like")
|
|
2131 (nil "liminf" "Log-like")
|
|
2132 (nil "limsup" "Log-like")
|
|
2133 (nil "ln" "Log-like")
|
|
2134 (nil "log" "Log-like")
|
|
2135 (nil "max" "Log-like")
|
|
2136 (nil "min" "Log-like")
|
|
2137 (nil "Pr" "Log-like")
|
|
2138 (nil "sec" "Log-like")
|
|
2139 (?\C-s "sin" "Log-like")
|
|
2140 (nil "sinh" "Log-like")
|
|
2141 (?\C-^ "sup" "Log-like")
|
|
2142 (?\C-t "tan" "Log-like")
|
|
2143 (nil "tanh" "Log-like")
|
|
2144 (nil "uparrow" "delimiters")
|
|
2145 (nil "Uparrow" "delimiters")
|
|
2146 (nil "downarrow" "delimiters")
|
|
2147 (nil "Downarrow" "delimiters")
|
|
2148 (nil "{" "delimiters")
|
|
2149 (nil "}" "delimiters")
|
|
2150 (nil "updownarrow" "delimiters")
|
|
2151 (nil "Updownarrow" "delimiters")
|
|
2152 (nil "lfloor" "delimiters")
|
|
2153 (nil "rfloor" "delimiters")
|
|
2154 (nil "lceil" "delimiters")
|
|
2155 (nil "rceil" "delimiters")
|
|
2156 (?\( "langle" "delimiters")
|
|
2157 (?\) "rangle" "delimiters")
|
|
2158 (nil "backslash" "delimiters")
|
|
2159 (nil "|" "delimiters")
|
|
2160 (nil "rmoustache" "Delimiters")
|
|
2161 (nil "lmoustache" "Delimiters")
|
|
2162 (nil "rgroup" "Delimiters")
|
|
2163 (nil "lgroup" "Delimiters")
|
|
2164 (nil "arrowvert" "Delimiters")
|
|
2165 (nil "Arrowvert" "Delimiters")
|
|
2166 (nil "bracevert" "Delimiters")
|
|
2167 (nil "widetilde" "Constructs")
|
|
2168 (nil "widehat" "Constructs")
|
|
2169 (nil "overleftarrow" "Constructs")
|
|
2170 (nil "overrightarrow" "Constructs")
|
|
2171 (nil "overline" "Constructs")
|
|
2172 (nil "underline" "Constructs")
|
|
2173 (nil "overbrace" "Constructs")
|
|
2174 (nil "underbrace" "Constructs")
|
|
2175 (nil "sqrt" "Constructs")
|
|
2176 (nil "frac" "Constructs")
|
|
2177 (?^ "hat" "Accents")
|
|
2178 (nil "acute" "Accents")
|
|
2179 (nil "bar" "Accents")
|
|
2180 (nil "dot" "Accents")
|
|
2181 (nil "breve" "Accents")
|
|
2182 (nil "check" "Accents")
|
|
2183 (nil "grave" "Accents")
|
|
2184 (nil "vec" "Accents")
|
|
2185 (nil "ddot" "Accents")
|
|
2186 (?~ "tilde" "Accents")
|
153
|
2187 (nil "digamma" ("AMS" "Hebrew"))
|
|
2188 (nil "varkappa" ("AMS" "Hebrew"))
|
|
2189 (nil "beth" ("AMS" "Hebrew"))
|
|
2190 (nil "daleth" ("AMS" "Hebrew"))
|
|
2191 (nil "gimel" ("AMS" "Hebrew"))
|
24
|
2192 (nil "dashrightarrow" ("AMS" "Arrows"))
|
|
2193 (nil "dashleftarrow" ("AMS" "Arrows"))
|
|
2194 (nil "leftleftarrows" ("AMS" "Arrows"))
|
|
2195 (nil "leftrightarrows" ("AMS" "Arrows"))
|
|
2196 (nil "Lleftarrow" ("AMS" "Arrows"))
|
|
2197 (nil "twoheadleftarrow" ("AMS" "Arrows"))
|
|
2198 (nil "leftarrowtail" ("AMS" "Arrows"))
|
|
2199 (nil "looparrowleft" ("AMS" "Arrows"))
|
|
2200 (nil "leftrightharpoons" ("AMS" "Arrows"))
|
|
2201 (nil "curvearrowleft" ("AMS" "Arrows"))
|
|
2202 (nil "circlearrowleft" ("AMS" "Arrows"))
|
|
2203 (nil "Lsh" ("AMS" "Arrows"))
|
|
2204 (nil "upuparrows" ("AMS" "Arrows"))
|
|
2205 (nil "upharpoonleft" ("AMS" "Arrows"))
|
|
2206 (nil "downharpoonleft" ("AMS" "Arrows"))
|
|
2207 (nil "multimap" ("AMS" "Arrows"))
|
|
2208 (nil "leftrightsquigarrow" ("AMS" "Arrows"))
|
|
2209 (nil "looparrowright" ("AMS" "Arrows"))
|
|
2210 (nil "rightleftharpoons" ("AMS" "Arrows"))
|
|
2211 (nil "curvearrowright" ("AMS" "Arrows"))
|
|
2212 (nil "circlearrowright" ("AMS" "Arrows"))
|
|
2213 (nil "Rsh" ("AMS" "Arrows"))
|
|
2214 (nil "downdownarrows" ("AMS" "Arrows"))
|
|
2215 (nil "upharpoonright" ("AMS" "Arrows"))
|
|
2216 (nil "downharpoonright" ("AMS" "Arrows"))
|
|
2217 (nil "rightsquigarrow" ("AMS" "Arrows"))
|
|
2218 (nil "nleftarrow" ("AMS" "Neg Arrows"))
|
|
2219 (nil "nrightarrow" ("AMS" "Neg Arrows"))
|
|
2220 (nil "nLeftarrow" ("AMS" "Neg Arrows"))
|
|
2221 (nil "nRightarrow" ("AMS" "Neg Arrows"))
|
|
2222 (nil "nleftrightarrow" ("AMS" "Neg Arrows"))
|
|
2223 (nil "nLeftrightarrow" ("AMS" "Neg Arrows"))
|
|
2224 (nil "leqq" ("AMS" "Relational I"))
|
|
2225 (nil "leqslant" ("AMS" "Relational I"))
|
|
2226 (nil "eqslantless" ("AMS" "Relational I"))
|
|
2227 (nil "lesssim" ("AMS" "Relational I"))
|
|
2228 (nil "lessapprox" ("AMS" "Relational I"))
|
|
2229 (nil "approxeq" ("AMS" "Relational I"))
|
|
2230 (nil "lessdot" ("AMS" "Relational I"))
|
|
2231 (nil "lll" ("AMS" "Relational I"))
|
|
2232 (nil "lessgtr" ("AMS" "Relational I"))
|
|
2233 (nil "lesseqgtr" ("AMS" "Relational I"))
|
|
2234 (nil "lesseqqgtr" ("AMS" "Relational I"))
|
|
2235 (nil "doteqdot" ("AMS" "Relational I"))
|
|
2236 (nil "risingdotseq" ("AMS" "Relational I"))
|
|
2237 (nil "fallingdotseq" ("AMS" "Relational I"))
|
|
2238 (nil "backsim" ("AMS" "Relational I"))
|
|
2239 (nil "backsimeq" ("AMS" "Relational I"))
|
|
2240 (nil "subseteqq" ("AMS" "Relational I"))
|
|
2241 (nil "Subset" ("AMS" "Relational I"))
|
|
2242 (nil "sqsubset" ("AMS" "Relational I"))
|
|
2243 (nil "preccurlyeq" ("AMS" "Relational I"))
|
|
2244 (nil "curlyeqprec" ("AMS" "Relational I"))
|
|
2245 (nil "precsim" ("AMS" "Relational I"))
|
|
2246 (nil "precapprox" ("AMS" "Relational I"))
|
|
2247 (nil "vartriangleleft" ("AMS" "Relational I"))
|
|
2248 (nil "trianglelefteq" ("AMS" "Relational I"))
|
|
2249 (nil "vDash" ("AMS" "Relational I"))
|
|
2250 (nil "Vvdash" ("AMS" "Relational I"))
|
|
2251 (nil "smallsmile" ("AMS" "Relational I"))
|
|
2252 (nil "smallfrown" ("AMS" "Relational I"))
|
|
2253 (nil "bumpeq" ("AMS" "Relational I"))
|
|
2254 (nil "Bumpeq" ("AMS" "Relational I"))
|
|
2255 (nil "geqq" ("AMS" "Relational II"))
|
|
2256 (nil "geqslant" ("AMS" "Relational II"))
|
|
2257 (nil "eqslantgtr" ("AMS" "Relational II"))
|
|
2258 (nil "gtrsim" ("AMS" "Relational II"))
|
|
2259 (nil "gtrapprox" ("AMS" "Relational II"))
|
|
2260 (nil "gtrdot" ("AMS" "Relational II"))
|
|
2261 (nil "ggg" ("AMS" "Relational II"))
|
|
2262 (nil "gtrless" ("AMS" "Relational II"))
|
|
2263 (nil "gtreqless" ("AMS" "Relational II"))
|
|
2264 (nil "gtreqqless" ("AMS" "Relational II"))
|
|
2265 (nil "eqcirc" ("AMS" "Relational II"))
|
|
2266 (nil "circeq" ("AMS" "Relational II"))
|
|
2267 (nil "triangleq" ("AMS" "Relational II"))
|
|
2268 (nil "thicksim" ("AMS" "Relational II"))
|
|
2269 (nil "thickapprox" ("AMS" "Relational II"))
|
|
2270 (nil "supseteqq" ("AMS" "Relational II"))
|
|
2271 (nil "Supset" ("AMS" "Relational II"))
|
|
2272 (nil "sqsupset" ("AMS" "Relational II"))
|
|
2273 (nil "succcurlyeq" ("AMS" "Relational II"))
|
|
2274 (nil "curlyeqsucc" ("AMS" "Relational II"))
|
|
2275 (nil "succsim" ("AMS" "Relational II"))
|
|
2276 (nil "succapprox" ("AMS" "Relational II"))
|
|
2277 (nil "vartriangleright" ("AMS" "Relational II"))
|
|
2278 (nil "trianglerighteq" ("AMS" "Relational II"))
|
|
2279 (nil "Vdash" ("AMS" "Relational II"))
|
|
2280 (nil "shortmid" ("AMS" "Relational II"))
|
|
2281 (nil "shortparallel" ("AMS" "Relational II"))
|
|
2282 (nil "between" ("AMS" "Relational II"))
|
|
2283 (nil "pitchfork" ("AMS" "Relational II"))
|
|
2284 (nil "varpropto" ("AMS" "Relational II"))
|
|
2285 (nil "blacktriangleleft" ("AMS" "Relational II"))
|
|
2286 (nil "therefore" ("AMS" "Relational II"))
|
|
2287 (nil "backepsilon" ("AMS" "Relational II"))
|
|
2288 (nil "blacktriangleright" ("AMS" "Relational II"))
|
|
2289 (nil "because" ("AMS" "Relational II"))
|
|
2290 (nil "nless" ("AMS" "Neg Rel I"))
|
|
2291 (nil "nleq" ("AMS" "Neg Rel I"))
|
|
2292 (nil "nleqslant" ("AMS" "Neg Rel I"))
|
|
2293 (nil "nleqq" ("AMS" "Neg Rel I"))
|
|
2294 (nil "lneq" ("AMS" "Neg Rel I"))
|
|
2295 (nil "lneqq" ("AMS" "Neg Rel I"))
|
|
2296 (nil "lvertneqq" ("AMS" "Neg Rel I"))
|
|
2297 (nil "lnsim" ("AMS" "Neg Rel I"))
|
|
2298 (nil "lnapprox" ("AMS" "Neg Rel I"))
|
|
2299 (nil "nprec" ("AMS" "Neg Rel I"))
|
|
2300 (nil "npreceq" ("AMS" "Neg Rel I"))
|
|
2301 (nil "precnsim" ("AMS" "Neg Rel I"))
|
|
2302 (nil "precnapprox" ("AMS" "Neg Rel I"))
|
|
2303 (nil "nsim" ("AMS" "Neg Rel I"))
|
|
2304 (nil "nshortmid" ("AMS" "Neg Rel I"))
|
|
2305 (nil "nmid" ("AMS" "Neg Rel I"))
|
|
2306 (nil "nvdash" ("AMS" "Neg Rel I"))
|
|
2307 (nil "nvDash" ("AMS" "Neg Rel I"))
|
|
2308 (nil "ntriangleleft" ("AMS" "Neg Rel I"))
|
|
2309 (nil "ntrianglelefteq" ("AMS" "Neg Rel I"))
|
|
2310 (nil "nsubseteq" ("AMS" "Neg Rel I"))
|
|
2311 (nil "subsetneq" ("AMS" "Neg Rel I"))
|
|
2312 (nil "varsubsetneq" ("AMS" "Neg Rel I"))
|
|
2313 (nil "subsetneqq" ("AMS" "Neg Rel I"))
|
|
2314 (nil "varsubsetneqq" ("AMS" "Neg Rel I"))
|
|
2315 (nil "ngtr" ("AMS" "Neg Rel II"))
|
|
2316 (nil "ngeq" ("AMS" "Neg Rel II"))
|
|
2317 (nil "ngeqslant" ("AMS" "Neg Rel II"))
|
|
2318 (nil "ngeqq" ("AMS" "Neg Rel II"))
|
|
2319 (nil "gneq" ("AMS" "Neg Rel II"))
|
|
2320 (nil "gneqq" ("AMS" "Neg Rel II"))
|
|
2321 (nil "gvertneqq" ("AMS" "Neg Rel II"))
|
|
2322 (nil "gnsim" ("AMS" "Neg Rel II"))
|
|
2323 (nil "gnapprox" ("AMS" "Neg Rel II"))
|
|
2324 (nil "nsucc" ("AMS" "Neg Rel II"))
|
|
2325 (nil "nsucceq" ("AMS" "Neg Rel II"))
|
|
2326 (nil "succnsim" ("AMS" "Neg Rel II"))
|
|
2327 (nil "succnapprox" ("AMS" "Neg Rel II"))
|
|
2328 (nil "ncong" ("AMS" "Neg Rel II"))
|
|
2329 (nil "nshortparallel" ("AMS" "Neg Rel II"))
|
|
2330 (nil "nparallel" ("AMS" "Neg Rel II"))
|
|
2331 (nil "nvDash" ("AMS" "Neg Rel II"))
|
|
2332 (nil "nVDash" ("AMS" "Neg Rel II"))
|
|
2333 (nil "ntriangleright" ("AMS" "Neg Rel II"))
|
|
2334 (nil "ntrianglerighteq" ("AMS" "Neg Rel II"))
|
|
2335 (nil "nsupseteq" ("AMS" "Neg Rel II"))
|
|
2336 (nil "nsupseteqq" ("AMS" "Neg Rel II"))
|
|
2337 (nil "supsetneq" ("AMS" "Neg Rel II"))
|
|
2338 (nil "varsupsetneq" ("AMS" "Neg Rel II"))
|
|
2339 (nil "supsetneqq" ("AMS" "Neg Rel II"))
|
|
2340 (nil "varsupsetneqq" ("AMS" "Neg Rel II"))
|
|
2341 (nil "dotplus" ("AMS" "Binary Op"))
|
|
2342 (nil "smallsetminus" ("AMS" "Binary Op"))
|
|
2343 (nil "Cap" ("AMS" "Binary Op"))
|
|
2344 (nil "Cup" ("AMS" "Binary Op"))
|
|
2345 (nil "barwedge" ("AMS" "Binary Op"))
|
|
2346 (nil "veebar" ("AMS" "Binary Op"))
|
|
2347 (nil "doublebarwedge" ("AMS" "Binary Op"))
|
|
2348 (nil "boxminus" ("AMS" "Binary Op"))
|
|
2349 (nil "boxtimes" ("AMS" "Binary Op"))
|
|
2350 (nil "boxdot" ("AMS" "Binary Op"))
|
|
2351 (nil "boxplus" ("AMS" "Binary Op"))
|
|
2352 (nil "divideontimes" ("AMS" "Binary Op"))
|
|
2353 (nil "ltimes" ("AMS" "Binary Op"))
|
|
2354 (nil "rtimes" ("AMS" "Binary Op"))
|
|
2355 (nil "leftthreetimes" ("AMS" "Binary Op"))
|
|
2356 (nil "rightthreetimes" ("AMS" "Binary Op"))
|
|
2357 (nil "curlywedge" ("AMS" "Binary Op"))
|
|
2358 (nil "curlyvee" ("AMS" "Binary Op"))
|
|
2359 (nil "circleddash" ("AMS" "Binary Op"))
|
|
2360 (nil "circledast" ("AMS" "Binary Op"))
|
|
2361 (nil "circledcirc" ("AMS" "Binary Op"))
|
|
2362 (nil "centerdot" ("AMS" "Binary Op"))
|
|
2363 (nil "intercal" ("AMS" "Binary Op"))
|
|
2364 (nil "hbar" ("AMS" "Misc"))
|
|
2365 (nil "hslash" ("AMS" "Misc"))
|
|
2366 (nil "vartriangle" ("AMS" "Misc"))
|
|
2367 (nil "triangledown" ("AMS" "Misc"))
|
|
2368 (nil "square" ("AMS" "Misc"))
|
|
2369 (nil "lozenge" ("AMS" "Misc"))
|
|
2370 (nil "circledS" ("AMS" "Misc"))
|
|
2371 (nil "angle" ("AMS" "Misc"))
|
|
2372 (nil "measuredangle" ("AMS" "Misc"))
|
|
2373 (nil "nexists" ("AMS" "Misc"))
|
|
2374 (nil "mho" ("AMS" "Misc"))
|
|
2375 (nil "Finv" ("AMS" "Misc"))
|
|
2376 (nil "Game" ("AMS" "Misc"))
|
|
2377 (nil "Bbbk" ("AMS" "Misc"))
|
|
2378 (nil "backprime" ("AMS" "Misc"))
|
|
2379 (nil "varnothing" ("AMS" "Misc"))
|
|
2380 (nil "blacktriangle" ("AMS" "Misc"))
|
|
2381 (nil "blacktriangledown" ("AMS" "Misc"))
|
|
2382 (nil "blacksquare" ("AMS" "Misc"))
|
|
2383 (nil "blacklozenge" ("AMS" "Misc"))
|
|
2384 (nil "bigstar" ("AMS" "Misc"))
|
|
2385 (nil "sphericalangle" ("AMS" "Misc"))
|
|
2386 (nil "complement" ("AMS" "Misc"))
|
|
2387 (nil "eth" ("AMS" "Misc"))
|
|
2388 (nil "diagup" ("AMS" "Misc"))
|
|
2389 (nil "diagdown" ("AMS" "Misc"))
|
|
2390 (nil "Hat" ("AMS" "Accents"))
|
|
2391 (nil "Check" ("AMS" "Accents"))
|
|
2392 (nil "Tilde" ("AMS" "Accents"))
|
|
2393 (nil "Acute" ("AMS" "Accents"))
|
|
2394 (nil "Grave" ("AMS" "Accents"))
|
|
2395 (nil "Dot" ("AMS" "Accents"))
|
|
2396 (nil "Ddot" ("AMS" "Accents"))
|
|
2397 (nil "Breve" ("AMS" "Accents"))
|
|
2398 (nil "Bar" ("AMS" "Accents"))
|
|
2399 (nil "Vec" ("AMS" "Accents"))
|
|
2400 (nil "dddot" ("AMS" "Accents"))
|
|
2401 (nil "ddddot" ("AMS" "Accents"))
|
|
2402 (nil "bigl" ("AMS" "Delimiters"))
|
|
2403 (nil "bigr" ("AMS" "Delimiters"))
|
|
2404 (nil "Bigl" ("AMS" "Delimiters"))
|
|
2405 (nil "Bigr" ("AMS" "Delimiters"))
|
|
2406 (nil "biggl" ("AMS" "Delimiters"))
|
|
2407 (nil "biggr" ("AMS" "Delimiters"))
|
|
2408 (nil "Biggl" ("AMS" "Delimiters"))
|
|
2409 (nil "Biggr" ("AMS" "Delimiters"))
|
|
2410 (nil "lvert" ("AMS" "Delimiters"))
|
|
2411 (nil "rvert" ("AMS" "Delimiters"))
|
|
2412 (nil "lVert" ("AMS" "Delimiters"))
|
|
2413 (nil "rVert" ("AMS" "Delimiters"))
|
153
|
2414 (nil "ulcorner" ("AMS" "Delimiters"))
|
|
2415 (nil "urcorner" ("AMS" "Delimiters"))
|
|
2416 (nil "llcorner" ("AMS" "Delimiters"))
|
|
2417 (nil "lrcorner" ("AMS" "Delimiters"))
|
24
|
2418 (nil "nobreakdash" ("AMS" "Special"))
|
|
2419 (nil "leftroot" ("AMS" "Special"))
|
|
2420 (nil "uproot" ("AMS" "Special"))
|
|
2421 (nil "accentedsymbol" ("AMS" "Special"))
|
|
2422 (nil "xleftarrow" ("AMS" "Special"))
|
|
2423 (nil "xrightarrow" ("AMS" "Special"))
|
|
2424 (nil "overset" ("AMS" "Special"))
|
|
2425 (nil "underset" ("AMS" "Special"))
|
|
2426 (nil "dfrac" ("AMS" "Special"))
|
|
2427 (nil "genfrac" ("AMS" "Special"))
|
|
2428 (nil "tfrac" ("AMS" "Special"))
|
|
2429 (nil "binom" ("AMS" "Special"))
|
|
2430 (nil "dbinom" ("AMS" "Special"))
|
|
2431 (nil "tbinom" ("AMS" "Special"))
|
|
2432 (nil "smash" ("AMS" "Special"))
|
|
2433 (nil "eucal" ("AMS" "Special"))
|
|
2434 (nil "boldsymbol" ("AMS" "Special"))
|
|
2435 (nil "text" ("AMS" "Special"))
|
|
2436 (nil "intertext" ("AMS" "Special"))
|
|
2437 (nil "substack" ("AMS" "Special"))
|
|
2438 (nil "subarray" ("AMS" "Special"))
|
|
2439 (nil "sideset" ("AMS" "Special"))))
|
|
2440
|
153
|
2441 (defcustom LaTeX-math-abbrev-prefix "`"
|
|
2442 "Prefix key for use in `LaTeX-math-mode'."
|
|
2443 :group 'LaTeX-math
|
|
2444 :type 'string)
|
24
|
2445
|
|
2446 (defvar LaTeX-math-keymap (make-sparse-keymap)
|
|
2447 "Keymap used for LaTeX-math-mode commands.")
|
|
2448
|
|
2449 (defvar LaTeX-math-menu
|
|
2450 '("Math"
|
|
2451 ("Greek") ("greek") ("Binary Op") ("Relational") ("Arrows")
|
|
2452 ("Misc Symbol") ("Var Symbol") ("Log-like") ("delimiters")
|
|
2453 ("Delimiters") ("Constructs") ("Accents") ("AMS"))
|
|
2454 "Menu containing LaTeX math commands.
|
|
2455 The menu entries will be generated dynamically, but you can specify
|
|
2456 the sequence by initializing this variable.")
|
|
2457
|
|
2458 (define-key LaTeX-math-keymap
|
|
2459 (concat LaTeX-math-abbrev-prefix LaTeX-math-abbrev-prefix)
|
|
2460 'LaTeX-math-insert-prefix)
|
|
2461
|
|
2462 (let ((math (reverse (append LaTeX-math-list LaTeX-math-default)))
|
|
2463 (map (lookup-key LaTeX-math-keymap LaTeX-math-abbrev-prefix)))
|
|
2464 (while math
|
|
2465 (let* ((entry (car math))
|
|
2466 (key (nth 0 entry))
|
|
2467 value menu name)
|
|
2468 (setq math (cdr math))
|
|
2469 (if (listp (cdr entry))
|
|
2470 (setq value (nth 1 entry)
|
|
2471 menu (nth 2 entry))
|
|
2472 (setq value (cdr entry)
|
|
2473 menu nil))
|
|
2474 (if (stringp value)
|
|
2475 (progn
|
|
2476 (setq name (intern (concat "LaTeX-math-" value)))
|
|
2477 (fset name (list 'lambda (list 'arg) (list 'interactive "*P")
|
|
2478 (list 'LaTeX-math-insert value 'arg))))
|
|
2479 (setq name value))
|
|
2480 (if key
|
|
2481 (progn
|
|
2482 (setq key (if (numberp key) (char-to-string key) (vector key)))
|
|
2483 (define-key map key name)))
|
|
2484 (if menu
|
|
2485 (let ((parent LaTeX-math-menu))
|
|
2486 (if (listp menu)
|
|
2487 (progn
|
|
2488 (while (cdr menu)
|
|
2489 (let ((sub (assoc (car menu) LaTeX-math-menu)))
|
|
2490 (if sub
|
|
2491 (setq parent sub)
|
|
2492 (setcdr parent (cons (list (car menu)) (cdr parent))))
|
|
2493 (setq menu (cdr menu))))
|
|
2494 (setq menu (car menu))))
|
|
2495 (let ((sub (assoc menu parent)))
|
|
2496 (if sub
|
|
2497 (if (stringp value)
|
|
2498 (setcdr sub (cons (vector value name t) (cdr sub)))
|
|
2499 (error "Cannot have multiple special math menu items"))
|
|
2500 (setcdr parent
|
|
2501 (cons (if (stringp value)
|
|
2502 (list menu (vector value name t))
|
|
2503 (vector menu name t))
|
|
2504 (cdr parent))))))))))
|
|
2505
|
|
2506 (easy-menu-define LaTeX-math-mode-menu
|
|
2507 LaTeX-math-keymap
|
|
2508 "Menu used in math minor mode."
|
|
2509 LaTeX-math-menu)
|
|
2510
|
|
2511 (defvar LaTeX-math-mode nil
|
153
|
2512 "Is `LaTeX-math-mode' on or off? Non nil means on.")
|
24
|
2513
|
|
2514 (make-variable-buffer-local 'LaTeX-math-mode)
|
|
2515
|
|
2516 (or (assoc 'LaTeX-math-mode minor-mode-alist)
|
|
2517 (setq minor-mode-alist (cons '(LaTeX-math-mode " Math") minor-mode-alist)))
|
|
2518
|
|
2519 (or (assoc 'LaTeX-math-mode minor-mode-map-alist)
|
|
2520 (setq minor-mode-map-alist
|
|
2521 (cons (cons 'LaTeX-math-mode LaTeX-math-keymap)
|
|
2522 minor-mode-map-alist)))
|
|
2523
|
|
2524 (defun LaTeX-math-mode (&optional arg)
|
|
2525 "A minor mode with easy acces to TeX math macros.
|
|
2526
|
|
2527 Easy insertion of LaTeX math symbols. If you give a prefix argument,
|
|
2528 the symbols will be surrounded by dollar signs. The following
|
|
2529 commands are defined:
|
|
2530
|
|
2531 \\{LaTeX-math-keymap}"
|
|
2532 (interactive "P")
|
|
2533 (setq LaTeX-math-mode
|
|
2534 (not (or (and (null arg) LaTeX-math-mode)
|
|
2535 (<= (prefix-numeric-value arg) 0))))
|
|
2536 (if LaTeX-math-mode
|
|
2537 (easy-menu-add LaTeX-math-mode-menu LaTeX-math-keymap)
|
|
2538 (easy-menu-remove LaTeX-math-mode-menu))
|
|
2539 (set-buffer-modified-p (buffer-modified-p)))
|
|
2540
|
|
2541 (fset 'latex-math-mode 'LaTeX-math-mode)
|
|
2542
|
|
2543 (defun LaTeX-math-insert-prefix ()
|
|
2544 "Insert the value of `LaTeX-math-abbrev-prefix'."
|
|
2545 (interactive "*")
|
|
2546 (let (LaTeX-math-mode)
|
|
2547 (call-interactively (key-binding LaTeX-math-abbrev-prefix))))
|
|
2548
|
|
2549 (defun LaTeX-math-insert (string dollar)
|
|
2550 ;; Inserts \STRING{}. If DOLLAR is non-nil, put $'s around it.
|
|
2551 (if dollar (insert "$"))
|
|
2552 (TeX-insert-macro string)
|
|
2553 (if dollar (insert "$")))
|
|
2554
|
|
2555 (defun LaTeX-math-cal (char dollar)
|
|
2556 "Inserts a {\\cal CHAR}. If DOLLAR is non-nil, put $'s around it."
|
|
2557 (interactive "*c\nP")
|
|
2558 (if dollar (insert "$"))
|
|
2559 (if (member "latex2e" (TeX-style-list))
|
|
2560 (insert "\\mathcal{" (char-to-string char) "}")
|
|
2561 (insert "{\\cal " (char-to-string char) "}"))
|
|
2562 (if dollar (insert "$")))
|
|
2563
|
|
2564 (provide 'latex)
|
|
2565
|
|
2566 ;;; Keymap
|
|
2567
|
|
2568 (defvar LaTeX-mode-map
|
|
2569 (let ((map (copy-keymap TeX-mode-map)))
|
|
2570
|
|
2571 ;; Standard
|
|
2572 (define-key map "\n" 'reindent-then-newline-and-indent)
|
|
2573
|
|
2574 ;; From latex.el
|
|
2575 (define-key map "\t" 'LaTeX-indent-line)
|
|
2576 (define-key map "\eq" 'LaTeX-fill-paragraph) ;*** Alias
|
|
2577 ;; This key is now used by Emacs for face settings.
|
|
2578 ;; (define-key map "\eg" 'LaTeX-fill-region) ;*** Alias
|
|
2579 (define-key map "\e\C-e" 'LaTeX-find-matching-end)
|
|
2580 (define-key map "\e\C-a" 'LaTeX-find-matching-begin)
|
|
2581
|
|
2582 (define-key map "\C-c\C-q\C-p" 'LaTeX-fill-paragraph)
|
|
2583 (define-key map "\C-c\C-q\C-r" 'LaTeX-fill-region)
|
|
2584 (define-key map "\C-c\C-q\C-s" 'LaTeX-fill-section)
|
|
2585 (define-key map "\C-c\C-q\C-e" 'LaTeX-fill-environment)
|
|
2586
|
|
2587 (define-key map "\C-c." 'LaTeX-mark-environment) ;*** Dubious
|
|
2588 (define-key map "\C-c*" 'LaTeX-mark-section) ;*** Dubious
|
|
2589
|
|
2590 (define-key map "\C-c\C-e" 'LaTeX-environment)
|
|
2591 (define-key map "\C-c\n" 'LaTeX-insert-item)
|
|
2592 (or (key-binding "\e\r")
|
|
2593 (define-key map "\e\r" 'LaTeX-insert-item)) ;*** Alias
|
|
2594 (define-key map "\C-c]" 'LaTeX-close-environment)
|
|
2595 (define-key map "\C-c\C-s" 'LaTeX-section)
|
|
2596
|
|
2597 ;; Outline commands...
|
|
2598 ;; We want to use the right prefix, if possible.
|
|
2599 (let ((outline (cond ((not (boundp 'outline-minor-mode-prefix))
|
|
2600 (lookup-key map "\C-c"))
|
|
2601 ((keymapp (lookup-key map outline-minor-mode-prefix))
|
|
2602 (lookup-key map outline-minor-mode-prefix))
|
|
2603 (t
|
|
2604 (define-key map
|
|
2605 outline-minor-mode-prefix (make-sparse-keymap))
|
|
2606 (lookup-key map outline-minor-mode-prefix)))))
|
|
2607 (define-key outline "\C-z" 'LaTeX-hide-environment)
|
|
2608 (define-key outline "\C-x" 'LaTeX-show-environment))
|
|
2609
|
|
2610 (define-key map "\C-c~" 'LaTeX-math-mode) ;*** Dubious
|
|
2611
|
|
2612 map)
|
|
2613 "Keymap used in LaTeX-mode.")
|
|
2614
|
|
2615 (defvar LaTeX-environment-menu-name "Insert Environment (C-c C-e)")
|
|
2616
|
|
2617 (defun LaTeX-environment-menu-entry (entry)
|
|
2618 ;; Create an entry for the environment menu.
|
|
2619 (vector (car entry) (list 'LaTeX-environment-menu (car entry)) t))
|
|
2620
|
|
2621 (defvar LaTeX-environment-modify-menu-name "Change Environment (C-u C-c C-e)")
|
|
2622
|
|
2623 (defun LaTeX-environment-modify-menu-entry (entry)
|
|
2624 ;; Create an entry for the change environment menu.
|
|
2625 (vector (car entry) (list 'LaTeX-modify-environment (car entry)) t))
|
|
2626
|
|
2627 (defun LaTeX-section-enable-symbol (LEVEL)
|
|
2628 ;; Symbol used to enable section LEVEL in the menu bar.
|
|
2629 (intern (concat "LaTeX-section-" (int-to-string (nth 1 entry)) "-enable")))
|
|
2630
|
|
2631 (defun LaTeX-section-enable (entry)
|
|
2632 ;; Enable or disable section ENTRY from LaTeX-section-list.
|
|
2633 (let ((level (nth 1 entry)))
|
|
2634 (set (LaTeX-section-enable-symbol level)
|
|
2635 (>= level LaTeX-largest-level))))
|
|
2636
|
|
2637 (defun LaTeX-section-menu (level)
|
|
2638 ;; Insert section from menu.
|
|
2639 (let ((LaTeX-section-hook (delq 'LaTeX-section-heading
|
|
2640 (copy-sequence LaTeX-section-hook))))
|
|
2641 (LaTeX-section level)))
|
|
2642
|
|
2643 (defun LaTeX-section-menu-entry (entry)
|
|
2644 ;; Create an entry for the section menu.
|
|
2645 (let ((enable (LaTeX-section-enable-symbol (nth 1 entry))))
|
|
2646 (set enable t)
|
|
2647 (vector (car entry) (list 'LaTeX-section-menu (nth 1 entry)) enable)))
|
|
2648
|
|
2649 (defun LaTeX-section-menu-create ()
|
|
2650 ;; Create a menu over LaTeX sections.
|
|
2651 (append '("Section (C-c C-s)")
|
|
2652 (mapcar 'LaTeX-section-menu-entry LaTeX-section-list)))
|
|
2653
|
|
2654 (defvar LaTeX-menu-changed nil)
|
|
2655 ;; Need to update LaTeX menu.
|
|
2656 (make-variable-buffer-local 'LaTeX-menu-changed)
|
|
2657
|
|
2658 (defun LaTeX-menu-update ()
|
|
2659 ;; Update entries on AUC TeX menu.
|
|
2660 (or (not (eq major-mode 'latex-mode))
|
|
2661 (null LaTeX-menu-changed)
|
|
2662 (not (fboundp 'easy-menu-change))
|
|
2663 (progn
|
|
2664 (TeX-update-style)
|
|
2665 (setq LaTeX-menu-changed nil)
|
|
2666 (message "Updating section menu...")
|
|
2667 (mapcar 'LaTeX-section-enable LaTeX-section-list)
|
|
2668 (message "Updating environment menu...")
|
|
2669 (easy-menu-change '("LaTeX") LaTeX-environment-menu-name
|
|
2670 (mapcar 'LaTeX-environment-menu-entry
|
|
2671 (LaTeX-environment-list)))
|
|
2672 (message "Updating modify environment menu...")
|
|
2673 (easy-menu-change '("LaTeX") LaTeX-environment-modify-menu-name
|
|
2674 (mapcar 'LaTeX-environment-modify-menu-entry
|
|
2675 (LaTeX-environment-list)))
|
|
2676 (message "Updating...done"))))
|
|
2677
|
|
2678 (add-hook 'activate-menubar-hook 'LaTeX-menu-update)
|
|
2679
|
|
2680 (easy-menu-define LaTeX-mode-menu
|
|
2681 LaTeX-mode-map
|
|
2682 "Menu used in LaTeX mode."
|
|
2683 (list "LaTeX"
|
|
2684 (list LaTeX-environment-menu-name "Bug.")
|
|
2685 (list LaTeX-environment-modify-menu-name "Bug.")
|
|
2686 (LaTeX-section-menu-create)
|
|
2687 ["Macro..." TeX-insert-macro t]
|
|
2688 ["Complete" TeX-complete-symbol t]
|
|
2689 ["Item" LaTeX-insert-item t]
|
|
2690 (list "Insert Font"
|
|
2691 ["Emphasize" (TeX-font nil ?\C-e) :keys "C-c C-f C-e"]
|
|
2692 ["Bold" (TeX-font nil ?\C-b) :keys "C-c C-f C-b"]
|
|
2693 ["Typewriter" (TeX-font nil ?\C-t) :keys "C-c C-f C-t"]
|
|
2694 ["Small Caps" (TeX-font nil ?\C-c) :keys "C-c C-f C-c"]
|
|
2695 ["Sans Serif" (TeX-font nil ?\C-f) :keys "C-c C-f C-f"]
|
|
2696 ["Italic" (TeX-font nil ?\C-i) :keys "C-c C-f C-i"]
|
|
2697 ["Slanted" (TeX-font nil ?\C-s) :keys "C-c C-f C-s"]
|
|
2698 ["Roman" (TeX-font nil ?\C-r) :keys "C-c C-f C-r"])
|
|
2699 (list "Change Font"
|
|
2700 ["Emphasize" (TeX-font t ?\C-e) :keys "C-u C-c C-f C-e"]
|
|
2701 ["Bold" (TeX-font t ?\C-b) :keys "C-u C-c C-f C-b"]
|
|
2702 ["Typewriter" (TeX-font t ?\C-t) :keys "C-u C-c C-f C-t"]
|
|
2703 ["Small Caps" (TeX-font t ?\C-c) :keys "C-u C-c C-f C-c"]
|
|
2704 ["Sans Serif" (TeX-font t ?\C-f) :keys "C-u C-c C-f C-f"]
|
|
2705 ["Italic" (TeX-font t ?\C-i) :keys "C-u C-c C-f C-i"]
|
|
2706 ["Slanted" (TeX-font t ?\C-s) :keys "C-u C-c C-f C-s"]
|
|
2707 ["Roman" (TeX-font t ?\C-r) :keys "C-u C-c C-f C-r"])
|
|
2708 ["Delete Font" (TeX-font t ?\C-d) :keys "C-c C-f C-d"]
|
|
2709 "-"
|
|
2710 ["Next Error" TeX-next-error t]
|
|
2711 (list "TeX Output"
|
|
2712 ["Kill Job" TeX-kill-job t]
|
|
2713 ["Debug Bad Boxes" TeX-toggle-debug-boxes
|
|
2714 :style toggle :selected TeX-debug-bad-boxes ]
|
|
2715 ["Switch to Original File" TeX-home-buffer t]
|
|
2716 ["Recenter Output Buffer" TeX-recenter-output-buffer t])
|
|
2717 (list "Formatting and Marking"
|
|
2718 ["Format Environment" LaTeX-fill-environment t]
|
|
2719 ["Format Paragraph" LaTeX-fill-paragraph t]
|
|
2720 ["Format Region" LaTeX-fill-region t]
|
|
2721 ["Format Section" LaTeX-fill-section t]
|
|
2722 ["Mark Environment" LaTeX-mark-environment t]
|
|
2723 ["Mark Section" LaTeX-mark-section t]
|
|
2724 ["Beginning of Environment" LaTeX-find-matching-begin t]
|
|
2725 ["End of Environment" LaTeX-find-matching-end t]
|
|
2726 ["Hide Environment" LaTeX-hide-environment t]
|
|
2727 ["Show Environment" LaTeX-show-environment t])
|
|
2728 (list "Miscellaneous"
|
|
2729 ["Uncomment Region" TeX-un-comment-region t]
|
|
2730 ["Comment Region" TeX-comment-region t]
|
|
2731 ["Switch to Master file" TeX-home-buffer t]
|
|
2732 ["Save Document" TeX-save-document t]
|
|
2733 ["Math Mode" LaTeX-math-mode
|
|
2734 :style toggle :selected LaTeX-math-mode ]
|
|
2735 ["Documentation" TeX-goto-info-page t]
|
|
2736 ["Submit bug report" TeX-submit-bug-report t]
|
|
2737 [ "Convert 209 to 2e" LaTeX-209-to-2e
|
|
2738 :active (member "latex2" (TeX-style-list)) ]
|
|
2739 ["Reset Buffer" TeX-normal-mode t]
|
|
2740 ["Reset AUC TeX" (TeX-normal-mode t) :keys "C-u C-c C-n"])))
|
|
2741
|
153
|
2742 (defcustom LaTeX-font-list
|
24
|
2743 '((?\C-b "\\textbf{" "}")
|
|
2744 (?\C-c "\\textsc{" "}")
|
|
2745 (?\C-e "\\emph{" "}")
|
|
2746 (?\C-f "\\textsf{" "}")
|
|
2747 (?\C-i "\\textit{" "}")
|
|
2748 (?\C-m "\\textmd{" "}")
|
|
2749 (?\C-n "\\textnormal{" "}")
|
|
2750 (?\C-r "\\textrm{" "}")
|
|
2751 (?\C-s "\\textsl{" "}")
|
|
2752 (?\C-t "\\texttt{" "}")
|
|
2753 (?\C-u "\\textup{" "}")
|
|
2754 (?\C-d "" "" t))
|
153
|
2755 "Font commands used with LaTeX2e. See `TeX-font-list'."
|
|
2756 :group 'LaTeX-macro
|
|
2757 :type '(repeat (group (character :tag "Key")
|
|
2758 (string :tag "Prefix")
|
|
2759 (string :tag "Suffix")
|
|
2760 (option (sexp :format "Replace\n"
|
|
2761 :value t)))))
|
24
|
2762
|
|
2763 ;;; Mode
|
|
2764
|
153
|
2765 (defgroup LaTeX-macro nil
|
|
2766 "Special support for LaTeX macros in AUC TeX."
|
|
2767 :prefix "TeX-"
|
|
2768 :group 'LaTeX
|
|
2769 :group 'TeX-macro)
|
24
|
2770
|
153
|
2771 (defcustom TeX-arg-cite-note-p nil
|
|
2772 "*If non-nil, ask for optional note in citations."
|
|
2773 :type 'boolean
|
|
2774 :group 'LaTeX-macro)
|
24
|
2775
|
153
|
2776 (defcustom TeX-arg-footnote-number-p nil
|
|
2777 "*If non-nil, ask for optional number in footnotes."
|
|
2778 :type 'boolean
|
|
2779 :group 'LaTeX-macro)
|
24
|
2780
|
153
|
2781 (defcustom TeX-arg-item-label-p nil
|
|
2782 "*If non-nil, always ask for optional label in items.
|
|
2783 Otherwise, only ask in description environments."
|
|
2784 :type 'boolean
|
|
2785 :group 'LaTeX-macro)
|
|
2786
|
|
2787 (defcustom TeX-arg-right-insert-p t
|
|
2788 "*If non-nil, always insert automatically the corresponding \\right.
|
|
2789 This happens when \\left is inserted."
|
|
2790 :type 'boolean
|
|
2791 :group 'LaTeX-macro)
|
24
|
2792
|
|
2793 (defvar LaTeX-paragraph-commands
|
|
2794 (concat "\\[\\|\\]\\|" ; display math delimitors
|
|
2795 "begin\\b\\|end\\b\\|part\\b\\|chapter\\b\\|label\\b\\|"
|
|
2796 "caption\\b\\|section\\b\\|subsection\\b\\|subsubsection\\b\\|"
|
|
2797 "par\\b\\|noindent\\b\\|paragraph\\b\\|include\\b\\|"
|
|
2798 "includeonly\\b\\|tableofcontents\\b\\|appendix\\b")
|
|
2799 "Regexp matching names of LaTeX macros that should have their own line.")
|
|
2800
|
|
2801 ;;; Do not ;;;###autoload because of conflict with standard tex-mode.el.
|
|
2802 (defun latex-mode ()
|
|
2803 "Major mode for editing files of input for LaTeX.
|
|
2804 See info under AUC TeX for full documentation.
|
|
2805
|
|
2806 Special commands:
|
|
2807 \\{LaTeX-mode-map}
|
|
2808
|
153
|
2809 Entering LaTeX mode calls the value of `text-mode-hook',
|
|
2810 then the value of `TeX-mode-hook', and then the value
|
|
2811 of `LaTeX-mode-hook'."
|
24
|
2812 (interactive)
|
|
2813 (LaTeX-common-initialization)
|
|
2814 (setq mode-name "LaTeX")
|
|
2815 (setq major-mode 'latex-mode)
|
|
2816 (setq TeX-command-default "LaTeX")
|
|
2817 (run-hooks 'text-mode-hook 'TeX-mode-hook 'LaTeX-mode-hook)
|
|
2818
|
|
2819 ;; Defeat filladapt if auto-fill-mode is set in text-mode-hook.
|
|
2820 (and (boundp 'filladapt-function-table)
|
|
2821 (boundp 'auto-fill-function)
|
|
2822 (eq auto-fill-function 'do-auto-fill)
|
|
2823 (setq auto-fill-function
|
|
2824 (cdr (assoc 'do-auto-fill filladapt-function-table)))))
|
|
2825
|
|
2826 (defvar LaTeX-header-end
|
|
2827 (concat (regexp-quote TeX-esc) "begin *" TeX-grop "document" TeX-grcl)
|
|
2828 "Default end of header marker for LaTeX documents.")
|
|
2829
|
|
2830 (defvar LaTeX-trailer-start
|
|
2831 (concat (regexp-quote TeX-esc) "end *" TeX-grop "document" TeX-grcl)
|
|
2832 "Default start of trailer marker for LaTeX documents.")
|
|
2833
|
|
2834 (defun LaTeX2e-font-replace (start end)
|
|
2835 "Replace LaTeX2e font specification around point with START and END."
|
|
2836 (save-excursion
|
|
2837 (catch 'done
|
|
2838 (while t
|
|
2839 (if (/= ?\\ (following-char))
|
|
2840 (skip-chars-backward "a-zA-Z "))
|
|
2841 (skip-chars-backward "\\\\")
|
|
2842 (if (looking-at "\\\\\\(emph\\|text[a-z]+\\){")
|
|
2843 (throw 'done t)
|
|
2844 (up-list -1))))
|
|
2845 (forward-sexp 2)
|
|
2846 (save-excursion
|
|
2847 (replace-match start t t))
|
|
2848 (delete-backward-char 1)
|
|
2849 (insert end)))
|
|
2850
|
|
2851 (defun LaTeX-common-initialization ()
|
|
2852 ;; Common initialization for LaTeX derived modes.
|
|
2853 (VirTeX-common-initialization)
|
|
2854 (set-syntax-table LaTeX-mode-syntax-table)
|
|
2855 (make-local-variable 'indent-line-function)
|
|
2856 (setq indent-line-function 'LaTeX-indent-line)
|
|
2857 (use-local-map LaTeX-mode-map)
|
|
2858 (easy-menu-add TeX-mode-menu LaTeX-mode-map)
|
|
2859 (easy-menu-add LaTeX-mode-menu LaTeX-mode-map)
|
|
2860
|
|
2861 (or LaTeX-largest-level
|
|
2862 (setq LaTeX-largest-level (LaTeX-section-level "section")))
|
|
2863
|
|
2864 (setq TeX-header-end LaTeX-header-end
|
|
2865 TeX-trailer-start LaTeX-trailer-start)
|
|
2866
|
|
2867 (require 'outline)
|
|
2868 (make-local-variable 'outline-level)
|
|
2869 (setq outline-level 'LaTeX-outline-level)
|
|
2870 (make-local-variable 'outline-regexp)
|
|
2871 (setq outline-regexp (LaTeX-outline-regexp t))
|
|
2872
|
|
2873 (make-local-variable 'TeX-auto-full-regexp-list)
|
|
2874 (setq TeX-auto-full-regexp-list
|
|
2875 (append LaTeX-auto-regexp-list plain-TeX-auto-regexp-list))
|
|
2876
|
|
2877 (setq paragraph-start
|
|
2878 (concat
|
|
2879 "\\("
|
|
2880 "^.*[^" TeX-esc "\n]%.*$\\|"
|
|
2881 "^%.*$\\|"
|
|
2882 "^[ \t]*$\\|"
|
|
2883 "^[ \t]*"
|
|
2884 (regexp-quote TeX-esc)
|
|
2885 "\\("
|
|
2886 LaTeX-paragraph-commands
|
|
2887 "\\|item\\b"
|
|
2888 "\\)"
|
|
2889 "\\|"
|
|
2890 "^[ \t]*\\$\\$" ; display math delimitor
|
|
2891 "\\)" ))
|
|
2892 (setq paragraph-separate
|
|
2893 (concat
|
|
2894 "\\("
|
|
2895 "^.*[^" TeX-esc "\n]%.*$\\|"
|
|
2896 "^%.*$\\|"
|
|
2897 "^[ \t]*$\\|"
|
|
2898 "^[ \t]*"
|
|
2899 (regexp-quote TeX-esc)
|
|
2900 "\\("
|
|
2901 LaTeX-paragraph-commands
|
|
2902 "\\)"
|
|
2903 "\\)"))
|
|
2904 (setq selective-display t)
|
|
2905
|
|
2906 (make-local-variable 'LaTeX-item-list)
|
|
2907 (setq LaTeX-item-list '(("description" . LaTeX-item-argument)
|
|
2908 ("thebibliography" . LaTeX-item-bib)))
|
|
2909
|
|
2910 (setq TeX-complete-list
|
|
2911 (append '(("\\\\cite\\[[^]\n\r\\%]*\\]{\\([^{}\n\r\\%,]*\\)"
|
|
2912 1 LaTeX-bibitem-list "}")
|
|
2913 ("\\\\cite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
|
|
2914 ("\\\\cite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
|
|
2915 2 LaTeX-bibitem-list)
|
|
2916 ("\\\\nocite{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-bibitem-list "}")
|
|
2917 ("\\\\nocite{\\([^{}\n\r\\%]*,\\)\\([^{}\n\r\\%,]*\\)"
|
|
2918 2 LaTeX-bibitem-list)
|
|
2919 ("\\\\ref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
|
|
2920 ("\\\\eqref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
|
|
2921 ("\\\\pageref{\\([^{}\n\r\\%,]*\\)" 1 LaTeX-label-list "}")
|
|
2922 ("\\\\begin{\\([A-Za-z]*\\)" 1 LaTeX-environment-list "}")
|
|
2923 ("\\\\end{\\([A-Za-z]*\\)" 1 LaTeX-environment-list "}")
|
|
2924 ("\\\\renewcommand{\\\\\\([A-Za-z]*\\)"
|
|
2925 1 LaTeX-symbol-list "}")
|
|
2926 ("\\\\renewenvironment{\\([A-Za-z]*\\)"
|
|
2927 1 LaTeX-environment-list "}"))
|
|
2928 TeX-complete-list))
|
|
2929
|
|
2930 (LaTeX-add-environments
|
|
2931 '("document" LaTeX-env-document)
|
|
2932 '("enumerate" LaTeX-env-item)
|
|
2933 '("itemize" LaTeX-env-item)
|
|
2934 '("list" LaTeX-env-list)
|
|
2935 '("trivlist" LaTeX-env-item)
|
|
2936 '("picture" LaTeX-env-picture)
|
|
2937 '("tabular" LaTeX-env-array)
|
|
2938 '("tabular*" LaTeX-env-array)
|
|
2939 '("array" LaTeX-env-array)
|
|
2940 '("eqnarray" LaTeX-env-label)
|
|
2941 '("equation" LaTeX-env-label)
|
|
2942 '("minipage" LaTeX-env-minipage)
|
|
2943
|
|
2944 ;; The following have no special support, but are included in
|
|
2945 ;; case the auto files are missing.
|
|
2946
|
|
2947 "sloppypar" "picture" "tabbing" "verbatim" "verbatim*"
|
|
2948 "flushright" "flushleft" "displaymath" "math" "quote" "quotation"
|
|
2949 "abstract" "center" "titlepage" "verse" "eqnarray*"
|
|
2950
|
|
2951 ;; The following are not defined in latex.el, but in a number of
|
|
2952 ;; other style files. I'm to lazy to copy them to all the
|
|
2953 ;; corresponding .el files right now.
|
|
2954
|
|
2955 ;; This means that AUC TeX will complete e.g.
|
|
2956 ;; ``thebibliography'' in a letter, but I guess we can live with
|
|
2957 ;; that.
|
|
2958
|
|
2959 '("description" LaTeX-env-item)
|
|
2960 '("figure" LaTeX-env-figure)
|
|
2961 '("figure*" LaTeX-env-figure)
|
|
2962 '("table" LaTeX-env-figure)
|
|
2963 '("table*" LaTeX-env-figure)
|
|
2964 '("thebibliography" LaTeX-env-bib)
|
|
2965 '("theindex" LaTeX-env-item))
|
|
2966
|
|
2967 (TeX-add-symbols
|
|
2968 '("addtocounter" TeX-arg-counter "Value")
|
|
2969 '("alph" TeX-arg-counter)
|
|
2970 '("arabic" TeX-arg-counter)
|
|
2971 '("fnsymbol" TeX-arg-define-counter)
|
|
2972 '("newcounter" TeX-arg-define-counter
|
|
2973 [ TeX-arg-counter "Within counter" ])
|
|
2974 '("roman" TeX-arg-counter)
|
|
2975 '("setcounter" TeX-arg-counter "Value")
|
|
2976 '("usecounter" TeX-arg-counter)
|
|
2977 '("value" TeX-arg-counter)
|
|
2978 '("stepcounter" TeX-arg-counter)
|
|
2979 '("refstepcounter" TeX-arg-counter)
|
|
2980 '("label" TeX-arg-define-label)
|
|
2981 '("pageref" TeX-arg-label)
|
|
2982 '("ref" TeX-arg-label)
|
|
2983 '("newcommand" TeX-arg-define-macro [ "Number of arguments" ] t)
|
|
2984 '("renewcommand" TeX-arg-macro [ "Number of arguments" ] t)
|
|
2985 '("newenvironment" TeX-arg-define-environment
|
|
2986 [ "Number of arguments"] t t)
|
|
2987 '("renewenvironment" TeX-arg-environment
|
|
2988 [ "Number of arguments"] t t)
|
|
2989 '("newtheorem" TeX-arg-define-environment
|
|
2990 [ TeX-arg-environment "Numbered like" ]
|
|
2991 t [ (TeX-arg-eval progn (if (eq (save-excursion
|
|
2992 (backward-char 2)
|
|
2993 (preceding-char)) ?\])
|
|
2994 ()
|
|
2995 (TeX-arg-counter t "Within counter"))
|
|
2996 "") ])
|
|
2997 '("newfont" TeX-arg-define-macro t)
|
|
2998 '("circle" "Diameter")
|
|
2999 '("circle*" "Diameter")
|
|
3000 '("dashbox" "Dash Length" TeX-arg-size
|
|
3001 [ TeX-arg-corner ] t)
|
|
3002 '("frame" t)
|
|
3003 '("framebox" (TeX-arg-conditional
|
|
3004 (string-equal (LaTeX-current-environment) "picture")
|
|
3005 (TeX-arg-size [ TeX-arg-corner ] t)
|
|
3006 ([ "Length" ] [ TeX-arg-lr ] t)))
|
|
3007 '("line" (TeX-arg-pair "X slope" "Y slope") "Length")
|
|
3008 '("linethickness" "Dimension")
|
|
3009 '("makebox" (TeX-arg-conditional
|
|
3010 (string-equal (LaTeX-current-environment) "picture")
|
|
3011 (TeX-arg-size [ TeX-arg-corner ] t)
|
|
3012 ([ "Length" ] [ TeX-arg-lr ] t)))
|
|
3013 '("multiput"
|
|
3014 TeX-arg-coordinate
|
|
3015 (TeX-arg-pair "X delta" "Y delta")
|
|
3016 "Number of copies"
|
|
3017 t)
|
|
3018 '("oval" TeX-arg-size [ TeX-arg-corner "Portion" ])
|
|
3019 '("put" TeX-arg-coordinate t)
|
|
3020 '("savebox" TeX-arg-define-savebox
|
|
3021 (TeX-arg-conditional
|
|
3022 (string-equal (LaTeX-current-environment) "picture")
|
|
3023 (TeX-arg-size [ TeX-arg-corner ] t)
|
|
3024 ([ "Length" ] [ TeX-arg-lr ] t)))
|
|
3025 '("shortstack" [ TeX-arg-lr ] t)
|
|
3026 '("vector" (TeX-arg-pair "X slope" "Y slope") "Length")
|
|
3027 '("cline" "Span `i-j'")
|
|
3028 '("multicolumn" "Columns" "Position" t)
|
|
3029 '("item"
|
|
3030 (TeX-arg-conditional (or TeX-arg-item-label-p
|
|
3031 (string-equal (LaTeX-current-environment)
|
|
3032 "description"))
|
|
3033 ([ "Item label" ])
|
|
3034 ())
|
|
3035 (TeX-arg-literal " "))
|
|
3036 '("bibitem" [ "Bibitem label" ] TeX-arg-define-cite)
|
|
3037 '("cite"
|
|
3038 (TeX-arg-conditional TeX-arg-cite-note-p ([ "Note" ]) ())
|
|
3039 TeX-arg-cite)
|
|
3040 '("nocite" TeX-arg-cite)
|
|
3041 '("bibliographystyle" TeX-arg-bibstyle)
|
|
3042 '("bibliography" TeX-arg-bibliography)
|
|
3043 '("footnote"
|
|
3044 (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
|
|
3045 t)
|
|
3046 '("footnotetext"
|
|
3047 (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil)
|
|
3048 t)
|
|
3049 '("footnotemark"
|
|
3050 (TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil))
|
|
3051 '("newlength" TeX-arg-define-macro)
|
|
3052 '("setlength" TeX-arg-macro "Length")
|
|
3053 '("addtolength" TeX-arg-macro "Length")
|
|
3054 '("settowidth" TeX-arg-macro t)
|
|
3055 '("\\" [ "Space" ])
|
|
3056 '("\\*" [ "Space" ])
|
|
3057 '("hyphenation" t)
|
|
3058 '("linebreak" [ "How much [0 - 4]" ])
|
|
3059 '("nolinebreak" [ "How much [0 - 4]" ])
|
|
3060 '("nopagebreak" [ "How much [0 - 4]" ])
|
|
3061 '("pagebreak" [ "How much [0 - 4]" ])
|
|
3062 '("stackrel" t nil)
|
|
3063 '("frac" t nil)
|
|
3064 '("lefteqn" t)
|
|
3065 '("overbrace" t)
|
|
3066 '("overline" t)
|
|
3067 '("sqrt" [ "Root" ] t)
|
|
3068 '("underbrace" t)
|
|
3069 '("underline" t)
|
|
3070 '("author" t)
|
|
3071 '("date" t)
|
|
3072 '("thanks" t)
|
|
3073 '("title" t)
|
|
3074 '("pagenumbering" (TeX-arg-eval
|
|
3075 completing-read "Numbering style: "
|
|
3076 '(("arabic") ("roman") ("Roman") ("alph") ("Alph"))))
|
|
3077 '("pagestyle" TeX-arg-pagestyle)
|
|
3078 '("markboth" t nil)
|
|
3079 '("markright" t)
|
|
3080 '("thispagestyle" TeX-arg-pagestyle)
|
|
3081 '("addvspace" "Length")
|
|
3082 '("fbox" t)
|
|
3083 '("hspace*" "Length")
|
|
3084 '("hspace" "Length")
|
|
3085 '("mbox" t)
|
|
3086 '("newsavebox" TeX-arg-define-savebox)
|
|
3087 '("parbox" [ TeX-arg-tb] "Width" t)
|
|
3088 '("raisebox" "Raise" [ "Height above" ] [ "Depth below" ] t)
|
|
3089 '("rule" [ "Raise" ] "Width" "Thickness")
|
|
3090 '("sbox" TeX-arg-define-savebox t)
|
|
3091 '("usebox" TeX-arg-savebox)
|
|
3092 '("vspace*" "Length")
|
|
3093 '("vspace" "Length")
|
|
3094 '("documentstyle" TeX-arg-document)
|
|
3095 '("include" (TeX-arg-input-file "File" t))
|
|
3096 '("includeonly" t)
|
|
3097 '("input" TeX-arg-input-file)
|
|
3098 '("addcontentsline" TeX-arg-file
|
|
3099 (TeX-arg-eval
|
|
3100 completing-read "Numbering style: " LaTeX-section-list)
|
|
3101 t)
|
|
3102 '("addtocontents" TeX-arg-file t)
|
|
3103 '("typeout" t)
|
|
3104 '("typein" [ TeX-arg-define-macro ] t)
|
|
3105 '("verb" TeX-arg-verb)
|
|
3106 '("verb*" TeX-arg-verb)
|
|
3107 '("extracolsep" t)
|
|
3108 '("index" t)
|
|
3109 '("glossary" t)
|
|
3110 '("numberline" "Section number" "Heading")
|
|
3111 '("caption" t)
|
|
3112 '("marginpar" [ "Left margin text" ] "Text")
|
|
3113 '("left" TeX-arg-insert-braces)
|
|
3114
|
|
3115 ;; These have no special support, but are included in case the
|
|
3116 ;; auto files are missing.
|
|
3117
|
|
3118 "LaTeX" "SLiTeX" "samepage" "newline" "smallskip" "medskip"
|
|
3119 "bigskip" "stretch" "nonumber" "centering" "raggedright"
|
|
3120 "raggedleft" "kill" "pushtabs" "poptabs" "protect" "arraystretch"
|
|
3121 "hline" "vline" "cline" "thinlines" "thicklines" "and" "makeindex"
|
|
3122 "makeglossary" "reversemarginpar" "normalmarginpar"
|
|
3123 "raggedbottom" "flushbottom" "sloppy" "fussy" "newpage"
|
|
3124 "clearpage" "cleardoublepage" "twocolumn" "onecolumn")
|
|
3125
|
|
3126 (TeX-run-style-hooks "LATEX")
|
|
3127
|
|
3128 (make-local-variable 'TeX-font-list)
|
|
3129 (make-local-variable 'TeX-font-replace-function)
|
|
3130 (if (string-equal LaTeX-version "2")
|
|
3131 ()
|
|
3132 (setq TeX-font-list LaTeX-font-list)
|
|
3133 (setq TeX-font-replace-function 'LaTeX2e-font-replace)
|
|
3134 (TeX-add-symbols
|
|
3135 '("newcommand" TeX-arg-define-macro
|
|
3136 [ "Number of arguments" ] [ "Default value for first argument" ] t)
|
|
3137 '("renewcommand" TeX-arg-macro
|
|
3138 [ "Number of arguments" ] [ "Default value for first argument" ] t)
|
|
3139 '("usepackage" [ "Options" ] (TeX-arg-input-file "Package"))
|
|
3140 '("documentclass" TeX-arg-document)))
|
|
3141
|
|
3142 (TeX-add-style-hook "latex2e"
|
|
3143 ;; Use new fonts for `\documentclass' documents.
|
|
3144 (function (lambda ()
|
|
3145 (setq TeX-font-list LaTeX-font-list)
|
|
3146 (setq TeX-font-replace-function 'LaTeX2e-font-replace)
|
|
3147 (if (equal LaTeX-version "2")
|
|
3148 (setq TeX-command-default "LaTeX2e"))
|
|
3149 (run-hooks 'LaTeX2e-hook))))
|
|
3150
|
|
3151 (TeX-add-style-hook "latex2"
|
|
3152 ;; Use old fonts for `\documentstyle' documents.
|
|
3153 (function (lambda ()
|
|
3154 (setq TeX-font-list (default-value 'TeX-font-list))
|
|
3155 (setq TeX-font-replace-function
|
|
3156 (default-value 'TeX-font-replace-function))
|
|
3157 (run-hooks 'LaTeX2-hook)))))
|
|
3158
|
|
3159 (defvar LaTeX-builtin-opts
|
|
3160 '("12pt" "11pt" "10pt" "twocolumn" "twoside" "draft")
|
|
3161 "Built in options for LaTeX standard styles")
|
|
3162
|
|
3163 (defun LaTeX-209-to-2e ()
|
|
3164 "Make a stab at changing 2.09 doc header to 2e style."
|
|
3165 (interactive)
|
|
3166 (TeX-home-buffer)
|
|
3167 (let (optstr optlist 2eoptlist 2epackages docline docstyle)
|
|
3168 (goto-char (point-min))
|
|
3169 (if
|
|
3170 (search-forward-regexp
|
|
3171 "\\documentstyle\\[\\([^]]*\\)\\]{\\([^}]*\\)}"
|
|
3172 (point-max) t)
|
153
|
3173 (setq optstr (buffer-substring-no-properties (match-beginning 1) (match-end 1))
|
|
3174 docstyle (buffer-substring-no-properties (match-beginning 2)
|
24
|
3175 (match-end 2))
|
|
3176 optlist (TeX-split-string "," optstr))
|
|
3177 (if (search-forward-regexp
|
|
3178 "\\documentstyle{\\([^}]*\\)}"
|
|
3179 (point-max) t)
|
153
|
3180 (setq docstyle (buffer-substring-no-properties (match-beginning 1)
|
24
|
3181 (match-end 1)))
|
|
3182 (error "No documentstyle defined")))
|
|
3183 (beginning-of-line 1)
|
|
3184 (setq docline (point))
|
|
3185 (insert "%%%")
|
|
3186 (while optlist
|
|
3187 (if (member (car optlist) LaTeX-builtin-opts)
|
|
3188 (setq 2eoptlist (cons (car optlist) 2eoptlist))
|
|
3189 (setq 2epackages (cons (car optlist) 2epackages)))
|
|
3190 (setq optlist (cdr optlist)))
|
|
3191 ;;(message (format "%S %S" 2eoptlist 2epackages))
|
|
3192 (goto-char docline)
|
|
3193 (next-line 1)
|
|
3194 (insert "\\documentclass")
|
|
3195 (if 2eoptlist
|
|
3196 (insert "["
|
|
3197 (mapconcat (function (lambda (x) x))
|
|
3198 (nreverse 2eoptlist) ",") "]"))
|
|
3199 (insert "{" docstyle "}\n")
|
|
3200 (if 2epackages
|
|
3201 (insert "\\usepackage{"
|
|
3202 (mapconcat (function (lambda (x) x))
|
|
3203 (nreverse 2epackages) "}\n\\usepackage{") "}\n"))
|
|
3204 (if (equal docstyle "slides")
|
|
3205 (progn
|
|
3206 (goto-char (point-min))
|
|
3207 (while (re-search-forward "\\\\blackandwhite{" nil t)
|
|
3208 (replace-match "\\\\input{" nil nil)))))
|
|
3209 (TeX-normal-mode nil))
|
|
3210
|
|
3211 ;;; latex.el ends here
|