annotate lisp/auctex/latex.el @ 163:0132846995bd r20-3b8

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