Mercurial > hgrepos > hgweb.cgi > yatex
annotate yatexadd.el @ 73:f41b01fef5d6
Stable version(hope to be)
author | yuuji |
---|---|
date | Wed, 22 May 2002 04:57:42 +0000 |
parents | 0aaebd07dad0 |
children | 1b172d26b55e |
rev | line source |
---|---|
6 | 1 ;;; -*- Emacs-Lisp -*- |
8 | 2 ;;; YaTeX add-in functions. |
68 | 3 ;;; yatexadd.el rev.14 |
72 | 4 ;;; (c )1991-2000 by HIROSE Yuuji.[yuuji@yatex.org] |
73 | 5 ;;; Last modified Sat Sep 29 23:17:06 2001 on duke |
8 | 6 ;;; $Id$ |
6 | 7 |
8 ;;; | |
9 ;;Sample functions for LaTeX environment. | |
10 ;;; | |
11 (defvar YaTeX:tabular-default-rule | |
12 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}" | |
69 | 13 "*Your favorite default rule format.") |
14 | |
23 | 15 (defvar YaTeX:tabular-thick-vrule "\\vrule width %s" |
69 | 16 "*Vertical thick line format (without @{}). %s'll be replaced by its width.") |
17 | |
23 | 18 (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}" |
69 | 19 "*Horizontal thick line format. %s will be replaced by its width.") |
20 | |
6 | 21 (defun YaTeX:tabular () |
18 | 22 "YaTeX add-in function for tabular environment. |
23 Notice that this function refers the let-variable `env' in | |
24 YaTeX-make-begin-end." | |
23 | 25 (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline")) |
72 | 26 (if (string= YaTeX-env-name "tabular*") |
18 | 27 (setq width (concat "{" (read-string "Width: ") "}"))) |
28 (setq loc (YaTeX:read-position "tb") | |
23 | 29 bars (string-to-int |
30 (read-string "Number of columns(0 for default format): " "3"))) | |
31 (if (<= bars 0) | |
32 (setq ;if 0, simple format | |
33 rule YaTeX:tabular-default-rule | |
34 and "& &") | |
35 (while (< j bars) ;repeat bars-1 times | |
36 (setq rule (concat rule "c|") | |
37 and (concat and "& ") | |
38 j (1+ j))) | |
39 (setq rule (concat rule "c")) | |
40 (message "(N)ormal-frame or (T)hick frame? [nt]") | |
41 (setq ans (read-char)) | |
42 (cond | |
43 ((or (equal ans ?t) (equal ans ?T)) | |
44 (setq ans (read-string "Rule width: " "1pt") | |
45 rule (concat | |
46 "@{" (format YaTeX:tabular-thick-vrule ans) "}" | |
47 rule | |
48 "@{\\ " (format YaTeX:tabular-thick-vrule ans) "}") | |
49 hline (format YaTeX:tabular-thick-hrule ans))) | |
50 (t (setq rule (concat "|" rule "|") | |
51 hline "\\hline")))) | |
52 | |
6 | 53 (setq rule (read-string "rule format: " rule)) |
72 | 54 (setq YaTeX-single-command "hline") |
6 | 55 |
69 | 56 (format "%s%s{%s}" width loc rule))) |
57 | |
18 | 58 (fset 'YaTeX:tabular* 'YaTeX:tabular) |
59 (defun YaTeX:array () | |
60 (concat (YaTeX:read-position "tb") | |
69 | 61 "{" (read-string "Column format: ") "}")) |
6 | 62 |
23 | 63 (defun YaTeX:read-oneof (oneof) |
64 (let ((pos "") loc (guide "")) | |
65 (and (boundp 'name) name (setq guide (format "%s " name))) | |
6 | 66 (while (not (string-match |
8 | 67 (setq loc (read-key-sequence |
23 | 68 (format "%s position (`%s') [%s]: " |
68 | 69 guide oneof pos));name is in YaTeX-addin |
70 loc (if (fboundp 'events-to-keys) | |
71 (events-to-keys loc) loc)) | |
6 | 72 "\r\^g\n")) |
73 (cond | |
8 | 74 ((string-match loc oneof) |
6 | 75 (if (not (string-match loc pos)) |
76 (setq pos (concat pos loc)))) | |
77 ((and (string-match loc "\C-h\C-?") (> (length pos) 0)) | |
78 (setq pos (substring pos 0 (1- (length pos))))) | |
79 (t | |
80 (ding) | |
8 | 81 (message "Please input one of `%s'." oneof) |
6 | 82 (sit-for 3)))) |
8 | 83 (message "") |
69 | 84 pos)) |
23 | 85 |
86 (defun YaTeX:read-position (oneof) | |
87 "Read a LaTeX (optional) position format such as `[htbp]'." | |
88 (let ((pos (YaTeX:read-oneof oneof))) | |
69 | 89 (if (string= pos "") "" (concat "[" pos "]")))) |
8 | 90 |
91 (defun YaTeX:table () | |
92 "YaTeX add-in function for table environment." | |
73 | 93 (cond |
94 ((eq major-mode 'yatex-mode) | |
95 (setq YaTeX-env-name "tabular" | |
96 YaTeX-section-name "caption") | |
97 (YaTeX:read-position "htbp")) | |
98 ((eq major-mode 'texinfo-mode) | |
99 (concat " " | |
100 (completing-read | |
101 "Highlights with: " | |
102 '(("@samp")("@kbd")("@code")("@asis")("@file")("@var")) | |
103 nil nil "@"))))) | |
6 | 104 |
46 | 105 (fset 'YaTeX:figure 'YaTeX:table) |
106 (fset 'YaTeX:figure* 'YaTeX:table) | |
107 | |
108 | |
6 | 109 (defun YaTeX:description () |
110 "Truly poor service:-)" | |
72 | 111 (setq YaTeX-single-command "item[]") |
69 | 112 "") |
6 | 113 |
114 (defun YaTeX:itemize () | |
115 "It's also poor service." | |
72 | 116 (setq YaTeX-single-command "item") |
69 | 117 "") |
6 | 118 |
119 (fset 'YaTeX:enumerate 'YaTeX:itemize) | |
8 | 120 |
11 | 121 (defun YaTeX:picture () |
122 "Ask the size of coordinates of picture environment." | |
123 (concat (YaTeX:read-coordinates "Picture size") | |
69 | 124 (YaTeX:read-coordinates "Initial position"))) |
11 | 125 |
12 | 126 (defun YaTeX:equation () |
59 | 127 (YaTeX-jmode-off) |
12 | 128 (if (fboundp 'YaTeX-toggle-math-mode) |
69 | 129 (YaTeX-toggle-math-mode t))) ;force math-mode ON. |
130 | |
59 | 131 (mapcar '(lambda (f) (fset f 'YaTeX:equation)) |
132 '(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align* | |
133 YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather* | |
134 YaTeX:aligned* YaTeX:gathered YaTeX:gathered* | |
135 YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat* | |
136 YaTeX:xxalignat YaTeX:xxalignat*)) | |
12 | 137 |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
138 (defun YaTeX:list () |
69 | 139 "%\n{} %default label\n{} %formatting parameter") |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
140 |
18 | 141 (defun YaTeX:minipage () |
142 (concat (YaTeX:read-position "cbt") | |
69 | 143 "{" (read-string "Width: ") "}")) |
18 | 144 |
64 | 145 (defun YaTeX:thebibliography () |
72 | 146 (setq YaTeX-section-name "bibitem") |
69 | 147 "") |
64 | 148 |
8 | 149 ;;; |
150 ;;Sample functions for section-type command. | |
151 ;;; | |
152 (defun YaTeX:multiput () | |
153 (concat (YaTeX:read-coordinates "Pos") | |
154 (YaTeX:read-coordinates "Step") | |
69 | 155 "{" (read-string "How many times: ") "}")) |
8 | 156 |
157 (defun YaTeX:put () | |
69 | 158 (YaTeX:read-coordinates "Pos")) |
8 | 159 |
160 (defun YaTeX:makebox () | |
23 | 161 (cond |
162 ((YaTeX-in-environment-p "picture") | |
163 (concat (YaTeX:read-coordinates "Dimension") | |
164 (YaTeX:read-position "lrtb"))) | |
165 (t | |
166 (let ((width (read-string "Width: "))) | |
167 (if (string< "" width) | |
168 (progn | |
169 (or (equal (aref width 0) ?\[) | |
170 (setq width (concat "[" width "]"))) | |
69 | 171 (concat width (YaTeX:read-position "lr")))))))) |
8 | 172 |
173 (defun YaTeX:framebox () | |
174 (if (YaTeX-quick-in-environment-p "picture") | |
69 | 175 (YaTeX:makebox))) |
8 | 176 |
177 (defun YaTeX:dashbox () | |
178 (concat "{" (read-string "Dash dimension: ") "}" | |
69 | 179 (YaTeX:read-coordinates "Dimension"))) |
8 | 180 |
51 | 181 (defvar YaTeX-minibuffer-quick-map nil) |
182 (if YaTeX-minibuffer-quick-map nil | |
183 (setq YaTeX-minibuffer-quick-map | |
184 (copy-keymap minibuffer-local-completion-map)) | |
185 (let ((ch (1+ ? ))) | |
186 (while (< ch 127) | |
187 (define-key YaTeX-minibuffer-quick-map (char-to-string ch) | |
188 'YaTeX-minibuffer-quick-complete) | |
189 (setq ch (1+ ch))))) | |
190 | |
191 (defvar YaTeX:left-right-delimiters | |
192 '(("(" . ")") (")" . "(") ("[" . "]") ("]" . "[") | |
193 ("\\{" . "\\}") ("\\}" . "\\{") ("|") ("\\|") | |
194 ("\\lfloor" . "\\rfloor") ("\\lceil" . "\\rceil") | |
195 ("\\langle" . "\\rangle") ("/") (".") | |
196 ("\\rfloor" . "\\rfloor") ("\\rceil" . "\\lceil") | |
197 ("\\rangle" . "\\langle") ("\\backslash") | |
198 ("\\uparrow") ("\\downarrow") ("\\updownarrow") ("\\Updownarrow")) | |
199 "TeX math delimiter, which can be completed after \\right or \\left.") | |
200 | |
201 (defvar YaTeX:left-right-default nil "Default string of YaTeX:right.") | |
202 | |
23 | 203 (defun YaTeX:left () |
51 | 204 (let ((minibuffer-completion-table YaTeX:left-right-delimiters) |
72 | 205 delimiter (leftp (string= YaTeX-single-command "left"))) |
51 | 206 (setq delimiter |
207 (read-from-minibuffer | |
208 (format "Delimiter%s: " | |
209 (if YaTeX:left-right-default | |
210 (format "(default=`%s')" YaTeX:left-right-default) | |
211 "(SPC for menu)")) | |
212 nil YaTeX-minibuffer-quick-map)) | |
213 (if (string= "" delimiter) (setq delimiter YaTeX:left-right-default)) | |
72 | 214 (setq YaTeX-single-command (if leftp "right" "left") |
51 | 215 YaTeX:left-right-default |
216 (or (cdr (assoc delimiter YaTeX:left-right-delimiters)) delimiter)) | |
217 delimiter)) | |
218 | |
23 | 219 (fset 'YaTeX:right 'YaTeX:left) |
220 | |
51 | 221 |
8 | 222 (defun YaTeX:read-coordinates (&optional mes varX varY) |
223 (concat | |
224 "(" | |
225 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X"))) | |
226 "," | |
227 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y"))) | |
69 | 228 ")")) |
8 | 229 |
230 ;;; | |
231 ;;Sample functions for maketitle-type command. | |
232 ;;; | |
233 (defun YaTeX:sum () | |
234 "Read range of summation." | |
235 (YaTeX:check-completion-type 'maketitle) | |
69 | 236 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^"))) |
8 | 237 |
238 (fset 'YaTeX:int 'YaTeX:sum) | |
239 | |
240 (defun YaTeX:lim () | |
241 "Insert limit notation of \\lim." | |
242 (YaTeX:check-completion-type 'maketitle) | |
243 (let ((var (read-string "Variable: ")) limit) | |
244 (if (string= "" var) "" | |
245 (setq limit (read-string "Limit ($ means infinity): ")) | |
246 (if (string= "$" limit) (setq limit "\\infty")) | |
69 | 247 (concat "_{" var " \\rightarrow " limit "}")))) |
8 | 248 |
249 (defun YaTeX:gcd () | |
250 "Add-in function for \\gcd(m,n)." | |
251 (YaTeX:check-completion-type 'maketitle) | |
69 | 252 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)")) |
8 | 253 |
254 (defun YaTeX:read-boundary (ULchar) | |
255 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar." | |
11 | 256 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): ")))) |
8 | 257 (if (string= bndry "") "" |
11 | 258 (if (string= bndry "$") (setq bndry "\\infty")) |
69 | 259 (concat ULchar "{" bndry "}")))) |
8 | 260 |
14 | 261 (defun YaTeX:verb () |
262 "Enclose \\verb's contents with the same characters." | |
263 (let ((quote-char (read-string "Quoting char: " "|")) | |
264 (contents (read-string "Quoted contents: "))) | |
69 | 265 (concat quote-char contents quote-char))) |
266 | |
23 | 267 (fset 'YaTeX:verb* 'YaTeX:verb) |
14 | 268 |
43
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
269 (defun YaTeX:footnotemark () |
72 | 270 (setq YaTeX-section-name "footnotetext") |
69 | 271 nil) |
43
ef686a35472d
Change the default section-type command to footnotetext after
yuuji
parents:
23
diff
changeset
|
272 |
48 | 273 (defun YaTeX:cite () |
274 (let ((comment (read-string "Comment for citation: "))) | |
275 (if (string= comment "") "" | |
69 | 276 (concat "[" comment "]")))) |
48 | 277 |
278 (defun YaTeX:bibitem () | |
64 | 279 (let ((label (read-string "Citation label for bibitem: "))) |
48 | 280 (if (string= label "") "" |
69 | 281 (concat "[" label "]")))) |
48 | 282 |
53
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
283 (defun YaTeX:item () |
73 | 284 (cond |
285 ((eq major-mode 'yatex-mode) | |
286 (YaTeX-indent-line) | |
287 (setq YaTeX-section-name "label")) | |
288 ((eq major-mode 'texinfo-mode) | |
289 (setq YaTeX-section-name "dots"))) ;?? | |
53
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
290 " ") |
52 | 291 (fset 'YaTeX:item\[\] 'YaTeX:item) |
292 (fset 'YaTeX:subitem 'YaTeX:item) | |
293 (fset 'YaTeX:subsubitem 'YaTeX:item) | |
294 | |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
295 (defun YaTeX:linebreak () |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
296 (let (obl) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
297 (message "Break strength 0,1,2,3,4 (default: 4): ") |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
298 (setq obl (char-to-string (read-char))) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
299 (if (string-match "[0-4]" obl) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
300 (concat "[" obl "]") |
69 | 301 ""))) |
58
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
302 (fset 'YaTeX:pagebreak 'YaTeX:linebreak) |
3a7c0c2bf16d
Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents:
57
diff
changeset
|
303 |
14 | 304 ;;; |
305 ;;Subroutine | |
306 ;;; | |
307 | |
8 | 308 (defun YaTeX:check-completion-type (type) |
309 "Check valid completion type." | |
310 (if (not (eq type YaTeX-current-completion-type)) | |
69 | 311 (error "This should be completed with %s-type completion." type))) |
11 | 312 |
313 | |
314 ;;; | |
315 ;;; [[Add-in functions for reading section arguments]] | |
316 ;;; | |
317 ;; All of add-in functions for reading sections arguments should | |
318 ;; take an argument ARGP that specify the argument position. | |
319 ;; If argument position is out of range, nil should be returned, | |
320 ;; else nil should NOT be returned. | |
13 | 321 |
322 ;; | |
323 ; Label selection | |
324 ;; | |
11 | 325 (defvar YaTeX-label-menu-other |
326 (if YaTeX-japan "':̃obt@̃x\n" "':LABEL IN OTHER BUFFER.\n")) | |
23 | 327 (defvar YaTeX-label-menu-repeat |
328 (if YaTeX-japan ".:O\\refƓ\n" "/:REPEAT LAST \ref{}\n")) | |
11 | 329 (defvar YaTeX-label-menu-any |
330 (if YaTeX-japan "*:Cӂ̕\n" "*:ANY STRING.\n")) | |
331 (defvar YaTeX-label-buffer "*Label completions*") | |
332 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.") | |
333 (defvar YaTeX-label-select-map nil | |
334 "Key map used in label selection buffer.") | |
335 (defun YaTeX::label-setup-key-map () | |
336 (if YaTeX-label-select-map nil | |
337 (message "Setting up label selection mode map...") | |
68 | 338 ;(setq YaTeX-label-select-map (copy-keymap global-map)) |
339 (setq YaTeX-label-select-map (make-keymap)) | |
11 | 340 (suppress-keymap YaTeX-label-select-map) |
341 (substitute-all-key-definition | |
342 'previous-line 'YaTeX::label-previous YaTeX-label-select-map) | |
343 (substitute-all-key-definition | |
344 'next-line 'YaTeX::label-next YaTeX-label-select-map) | |
345 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next) | |
346 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous) | |
347 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer) | |
348 (define-key YaTeX-label-select-map ">" 'end-of-buffer) | |
349 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit) | |
350 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit) | |
351 (define-key YaTeX-label-select-map " " 'exit-recursive-edit) | |
352 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit) | |
353 (define-key YaTeX-label-select-map "/" 'isearch-forward) | |
354 (define-key YaTeX-label-select-map "?" 'isearch-backward) | |
355 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag) | |
23 | 356 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag) |
11 | 357 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag) |
358 (message "Setting up label selection mode map...Done") | |
359 (let ((key ?A)) | |
360 (while (<= key ?Z) | |
361 (define-key YaTeX-label-select-map (char-to-string key) | |
362 'YaTeX::label-search-tag) | |
363 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A))) | |
364 'YaTeX::label-search-tag) | |
69 | 365 (setq key (1+ key)))))) |
366 | |
11 | 367 (defun YaTeX::label-next () |
368 (interactive) (forward-line 1) (message YaTeX-label-guide-msg)) | |
369 (defun YaTeX::label-previous () | |
370 (interactive) (forward-line -1) (message YaTeX-label-guide-msg)) | |
371 (defun YaTeX::label-search-tag () | |
372 (interactive) | |
68 | 373 (let ((case-fold-search t) |
374 (tag (regexp-quote (char-to-string last-command-char)))) | |
11 | 375 (cond |
376 ((save-excursion | |
377 (forward-char 1) | |
23 | 378 (re-search-forward (concat "^" tag) nil t)) |
11 | 379 (goto-char (match-beginning 0))) |
380 ((save-excursion | |
381 (goto-char (point-min)) | |
23 | 382 (re-search-forward (concat "^" tag) nil t)) |
11 | 383 (goto-char (match-beginning 0)))) |
69 | 384 (message YaTeX-label-guide-msg))) |
385 | |
70 | 386 ; (defun YaTeX::ref (argp &optional labelcmd refcmd) |
387 ; (cond | |
388 ; ((= argp 1) | |
389 ; (let ((lnum 0) e0 label label-list (buf (current-buffer)) | |
390 ; (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref")) | |
391 ; (p (point)) initl line cf) | |
392 ; (message "Collecting labels...") | |
393 ; (save-window-excursion | |
394 ; (YaTeX-showup-buffer | |
395 ; YaTeX-label-buffer (function (lambda (x) (window-width x)))) | |
396 ; (if (fboundp 'select-frame) (setq cf (selected-frame))) | |
397 ; (if (eq (window-buffer (minibuffer-window)) buf) | |
398 ; (progn | |
399 ; (other-window 1) | |
400 ; (setq buf (current-buffer)) | |
401 ; (set-buffer buf) | |
402 ; ;(message "cb=%s" buf)(sit-for 3) | |
403 ; )) | |
404 ; (save-excursion | |
405 ; (set-buffer (get-buffer-create YaTeX-label-buffer)) | |
406 ; (setq buffer-read-only nil) | |
407 ; (erase-buffer)) | |
408 ; (save-excursion | |
409 ; (goto-char (point-min)) | |
410 ; (let ((standard-output (get-buffer YaTeX-label-buffer))) | |
411 ; (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) | |
412 ; (while (YaTeX-re-search-active-forward | |
413 ; (concat "\\\\" labelcmd "\\b") | |
414 ; (regexp-quote YaTeX-comment-prefix) nil t) | |
415 ; (goto-char (match-beginning 0)) | |
416 ; (skip-chars-forward "^{") | |
417 ; (setq label | |
418 ; (buffer-substring | |
419 ; (1+ (point)) | |
420 ; (prog2 (forward-list 1) (setq e0 (1- (point))))) | |
421 ; label-list (cons label label-list)) | |
422 ; (or initl | |
423 ; (if (< p (point)) (setq initl lnum))) | |
424 ; (beginning-of-line) | |
425 ; (skip-chars-forward " \t\n" nil) | |
426 ; (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label | |
427 ; (buffer-substring (point) (point-end-of-line)))) | |
428 ; (setq lnum (1+ lnum)) | |
429 ; (message "Collecting \\%s{}... %d" labelcmd lnum) | |
430 ; (goto-char e0)) | |
431 ; (princ YaTeX-label-menu-other) | |
432 ; (princ YaTeX-label-menu-repeat) | |
433 ; (princ YaTeX-label-menu-any) | |
434 ; );standard-output | |
435 ; (goto-char p) | |
436 ; (or initl (setq initl lnum)) | |
437 ; (message "Collecting %s...Done" labelcmd) | |
438 ; (if (fboundp 'select-frame) (select-frame cf)) | |
439 ; (YaTeX-showup-buffer YaTeX-label-buffer nil t) | |
440 ; (YaTeX::label-setup-key-map) | |
441 ; (setq truncate-lines t) | |
442 ; (setq buffer-read-only t) | |
443 ; (use-local-map YaTeX-label-select-map) | |
444 ; (message YaTeX-label-guide-msg) | |
445 ; (goto-line (1+ initl)) ;goto recently defined label line | |
446 ; (switch-to-buffer (current-buffer)) | |
447 ; (unwind-protect | |
448 ; (progn | |
449 ; (recursive-edit) | |
450 ; (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion | |
451 ; (beginning-of-line) | |
452 ; (setq line (1- (count-lines (point-min)(point)))) | |
453 ; (cond | |
454 ; ((= line -1) (setq label "")) | |
455 ; ((= line lnum) (setq label (YaTeX-label-other))) | |
456 ; ((= line (1+ lnum)) | |
457 ; (save-excursion | |
458 ; (switch-to-buffer buf) | |
459 ; (goto-char p) | |
460 ; (if (re-search-backward | |
461 ; (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t) | |
462 ; (setq label (YaTeX-match-string 1)) | |
463 ; (setq label "")))) | |
464 ; ((>= line (+ lnum 2)) | |
465 ; (setq label (read-string (format "\\%s{???}: " refcmd)))) | |
466 ; (t (setq label (nth (- lnum line 1) label-list))))) | |
467 ; (bury-buffer YaTeX-label-buffer))) | |
468 ; label))))) | |
469 | |
470 (defun YaTeX::ref-generate-label () | |
471 "Generate a label string which is unique in current buffer." | |
472 (let ((default (substring (current-time-string) 4))) | |
473 (read-string "Give a label for this line: " | |
474 (if YaTeX-emacs-19 (cons default 1) default)))) | |
475 | |
476 (defun YaTeX::ref-getset-label (buffer point) | |
477 "Get label string in the BUFFER near the POINT. | |
478 Make \\label{xx} if no label." | |
73 | 479 ;;Here, we rewrite the LaTeX source. Therefore we should be careful |
480 ;;to decide the location suitable for \label. Do straightforward! | |
481 (let (boundary inspoint cc newlabel (labelholder "label") mathp env | |
482 (r-escape (regexp-quote YaTeX-comment-prefix))) | |
483 ;;(set-buffer buffer) | |
70 | 484 (switch-to-buffer buffer) |
485 (save-excursion | |
486 (goto-char point) | |
487 (setq cc (current-column)) | |
488 (if (= (char-after (point)) ?\\) (forward-char 1)) | |
489 (cond | |
490 ((looking-at YaTeX-sectioning-regexp) | |
491 (skip-chars-forward "^{") | |
492 (forward-list 1) | |
493 (skip-chars-forward " \t\n") | |
73 | 494 ;(setq boundary "[^\\]") |
495 (setq boundary | |
496 (save-excursion | |
497 (if (YaTeX-re-search-active-forward "[^\\]" r-escape nil 1) | |
498 (match-beginning 0) | |
499 (1- (point)))))) | |
70 | 500 ((looking-at "item\\s ") |
501 (setq cc (+ cc 6)) | |
73 | 502 ;(setq boundary (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b")) |
503 (setq boundary | |
504 (save-excursion | |
505 (if (YaTeX-re-search-active-forward | |
506 (concat YaTeX-ec-regexp "\\(item\\|begin\\|end\\)\\b") | |
507 r-escape nil 1) | |
508 (match-beginning 0) | |
509 (1- (point)))))) | |
70 | 510 ((looking-at "bibitem") |
73 | 511 (setq labelholder "bibitem") ; label holder is bibitem itself |
512 (setq boundary | |
513 (save-excursion | |
514 (if (YaTeX-re-search-active-forward | |
515 (concat YaTeX-ec-regexp "\\(bibitem\\|end\\)\\b") | |
516 r-escape nil 1) | |
517 (match-beginning 0) | |
518 (1- (point)))))) | |
70 | 519 ((string-match YaTeX::ref-mathenv-regexp |
520 (setq env (or (YaTeX-inner-environment t) "document"))) | |
521 (setq mathp t) | |
73 | 522 ;;(setq boundary (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)")) |
523 (setq boundary | |
524 (save-excursion | |
525 (if (YaTeX-re-search-active-forward | |
526 (concat YaTeX-ec-regexp "\\(\\\\\\|end{" env "}\\)") | |
527 r-escape nil 1) | |
528 (match-beginning 0) | |
529 (1- (point)))))) | |
530 ((looking-at "footnote\\s *{") | |
531 (skip-chars-forward "^{") ;move onto `{' | |
532 (setq boundary | |
533 (save-excursion | |
534 (condition-case err | |
535 (forward-list 1) | |
536 (error (error "\\\\footnote at point %s's brace not closed" | |
537 (point)))) | |
538 (1- (point))))) | |
70 | 539 ((looking-at "caption\\|\\(begin\\)") |
540 (skip-chars-forward "^{") | |
541 (if (match-beginning 1) (forward-list 1)) | |
73 | 542 ;;(setq boundary (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b")) |
543 (setq boundary | |
544 (save-excursion | |
545 (if (YaTeX-re-search-active-forward | |
546 (concat YaTeX-ec-regexp "\\(begin\\|end\\)\\b") | |
547 r-escape nil 1) | |
548 (match-beginning 0) | |
549 (1- (point)))))) | |
70 | 550 (t )) |
551 (if (save-excursion (skip-chars-forward " \t") (looking-at "%")) | |
552 (forward-line 1)) | |
553 (if (and (save-excursion | |
554 (YaTeX-re-search-active-forward | |
73 | 555 ;;(concat "\\(" labelholder "\\)\\|\\(" boundary "\\)") |
556 labelholder | |
70 | 557 (regexp-quote YaTeX-comment-prefix) |
73 | 558 boundary 1)) |
559 (match-beginning 0)) | |
70 | 560 ;; if \label{hoge} found, return it |
561 (buffer-substring | |
562 (progn | |
563 (goto-char (match-end 0)) | |
564 (skip-chars-forward "^{") (1+ (point))) | |
565 (progn | |
566 (forward-sexp 1) (1- (point)))) | |
567 ;;else make a label | |
73 | 568 ;(goto-char (match-beginning 0)) |
569 (goto-char boundary) | |
70 | 570 (skip-chars-backward " \t\n") |
571 (save-excursion (setq newlabel (YaTeX::ref-generate-label))) | |
572 (delete-region (point) (progn (skip-chars-backward " \t") (point))) | |
573 (if mathp nil | |
574 (insert "\n") | |
575 (YaTeX-reindent cc)) | |
576 (insert (format "\\label{%s}" newlabel)) | |
577 newlabel)))) | |
578 | |
579 (defvar YaTeX::ref-labeling-regexp-alist | |
580 '(("\\\\begin{java}{\\([^}]+\\)}" . 1) | |
581 ("\\\\elabel{\\([^}]+\\)}" . 1))) | |
582 (defvar YaTeX::ref-labeling-regexp | |
583 (mapconcat 'car YaTeX::ref-labeling-regexp-alist "\\|")) | |
584 (defvar YaTeX::ref-mathenv-regexp | |
585 "equation\\|eqnarray\\|align\\|gather\\|alignat\\|xalignat") | |
586 (defvar YaTeX::ref-enumerateenv-regexp | |
587 "enumerate") | |
588 | |
589 (defvar YaTeX::ref-labeling-section-level 2 | |
72 | 590 "*ref⊮ŎWZNVjOR}h̉x |
70 | 591 YaTeX-sectioning-level̐lŎw.") |
592 | |
48 | 593 (defun YaTeX::ref (argp &optional labelcmd refcmd) |
70 | 594 (setplist 'YaTeX::ref-labeling-regexp nil) ;erase memory cache |
595 (require 'yatexsec) | |
11 | 596 (cond |
597 ((= argp 1) | |
70 | 598 (let*((lnum 0) e0 x cmd label match-point point-list boundary |
599 (buf (current-buffer)) | |
600 (llv YaTeX::ref-labeling-section-level) | |
601 (mathenvs YaTeX::ref-mathenv-regexp) | |
602 (enums YaTeX::ref-enumerateenv-regexp) | |
603 (counter | |
604 (or labelcmd | |
605 (concat | |
606 YaTeX-ec-regexp "\\(\\(" | |
607 (mapconcat | |
608 'concat | |
609 (delq nil | |
610 (mapcar | |
72 | 611 (function |
612 (lambda (s) | |
613 (if (>= llv (cdr s)) | |
614 (car s)))) | |
70 | 615 YaTeX-sectioning-level)) |
616 "\\|") | |
73 | 617 "\\|caption\\|footnote\\){" |
70 | 618 "\\|\\(begin{\\(" mathenvs "\\|" enums "\\)\\)\\)"))) |
619 (regexp (concat "\\(" counter | |
620 "\\)\\|\\(" YaTeX::ref-labeling-regexp "\\)")) | |
621 (itemsep (concat YaTeX-ec-regexp | |
622 "\\(\\(bib\\)?item\\|begin\\|end\\)")) | |
623 (refcmd (or refcmd "ref")) | |
624 (p (point)) initl line cf | |
625 (percent (regexp-quote YaTeX-comment-prefix)) | |
626 (output | |
627 (function | |
628 (lambda (label p) | |
629 (while (setq x (string-match "\n" label)) | |
630 (aset label x ? )) | |
631 (while (setq x (string-match "[ \t\n][ \t\n]+" label)) | |
632 (setq label (concat | |
633 (substring label 0 (1+ (match-beginning 0))) | |
634 (substring label (match-end 0))))) | |
635 (princ (format "%c: <<%s>>\n" (+ (% lnum 26) ?A) label)) | |
636 (setq point-list (cons p point-list)) | |
637 (message "Collecting labels... %d" lnum) | |
638 (setq lnum (1+ lnum))))) | |
639 ) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
640 (message "Collecting labels...") |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
641 (save-window-excursion |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
642 (YaTeX-showup-buffer |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
643 YaTeX-label-buffer (function (lambda (x) (window-width x)))) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
644 (if (fboundp 'select-frame) (setq cf (selected-frame))) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
645 (if (eq (window-buffer (minibuffer-window)) buf) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
646 (progn |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
647 (other-window 1) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
648 (setq buf (current-buffer)) |
70 | 649 (set-buffer buf))) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
650 (save-excursion |
69 | 651 (set-buffer (get-buffer-create YaTeX-label-buffer)) |
652 (setq buffer-read-only nil) | |
653 (erase-buffer)) | |
654 (save-excursion | |
70 | 655 (set-buffer buf) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
656 (goto-char (point-min)) |
69 | 657 (let ((standard-output (get-buffer YaTeX-label-buffer))) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
658 (princ (format "=== LABELS in [%s] ===\n" (buffer-name buf))) |
48 | 659 (while (YaTeX-re-search-active-forward |
70 | 660 regexp ;;counter |
661 percent nil t) | |
662 ;(goto-char (match-beginning 0)) | |
663 (setq e0 (match-end 0)) | |
664 (cond | |
73 | 665 ((YaTeX-literal-p) nil) |
72 | 666 ((YaTeX-match-string 1) |
70 | 667 ;;if standard counter commands found |
668 (setq cmd (YaTeX-match-string 2)) | |
669 (setq match-point (match-beginning 0)) | |
670 (or initl | |
671 (if (< p (point)) (setq initl lnum))) | |
672 (cond | |
673 ((string-match mathenvs cmd) ;;if matches mathematical env | |
674 ;(skip-chars-forward "} \t\n") | |
675 (forward-line 1) | |
676 (setq x (point)) | |
677 (catch 'scan | |
678 (while (YaTeX-re-search-active-forward | |
679 (concat "\\\\\\\\$\\|\\\\end{\\(" mathenvs "\\)") | |
680 percent nil t) | |
681 (let ((quit (match-beginning 1))) | |
682 (funcall output | |
683 (buffer-substring x (match-beginning 0)) | |
684 x) | |
685 (if quit (throw 'scan t))) | |
686 (setq x (point)))) | |
687 (setq e0 (point))) | |
688 ((string-match enums cmd) | |
689 ;(skip-chars-forward "} \t\n") | |
690 (save-restriction | |
691 (narrow-to-region | |
692 (point) | |
693 (save-excursion | |
694 (YaTeX-goto-corresponding-environment) (point))) | |
695 (forward-line 1) | |
696 (while (YaTeX-re-search-active-forward | |
697 (concat YaTeX-ec-regexp "item\\s ") | |
698 percent nil t) | |
699 (setq x (match-beginning 0)) | |
700 (funcall | |
701 output | |
702 (buffer-substring | |
703 (match-beginning 0) | |
704 (if (re-search-forward itemsep nil t) | |
705 (progn (goto-char (match-beginning 0)) | |
706 (skip-chars-backward " \t") | |
707 (1- (point))) | |
708 (point-end-of-line))) | |
709 x)))) | |
710 | |
711 ((= (char-after (1- (point))) ?{) | |
712 (setq label (buffer-substring | |
713 (match-beginning 0) | |
714 (progn (forward-char -1) | |
715 (forward-list 1) | |
716 (point)))) | |
717 (funcall output label match-point)) | |
718 (t | |
719 (skip-chars-forward " \t") | |
720 (setq label (buffer-substring | |
721 (match-beginning 0) | |
722 (if (re-search-forward | |
723 itemsep | |
724 nil t) | |
725 (progn | |
726 (goto-char (match-beginning 0)) | |
727 (skip-chars-backward " \t") | |
728 (1- (point))) | |
729 (point-end-of-line)))) | |
730 (funcall output label match-point) | |
731 )) | |
732 ) ;;put label buffer | |
733 ;; | |
734 ;; if user defined label found | |
735 (t | |
736 ;; memorize line number and label into property | |
737 (goto-char (match-beginning 0)) | |
738 (let ((list YaTeX::ref-labeling-regexp-alist) | |
739 (cache (symbol-plist 'YaTeX::ref-labeling-regexp))) | |
740 (while list | |
741 (if (looking-at (car (car list))) | |
742 (progn | |
743 (setq label (YaTeX-match-string 0)) | |
744 (put 'YaTeX::ref-labeling-regexp lnum | |
745 (YaTeX-match-string (cdr (car list)))) | |
746 (funcall output label 0) ;;0 is dummy, never used | |
747 (setq list nil))) | |
748 (setq list (cdr list)))) | |
749 )) | |
11 | 750 (goto-char e0)) |
751 (princ YaTeX-label-menu-other) | |
23 | 752 (princ YaTeX-label-menu-repeat) |
11 | 753 (princ YaTeX-label-menu-any) |
69 | 754 );standard-output |
11 | 755 (goto-char p) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
756 (or initl (setq initl lnum)) |
70 | 757 (message "Collecting labels...Done") |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
758 (if (fboundp 'select-frame) (select-frame cf)) |
59 | 759 (YaTeX-showup-buffer YaTeX-label-buffer nil t) |
11 | 760 (YaTeX::label-setup-key-map) |
761 (setq truncate-lines t) | |
762 (setq buffer-read-only t) | |
763 (use-local-map YaTeX-label-select-map) | |
764 (message YaTeX-label-guide-msg) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
765 (goto-line (1+ initl)) ;goto recently defined label line |
68 | 766 (switch-to-buffer (current-buffer)) |
11 | 767 (unwind-protect |
768 (progn | |
769 (recursive-edit) | |
70 | 770 |
11 | 771 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion |
772 (beginning-of-line) | |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
773 (setq line (1- (count-lines (point-min)(point)))) |
11 | 774 (cond |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
775 ((= line -1) (setq label "")) |
11 | 776 ((= line lnum) (setq label (YaTeX-label-other))) |
23 | 777 ((= line (1+ lnum)) |
778 (save-excursion | |
779 (switch-to-buffer buf) | |
780 (goto-char p) | |
48 | 781 (if (re-search-backward |
782 (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t) | |
783 (setq label (YaTeX-match-string 1)) | |
23 | 784 (setq label "")))) |
785 ((>= line (+ lnum 2)) | |
48 | 786 (setq label (read-string (format "\\%s{???}: " refcmd)))) |
70 | 787 (t ;(setq label (nth (- lnum line 1) label-list)) |
788 (setq label | |
789 (or (get 'YaTeX::ref-labeling-regexp line) | |
790 (YaTeX::ref-getset-label | |
791 buf (nth (- lnum line 1) point-list)))) | |
792 ))) | |
11 | 793 (bury-buffer YaTeX-label-buffer))) |
69 | 794 label))))) |
795 | |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
796 (fset 'YaTeX::pageref 'YaTeX::ref) |
70 | 797 |
798 (defun YaTeX::cite-collect-bibs-external (&rest files) | |
799 "Collect bibentry from FILES(variable length argument); | |
800 and print them to standard output." | |
801 ;;Thanks; http://icarus.ilcs.hokudai.ac.jp/comp/biblio.html | |
802 (let ((tb (get-buffer-create " *bibtmp*"))) | |
803 (save-excursion | |
804 (set-buffer tb) | |
805 (while files | |
806 (erase-buffer) | |
807 (cond | |
808 ((file-exists-p (car files)) | |
809 (insert-file-contents (car files))) | |
810 ((file-exists-p (concat (car files) ".bib")) | |
811 (insert-file-contents (concat (car files) ".bib")))) | |
812 (save-excursion | |
813 (goto-char (point-min)) | |
814 (while (re-search-forward "^\\s *@[A-Za-z]" nil t) | |
815 (skip-chars-forward "^{,") | |
816 (if (= (char-after (point)) ?{) | |
817 (princ (format "%sbibitem{%s}%s\n" | |
818 YaTeX-ec | |
819 (buffer-substring | |
820 (1+ (point)) | |
821 (progn (skip-chars-forward "^,\n") | |
822 (point))) | |
823 (if (re-search-forward "title\\s *=" nil t) | |
824 (buffer-substring | |
825 (progn | |
826 (goto-char (match-end 0)) | |
827 (skip-chars-forward " \t\n") | |
828 (point)) | |
829 (progn | |
830 (if (looking-at "[{\"]") | |
831 (forward-sexp 1) | |
832 (forward-char 1) | |
833 (skip-chars-forward "^,")) | |
834 (point))))))))) | |
835 (setq files (cdr files)))))) | |
836 | |
837 (defun YaTeX::cite-collect-bibs-internal () | |
838 "Collect bibentry in the current buffer and print them to standard output." | |
839 (let ((ptn (concat YaTeX-ec-regexp "bibitem\\b")) | |
840 (pcnt (regexp-quote YaTeX-comment-prefix))) | |
841 (save-excursion | |
842 (while (YaTeX-re-search-active-forward ptn pcnt nil t) | |
843 (skip-chars-forward "^{\n") | |
844 (or (eolp) | |
845 (princ (format "%sbibitem{%s}\n" | |
846 YaTeX-ec | |
847 (buffer-substring | |
848 (1+ (point)) | |
849 (progn (forward-sexp 1) (point)))))))))) | |
850 | |
48 | 851 (defun YaTeX::cite (argp) |
852 (cond | |
853 ((eq argp 1) | |
70 | 854 (let* ((cb (current-buffer)) |
855 (f (file-name-nondirectory buffer-file-name)) | |
856 (d default-directory) | |
857 (hilit-auto-highlight nil) | |
858 (pcnt (regexp-quote YaTeX-comment-prefix)) | |
859 (bibrx (concat YaTeX-ec-regexp "bibliography{\\([^}]+\\)}")) | |
860 (bbuf (get-buffer-create " *bibitems*")) | |
861 (standard-output bbuf) | |
862 bibs files) | |
863 (set-buffer bbuf)(erase-buffer)(set-buffer cb) | |
864 (save-excursion | |
865 (goto-char (point-min)) | |
866 ;;(1)search external bibdata | |
867 (while (YaTeX-re-search-active-forward bibrx pcnt nil t) | |
868 (apply 'YaTeX::cite-collect-bibs-external | |
869 (YaTeX-split-string | |
870 (YaTeX-match-string 1) ","))) | |
871 ;;(2)search direct \bibitem usage | |
872 (YaTeX::cite-collect-bibs-internal) | |
873 (if (progn | |
874 (YaTeX-visit-main t) | |
875 (not (eq (current-buffer) cb))) | |
876 (save-excursion | |
877 (goto-char (point-min)) | |
878 ;;(1)search external bibdata | |
879 (while (YaTeX-re-search-active-forward bibrx pcnt nil t) | |
880 (apply 'YaTeX::cite-collect-bibs-external | |
881 (YaTeX-split-string | |
882 (YaTeX-match-string 1) ","))) | |
883 ;;(2)search internal | |
884 (YaTeX::cite-collect-bibs-internal))) | |
885 ;;Now bbuf holds the list of bibitem | |
886 (set-buffer bbuf) | |
887 (YaTeX::ref argp "\\\\\\(bibitem\\)\\(\\[.*\\]\\)?" "cite")))) | |
888 | |
48 | 889 (t nil))) |
11 | 890 |
70 | 891 (and YaTeX-use-AMS-LaTeX (fset 'YaTeX::eqref 'YaTeX::ref)) |
892 | |
48 | 893 (defun YaTeX-yatex-buffer-list () |
894 (save-excursion | |
895 (delq nil (mapcar (function (lambda (buf) | |
896 (set-buffer buf) | |
897 (if (eq major-mode 'yatex-mode) buf))) | |
69 | 898 (buffer-list))))) |
48 | 899 |
900 (defun YaTeX-select-other-yatex-buffer () | |
901 "Select buffer from all yatex-mode's buffers interactivelly." | |
902 (interactive) | |
903 (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list)) | |
904 (lnum -1) buf rv | |
11 | 905 (ff "**find-file**")) |
12 | 906 (YaTeX-showup-buffer |
907 lbuf (function (lambda (x) 1))) ;;Select next window surely. | |
69 | 908 (save-excursion |
909 (set-buffer (get-buffer lbuf)) | |
910 (setq buffer-read-only nil) | |
911 (erase-buffer)) | |
912 (let ((standard-output (get-buffer lbuf))) | |
11 | 913 (while blist |
48 | 914 (princ |
915 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A) | |
916 (buffer-name (car blist)))) | |
11 | 917 (setq blist (cdr blist))) |
918 (princ (format "':{%s}" ff))) | |
59 | 919 (YaTeX-showup-buffer lbuf nil t) |
11 | 920 (YaTeX::label-setup-key-map) |
921 (setq buffer-read-only t) | |
922 (use-local-map YaTeX-label-select-map) | |
923 (message YaTeX-label-guide-msg) | |
924 (unwind-protect | |
925 (progn | |
926 (recursive-edit) | |
927 (set-buffer lbuf) | |
928 (beginning-of-line) | |
929 (setq rv | |
930 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t) | |
931 (buffer-substring (match-beginning 1) (match-end 1)) nil))) | |
932 (kill-buffer lbuf)) | |
48 | 933 (if (string= rv ff) |
934 (progn | |
935 (call-interactively 'find-file) | |
936 (current-buffer)) | |
69 | 937 rv))) |
48 | 938 |
939 (defun YaTeX-label-other () | |
940 (let ((rv (YaTeX-select-other-yatex-buffer))) | |
11 | 941 (cond |
942 ((null rv) "") | |
943 (t | |
944 (set-buffer rv) | |
69 | 945 (YaTeX::ref argp labelcmd refcmd))))) |
11 | 946 |
13 | 947 ;; |
948 ; completion for the arguments of \newcommand | |
949 ;; | |
950 (defun YaTeX::newcommand (&optional argp) | |
951 (cond | |
952 ((= argp 1) | |
953 (let ((command (read-string "Define newcommand: " "\\"))) | |
954 (put 'YaTeX::newcommand 'command (substring command 1)) | |
955 command)) | |
956 ((= argp 2) | |
957 (let ((argc | |
958 (string-to-int (read-string "Number of arguments(Default 0): "))) | |
959 (def (read-string "Definition: ")) | |
960 (command (get 'YaTeX::newcommand 'command))) | |
961 ;;!!! It's illegal to insert string in the add-in function !!! | |
962 (if (> argc 0) (insert (format "[%d]" argc))) | |
963 (if (and (stringp command) | |
964 (string< "" command) | |
51 | 965 (y-or-n-p "Update dictionary?")) |
18 | 966 (cond |
967 ((= argc 0) | |
968 (YaTeX-update-table | |
969 (list command) | |
970 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table)) | |
971 ((= argc 1) | |
972 (YaTeX-update-table | |
973 (list command) | |
974 'section-table 'user-section-table 'tmp-section-table)) | |
975 (t (YaTeX-update-table | |
976 (list command argc) | |
977 'section-table 'user-section-table 'tmp-section-table)))) | |
13 | 978 (message "") |
979 def ;return command name | |
980 )) | |
69 | 981 (t ""))) |
13 | 982 |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
983 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
984 ; completion for the arguments of \pagestyle |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
985 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
986 (defun YaTeX::pagestyle (&optional argp) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
987 "Read the pagestyle with completion." |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
988 (completing-read |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
989 "Page style: " |
69 | 990 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil))) |
991 | |
51 | 992 (fset 'YaTeX::thispagestyle 'YaTeX::pagestyle) |
993 | |
16
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
994 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
995 ; completion for the arguments of \pagenumbering |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
996 ;; |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
997 (defun YaTeX::pagenumbering (&optional argp) |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
998 "Read the numbering style." |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
999 (completing-read |
cb9afa9c1213
Auto-indentation at begin-type completion works correctly.
yuuji
parents:
14
diff
changeset
|
1000 "Page numbering style: " |
69 | 1001 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman")))) |
13 | 1002 |
23 | 1003 ;; |
1004 ; Length | |
1005 ;; | |
1006 (defvar YaTeX:style-parameters-default | |
1007 '(("\\arraycolsep") | |
1008 ("\\arrayrulewidth") | |
1009 ("\\baselineskip") | |
1010 ("\\columnsep") | |
1011 ("\\columnseprule") | |
1012 ("\\doublerulesep") | |
1013 ("\\evensidemargin") | |
1014 ("\\footheight") | |
1015 ("\\footskip") | |
1016 ("\\headheight") | |
1017 ("\\headsep") | |
1018 ("\\itemindent") | |
1019 ("\\itemsep") | |
1020 ("\\labelsep") | |
1021 ("\\labelwidth") | |
1022 ("\\leftmargin") | |
1023 ("\\linewidth") | |
1024 ("\\listparindent") | |
1025 ("\\marginparsep") | |
1026 ("\\marginparwidth") | |
1027 ("\\mathindent") | |
1028 ("\\oddsidemargin") | |
1029 ("\\parindent") | |
1030 ("\\parsep") | |
1031 ("\\parskip") | |
1032 ("\\partopsep") | |
1033 ("\\rightmargin") | |
1034 ("\\tabcolsep") | |
1035 ("\\textheight") | |
1036 ("\\textwidth") | |
1037 ("\\topmargin") | |
1038 ("\\topsep") | |
1039 ("\\topskip") | |
1040 ) | |
1041 "Alist of LaTeX style parameters.") | |
1042 (defvar YaTeX:style-parameters-private nil | |
1043 "*User definable alist of style parameters.") | |
49 | 1044 (defvar YaTeX:style-parameters-local nil |
1045 "*User definable alist of local style parameters.") | |
23 | 1046 |
1047 (defvar YaTeX:length-history nil "Holds history of length.") | |
51 | 1048 (put 'YaTeX:length-history 'no-default t) |
23 | 1049 (defun YaTeX::setlength (&optional argp) |
1050 "YaTeX add-in function for arguments of \\setlength." | |
1051 (cond | |
1052 ((equal 1 argp) | |
49 | 1053 ;;(completing-read "Length variable: " YaTeX:style-parameters nil nil "\\") |
1054 (YaTeX-cplread-with-learning | |
1055 "Length variable: " | |
1056 'YaTeX:style-parameters-default | |
1057 'YaTeX:style-parameters-private | |
1058 'YaTeX:style-parameters-local | |
1059 nil nil "\\") | |
1060 ) | |
23 | 1061 ((equal 2 argp) |
69 | 1062 (read-string-with-history "Length: " nil 'YaTeX:length-history)))) |
1063 | |
23 | 1064 (fset 'YaTeX::addtolength 'YaTeX::setlength) |
1065 | |
1066 (defun YaTeX::settowidth (&optional argp) | |
1067 "YaTeX add-in function for arguments of \\settowidth." | |
1068 (cond | |
1069 ((equal 1 argp) | |
49 | 1070 (YaTeX-cplread-with-learning |
1071 "Length variable: " | |
1072 'YaTeX:style-parameters-default | |
1073 'YaTeX:style-parameters-private | |
1074 'YaTeX:style-parameters-local | |
1075 nil nil "\\")) | |
23 | 1076 ((equal 2 argp) |
69 | 1077 (read-string "Text: ")))) |
1078 | |
23 | 1079 (defun YaTeX::newlength (&optional argp) |
1080 "YaTeX add-in function for arguments of \\newlength" | |
1081 (cond | |
1082 ((equal argp 1) | |
1083 (let ((length (read-string "Length variable: " "\\"))) | |
49 | 1084 (if (string< "" length) |
1085 (YaTeX-update-table | |
1086 (list length) | |
1087 'YaTeX:style-parameters-default | |
1088 'YaTeX:style-parameters-private | |
1089 'YaTeX:style-parameters-local)) | |
69 | 1090 length)))) |
23 | 1091 |
1092 ;; \multicolumn's arguments | |
1093 (defun YaTeX::multicolumn (&optional argp) | |
1094 "YaTeX add-in function for arguments of \\multicolumn." | |
1095 (cond | |
1096 ((equal 1 argp) | |
1097 (read-string "Number of columns: ")) | |
1098 ((equal 2 argp) | |
1099 (let (c) | |
1100 (while (not (string-match | |
1101 (progn (message "Format(one of l,r,c): ") | |
1102 (setq c (char-to-string (read-char)))) | |
1103 "lrc"))) | |
1104 c)) | |
1105 ((equal 3 argp) | |
69 | 1106 (read-string "Item: ")))) |
23 | 1107 |
49 | 1108 (defvar YaTeX:documentstyles-default |
1109 '(("article") ("jarticle") ("j-article") | |
1110 ("book") ("jbook") ("j-book") | |
1111 ("report") ("jreport") ("j-report") | |
1112 ("letter") ("ascjletter")) | |
1113 "List of LaTeX documentstyles.") | |
1114 (defvar YaTeX:documentstyles-private nil | |
1115 "*User defined list of LaTeX documentstyles.") | |
1116 (defvar YaTeX:documentstyles-local nil | |
1117 "*User defined list of local LaTeX documentstyles.") | |
1118 (defvar YaTeX:documentstyle-options-default | |
1119 '(("a4j") ("a5j") ("b4j") ("b5j") | |
1120 ("twocolumn") ("jtwocolumn") ("epsf") ("epsfig") ("epsbox") ("nfig")) | |
1121 "List of LaTeX documentstyle options.") | |
1122 (defvar YaTeX:documentstyle-options-private nil | |
1123 "*User defined list of LaTeX documentstyle options.") | |
1124 (defvar YaTeX:documentstyle-options-local nil | |
1125 "List of LaTeX local documentstyle options.") | |
1126 | |
1127 (defvar YaTeX-minibuffer-completion-map nil | |
1128 "Minibuffer completion key map that allows comma completion.") | |
1129 (if YaTeX-minibuffer-completion-map nil | |
1130 (setq YaTeX-minibuffer-completion-map | |
1131 (copy-keymap minibuffer-local-completion-map)) | |
1132 (define-key YaTeX-minibuffer-completion-map " " | |
1133 'YaTeX-minibuffer-complete) | |
1134 (define-key YaTeX-minibuffer-completion-map "\t" | |
1135 'YaTeX-minibuffer-complete)) | |
1136 | |
1137 (defun YaTeX:documentstyle () | |
1138 (let*((delim ",") | |
1139 (dt (append YaTeX:documentstyle-options-local | |
1140 YaTeX:documentstyle-options-private | |
1141 YaTeX:documentstyle-options-default)) | |
1142 (minibuffer-completion-table dt) | |
1143 (opt (read-from-minibuffer | |
1144 "Style options ([opt1,opt2,...]): " | |
51 | 1145 nil YaTeX-minibuffer-completion-map nil)) |
49 | 1146 (substr opt) o) |
1147 (if (string< "" opt) | |
1148 (progn | |
1149 (while substr | |
1150 (setq o (substring substr 0 (string-match delim substr))) | |
1151 (or (assoc o dt) | |
1152 (YaTeX-update-table | |
1153 (list o) | |
1154 'YaTeX:documentstyle-options-default | |
1155 'YaTeX:documentstyle-options-private | |
1156 'YaTeX:documentstyle-options-local)) | |
1157 (setq substr | |
1158 (if (string-match delim substr) | |
1159 (substring substr (1+ (string-match delim substr)))))) | |
1160 (concat "[" opt "]")) | |
1161 ""))) | |
1162 | |
1163 (defun YaTeX::documentstyle (&optional argp) | |
51 | 1164 "YaTeX add-in function for arguments of \\documentstyle." |
49 | 1165 (cond |
1166 ((equal argp 1) | |
72 | 1167 (setq YaTeX-env-name "document") |
49 | 1168 (let ((sname |
1169 (YaTeX-cplread-with-learning | |
1170 (format "Documentstyle (default %s): " | |
1171 YaTeX-default-document-style) | |
1172 'YaTeX:documentstyles-default | |
1173 'YaTeX:documentstyles-private | |
1174 'YaTeX:documentstyles-local))) | |
1175 (if (string= "" sname) (setq sname YaTeX-default-document-style)) | |
69 | 1176 (setq YaTeX-default-document-style sname))))) |
49 | 1177 |
57 | 1178 ;;; -------------------- LaTeX2e stuff -------------------- |
1179 (defvar YaTeX:documentclass-options-default | |
70 | 1180 '(("a4paper") ("a5paper") ("b4paper") ("b5paper") ("10pt") ("11pt") ("12pt") |
57 | 1181 ("latterpaper") ("legalpaper") ("executivepaper") ("landscape") |
1182 ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib") | |
70 | 1183 ("tombow") ("titlepage") ("notitlepage") ("dvips") |
57 | 1184 ("clock") ;for slides class only |
1185 ) | |
1186 "Default options list for documentclass") | |
1187 (defvar YaTeX:documentclass-options-private nil | |
1188 "*User defined options list for documentclass") | |
1189 (defvar YaTeX:documentclass-options-local nil | |
1190 "*User defined options list for local documentclass") | |
1191 | |
1192 (defun YaTeX:documentclass () | |
1193 (let*((delim ",") | |
1194 (dt (append YaTeX:documentclass-options-local | |
1195 YaTeX:documentclass-options-private | |
1196 YaTeX:documentclass-options-default)) | |
1197 (minibuffer-completion-table dt) | |
1198 (opt (read-from-minibuffer | |
1199 "Documentclass options ([opt1,opt2,...]): " | |
1200 nil YaTeX-minibuffer-completion-map nil)) | |
1201 (substr opt) o) | |
1202 (if (string< "" opt) | |
1203 (progn | |
1204 (while substr | |
70 | 1205 |
57 | 1206 (setq o (substring substr 0 (string-match delim substr))) |
1207 (or (assoc o dt) | |
1208 (YaTeX-update-table | |
1209 (list o) | |
1210 'YaTeX:documentclass-options-default | |
1211 'YaTeX:documentclass-options-private | |
1212 'YaTeX:documentclass-options-local)) | |
1213 (setq substr | |
1214 (if (string-match delim substr) | |
1215 (substring substr (1+ (string-match delim substr)))))) | |
1216 (concat "[" opt "]")) | |
1217 ""))) | |
1218 | |
1219 (defvar YaTeX:documentclasses-default | |
1220 '(("article") ("jarticle") ("report") ("jreport") ("book") ("jbook") | |
1221 ("j-article") ("j-report") ("j-book") | |
1222 ("letter") ("slides") ("ltxdoc") ("ltxguide") ("ltnews") ("proc")) | |
1223 "Default documentclass alist") | |
1224 (defvar YaTeX:documentclasses-private nil | |
1225 "*User defined documentclass alist") | |
1226 (defvar YaTeX:documentclasses-local nil | |
1227 "*User defined local documentclass alist") | |
1228 (defvar YaTeX-default-documentclass (if YaTeX-japan "jarticle" "article") | |
1229 "*Default documentclass") | |
1230 | |
1231 (defun YaTeX::documentclass (&optional argp) | |
1232 (cond | |
1233 ((equal argp 1) | |
72 | 1234 (setq YaTeX-env-name "document") |
57 | 1235 (let ((sname |
1236 (YaTeX-cplread-with-learning | |
1237 (format "Documentclass (default %s): " YaTeX-default-documentclass) | |
1238 'YaTeX:documentclasses-default | |
1239 'YaTeX:documentclasses-private | |
1240 'YaTeX:documentclasses-local))) | |
1241 (if (string= "" sname) (setq sname YaTeX-default-documentclass)) | |
1242 (setq YaTeX-default-documentclass sname))))) | |
1243 | |
70 | 1244 (defvar YaTeX:latex2e-named-color-alist |
1245 '(("GreenYellow") ("Yellow") ("Goldenrod") ("Dandelion") ("Apricot") | |
1246 ("Peach") ("Melon") ("YellowOrange") ("Orange") ("BurntOrange") | |
1247 ("Bittersweet") ("RedOrange") ("Mahogany") ("Maroon") ("BrickRed") | |
1248 ("Red") ("OrangeRed") ("RubineRed") ("WildStrawberry") ("Salmon") | |
1249 ("CarnationPink") ("Magenta") ("VioletRed") ("Rhodamine") ("Mulberry") | |
1250 ("RedViolet") ("Fuchsia") ("Lavender") ("Thistle") ("Orchid")("DarkOrchid") | |
1251 ("Purple") ("Plum") ("Violet") ("RoyalPurple") ("BlueViolet") | |
1252 ("Periwinkle") ("CadetBlue") ("CornflowerBlue") ("MidnightBlue") | |
1253 ("NavyBlue") ("RoyalBlue") ("Blue") ("Cerulean") ("Cyan") ("ProcessBlue") | |
1254 ("SkyBlue") ("Turquoise") ("TealBlue") ("Aquamarine") ("BlueGreen") | |
1255 ("Emerald") ("JungleGreen") ("SeaGreen") ("Green") ("ForestGreen") | |
1256 ("PineGreen") ("LimeGreen") ("YellowGreen") ("SpringGreen") ("OliveGreen") | |
1257 ("RawSienna") ("Sepia") ("Brown") ("Tan") ("Gray") ("Black") ("White")) | |
1258 "Colors defined in $TEXMF/tex/plain/colordvi.tex") | |
1259 | |
1260 (defvar YaTeX:latex2e-basic-color-alist | |
1261 '(("black") ("white") ("red") ("blue") ("yellow") ("green") ("cyan") | |
1262 ("magenta")) | |
1263 "Basic colors") | |
1264 | |
1265 (defun YaTeX:textcolor () | |
1266 "Add-in for \\color's option" | |
1267 (if (y-or-n-p "Use `named' color? ") | |
1268 "[named]")) | |
1269 | |
1270 (defun YaTeX::color-completing-read (prompt) | |
1271 (let ((completion-ignore-case t) | |
1272 (namedp (save-excursion | |
1273 (skip-chars-backward "^\n\\[\\\\") | |
1274 (looking-at "named")))) | |
1275 (completing-read | |
1276 prompt | |
1277 (if namedp | |
1278 YaTeX:latex2e-named-color-alist | |
1279 YaTeX:latex2e-basic-color-alist) | |
1280 nil t))) | |
1281 | |
1282 (defun YaTeX::textcolor (argp) | |
1283 "Add-in for \\color's argument" | |
1284 (cond | |
1285 ((= argp 1) (YaTeX::color-completing-read "Color: ")) | |
1286 ((= argp 2) (read-string "Colored string: ")))) | |
1287 | |
1288 (fset 'YaTeX:color 'YaTeX:textcolor) | |
1289 (fset 'YaTeX::color 'YaTeX::textcolor) | |
1290 (fset 'YaTeX:colorbox 'YaTeX:textcolor) | |
1291 (fset 'YaTeX::colorbox 'YaTeX::textcolor) | |
1292 (fset 'YaTeX:fcolorbox 'YaTeX:textcolor) | |
1293 | |
1294 (defun YaTeX::fcolorbox (argp) | |
1295 (cond | |
1296 ((= argp 1) (YaTeX::color-completing-read "Frame color: ")) | |
1297 ((= argp 2) (YaTeX::color-completing-read "Inner color: ")) | |
1298 ((= argp 3) (read-string "Colored string: ")))) | |
1299 | |
1300 (defun YaTeX:scalebox () | |
1301 "Add-in for \\rotatebox" | |
1302 (let ((vmag (read-string (if YaTeX-japan "{: " "Magnification: "))) | |
1303 (hmag (read-string (if YaTeX-japan "{(ȗ): " | |
1304 "Horizontal magnification(Optional): ")))) | |
1305 (if (and hmag (string< "" hmag)) | |
1306 (format "{%s}[%s]" vmag hmag) | |
1307 (format "{%s}" vmag)))) | |
1308 | |
73 | 1309 (defun YaTeX:includegraphics () |
1310 "Add-in for \\includegraphics's option" | |
1311 (let (width height (scale "") angle str) | |
1312 (setq width (read-string "Width: ") | |
1313 height (read-string "Height: ")) | |
1314 (or (string< width "") (string< "" height) | |
1315 (setq scale (read-string "Scale: "))) | |
1316 (setq angle (read-string "Angle(0-359): ")) | |
1317 (setq str | |
1318 (mapconcat | |
1319 'concat | |
1320 (delq nil | |
1321 (mapcar '(lambda (s) | |
1322 (and (stringp (symbol-value s)) | |
1323 (string< "" (symbol-value s)) | |
1324 (format "%s=%s" s (symbol-value s)))) | |
1325 '(width height scale angle))) | |
1326 ",")) | |
1327 (if (string= "" str) "" | |
1328 (concat "[" str "]")))) | |
1329 | |
70 | 1330 (defun YaTeX::includegraphics (argp) |
1331 "Add-in for \\includegraphics" | |
1332 (cond | |
1333 ((= argp 1) | |
1334 (read-file-name "EPS File: " "")))) | |
1335 | |
68 | 1336 (defun YaTeX:caption () |
72 | 1337 (setq YaTeX-section-name "label") |
68 | 1338 nil) |
1339 | |
1340 ;;; -------------------- math-mode stuff -------------------- | |
1341 (defun YaTeX::tilde (&optional pos) | |
1342 "For accent macros in mathmode" | |
1343 (cond | |
1344 ((equal pos 1) | |
1345 (message "Put accent on variable: ") | |
1346 (let ((v (char-to-string (read-char))) (case-fold-search nil)) | |
1347 (message "") | |
1348 (cond | |
1349 ((string-match "i\\|j" v) | |
1350 (concat "\\" v "math")) | |
1351 ((string-match "[\r\n\t ]" v) | |
1352 "") | |
1353 (t v)))) | |
1354 (nil ""))) | |
1355 | |
1356 (fset 'YaTeX::hat 'YaTeX::tilde) | |
1357 (fset 'YaTeX::check 'YaTeX::tilde) | |
1358 (fset 'YaTeX::bar 'YaTeX::tilde) | |
1359 (fset 'YaTeX::dot 'YaTeX::tilde) | |
1360 (fset 'YaTeX::ddot 'YaTeX::tilde) | |
1361 (fset 'YaTeX::vec 'YaTeX::tilde) | |
1362 | |
1363 (defun YaTeX::widetilde (&optional pos) | |
1364 "For multichar accent macros in mathmode" | |
1365 (cond | |
1366 ((equal pos 1) | |
1367 (let ((m "Put over chars[%s ]: ") v v2) | |
1368 (message m " ") | |
1369 (setq v (char-to-string (read-char))) | |
1370 (message "") | |
1371 (if (string-match "[\r\n\t ]" v) | |
1372 "" | |
1373 (message m v) | |
1374 (setq v2 (char-to-string (read-char))) | |
1375 (message "") | |
1376 (if (string-match "[\r\n\t ]" v2) | |
1377 v | |
1378 (concat v v2))))) | |
1379 (nil ""))) | |
1380 | |
1381 (fset 'YaTeX::widehat 'YaTeX::widetilde) | |
1382 (fset 'YaTeX::overline 'YaTeX::widetilde) | |
1383 (fset 'YaTeX::overrightarrow 'YaTeX::widetilde) | |
1384 | |
1385 | |
1386 ;;; | |
1387 ;; Add-in functions for large-type command. | |
1388 ;;; | |
1389 (defun YaTeX:em () | |
1390 (cond | |
1391 ((eq YaTeX-current-completion-type 'large) "\\/") | |
1392 (t nil))) | |
1393 (fset 'YaTeX:it 'YaTeX:em) | |
1394 | |
23 | 1395 ;;; -------------------- End of yatexadd -------------------- |
1396 (provide 'yatexadd) | |
72 | 1397 ; Local variables: |
1398 ; fill-prefix: ";;; " | |
1399 ; paragraph-start: "^$\\|\\|;;;$" | |
1400 ; paragraph-separate: "^$\\|\\|;;;$" | |
1401 ; buffer-file-coding-system: sjis | |
1402 ; End: |