annotate lisp/auctex/latex.el @ 26:441bb1e64a06 r19-15b96

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