annotate yatexadd.el @ 59:48ac97a6b6ce

Call drawing tools ID completion (yahtml)
author yuuji
date Wed, 01 May 1996 15:35:40 +0000
parents 3a7c0c2bf16d
children 9e08ed569d80
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
1 ;;; -*- Emacs-Lisp -*-
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
2 ;;; YaTeX add-in functions.
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
3 ;;; yatexadd.el rev.13
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
4 ;;; (c )1991-1995 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
5 ;;; Last modified Sat Apr 27 21:38:36 1996 on NSR
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
6 ;;; $Id$
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
7
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
8 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
9 ;;Sample functions for LaTeX environment.
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
10 ;;;
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
11 (defvar YaTeX:tabular-default-rule
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
12 "@{\\vrule width 1pt\\ }c|c|c@{\\ \\vrule width 1pt}"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
13 "*Your favorite default rule format."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
14 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
15 (defvar YaTeX:tabular-thick-vrule "\\vrule width %s"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
16 "*Vertical thick line format (without @{}). %s'll be replaced by its width."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
17 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
18 (defvar YaTeX:tabular-thick-hrule "\\noalign{\\hrule height %s}"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
19 "*Horizontal thick line format. %s will be replaced by its width."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
20 )
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
21 (defun YaTeX:tabular ()
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
22 "YaTeX add-in function for tabular environment.
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
23 Notice that this function refers the let-variable `env' in
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
24 YaTeX-make-begin-end."
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
25 (let ((width "") bars (rule "") (and "") (j 1) loc ans (hline "\\hline"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
26 (if (string= env "tabular*")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
27 (setq width (concat "{" (read-string "Width: ") "}")))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
28 (setq loc (YaTeX:read-position "tb")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
29 bars (string-to-int
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
30 (read-string "Number of columns(0 for default format): " "3")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
31 (if (<= bars 0)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
32 (setq ;if 0, simple format
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
33 rule YaTeX:tabular-default-rule
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
34 and "& &")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
35 (while (< j bars) ;repeat bars-1 times
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
36 (setq rule (concat rule "c|")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
37 and (concat and "& ")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
38 j (1+ j)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
39 (setq rule (concat rule "c"))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
40 (message "(N)ormal-frame or (T)hick frame? [nt]")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
41 (setq ans (read-char))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
42 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
43 ((or (equal ans ?t) (equal ans ?T))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
44 (setq ans (read-string "Rule width: " "1pt")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
45 rule (concat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
46 "@{" (format YaTeX:tabular-thick-vrule ans) "}"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
47 rule
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
48 "@{\\ " (format YaTeX:tabular-thick-vrule ans) "}")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
49 hline (format YaTeX:tabular-thick-hrule ans)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
50 (t (setq rule (concat "|" rule "|")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
51 hline "\\hline"))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
52
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
53 (setq rule (read-string "rule format: " rule))
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
54 (setq single-command "hline")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
55
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
56 (format "%s%s{%s}" width loc rule))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
57 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
58 (fset 'YaTeX:tabular* 'YaTeX:tabular)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
59 (defun YaTeX:array ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
60 (concat (YaTeX:read-position "tb")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
61 "{" (read-string "Column format: ") "}")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
62 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
63
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
64 (defun YaTeX:read-oneof (oneof)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
65 (let ((pos "") loc (guide ""))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
66 (and (boundp 'name) name (setq guide (format "%s " name)))
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
67 (while (not (string-match
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
68 (setq loc (read-key-sequence
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
69 (format "%s position (`%s') [%s]: "
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
70 guide oneof pos)));name is in YaTeX-addin
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
71 "\r\^g\n"))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
72 (cond
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
73 ((string-match loc oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
74 (if (not (string-match loc pos))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
75 (setq pos (concat pos loc))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
76 ((and (string-match loc "\C-h\C-?") (> (length pos) 0))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
77 (setq pos (substring pos 0 (1- (length pos)))))
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
78 (t
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
79 (ding)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
80 (message "Please input one of `%s'." oneof)
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
81 (sit-for 3))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
82 (message "")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
83 pos)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
84 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
85
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
86 (defun YaTeX:read-position (oneof)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
87 "Read a LaTeX (optional) position format such as `[htbp]'."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
88 (let ((pos (YaTeX:read-oneof oneof)))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
89 (if (string= pos "") "" (concat "[" pos "]")))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
90 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
91
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
92 (defun YaTeX:table ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
93 "YaTeX add-in function for table environment."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
94 (YaTeX:read-position "htbp")
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
95 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
96
46
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
97 (fset 'YaTeX:figure 'YaTeX:table)
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
98 (fset 'YaTeX:figure* 'YaTeX:table)
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
99
cd1b63102eed Support Mule2
yuuji
parents: 43
diff changeset
100
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
101 (defun YaTeX:description ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
102 "Truly poor service:-)"
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
103 (setq single-command "item[]")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
104 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
105 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
106
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
107 (defun YaTeX:itemize ()
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
108 "It's also poor service."
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
109 (setq single-command "item")
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
110 ""
6
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
111 )
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
112
49be9ccb0b65 Temporary dictionary.
yuuji
parents:
diff changeset
113 (fset 'YaTeX:enumerate 'YaTeX:itemize)
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
114
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
115 (defun YaTeX:picture ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
116 "Ask the size of coordinates of picture environment."
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
117 (concat (YaTeX:read-coordinates "Picture size")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
118 (YaTeX:read-coordinates "Initial position"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
119 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
120
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
121 (defun YaTeX:equation ()
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
122 (YaTeX-jmode-off)
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
123 (if (fboundp 'YaTeX-toggle-math-mode)
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
124 (YaTeX-toggle-math-mode t)) ;force math-mode ON.
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
125 )
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
126 (mapcar '(lambda (f) (fset f 'YaTeX:equation))
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
127 '(YaTeX:eqnarray YaTeX:eqnarray* YaTeX:align YaTeX:align*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
128 YaTeX:split YaTeX:multline YaTeX:multline* YaTeX:gather YaTeX:gather*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
129 YaTeX:aligned* YaTeX:gathered YaTeX:gathered*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
130 YaTeX:alignat YaTeX:alignat* YaTeX:xalignat YaTeX:xalignat*
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
131 YaTeX:xxalignat YaTeX:xxalignat*))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
132
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
133 (defun YaTeX:list ()
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
134 "%\n{} %default label\n{} %formatting parameter"
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
135 )
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
136
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
137 (defun YaTeX:minipage ()
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
138 (concat (YaTeX:read-position "cbt")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
139 "{" (read-string "Width: ") "}")
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
140 )
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
141
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
142 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
143 ;;Sample functions for section-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
144 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
145 (defun YaTeX:multiput ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
146 (concat (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
147 (YaTeX:read-coordinates "Step")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
148 "{" (read-string "How many times: ") "}")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
149 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
150
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
151 (defun YaTeX:put ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
152 (YaTeX:read-coordinates "Pos")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
153 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
154
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
155 (defun YaTeX:makebox ()
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
156 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
157 ((YaTeX-in-environment-p "picture")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
158 (concat (YaTeX:read-coordinates "Dimension")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
159 (YaTeX:read-position "lrtb")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
160 (t
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
161 (let ((width (read-string "Width: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
162 (if (string< "" width)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
163 (progn
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
164 (or (equal (aref width 0) ?\[)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
165 (setq width (concat "[" width "]")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
166 (concat width (YaTeX:read-position "lr")))))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
167 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
168
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
169 (defun YaTeX:framebox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
170 (if (YaTeX-quick-in-environment-p "picture")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
171 (YaTeX:makebox))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
172 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
173
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
174 (defun YaTeX:dashbox ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
175 (concat "{" (read-string "Dash dimension: ") "}"
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
176 (YaTeX:read-coordinates "Dimension"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
177 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
178
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
179 (defvar YaTeX-minibuffer-quick-map nil)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
180 (if YaTeX-minibuffer-quick-map nil
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
181 (setq YaTeX-minibuffer-quick-map
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
182 (copy-keymap minibuffer-local-completion-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
183 (let ((ch (1+ ? )))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
184 (while (< ch 127)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
185 (define-key YaTeX-minibuffer-quick-map (char-to-string ch)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
186 'YaTeX-minibuffer-quick-complete)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
187 (setq ch (1+ ch)))))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
188
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
189 (defvar YaTeX:left-right-delimiters
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
190 '(("(" . ")") (")" . "(") ("[" . "]") ("]" . "[")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
191 ("\\{" . "\\}") ("\\}" . "\\{") ("|") ("\\|")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
192 ("\\lfloor" . "\\rfloor") ("\\lceil" . "\\rceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
193 ("\\langle" . "\\rangle") ("/") (".")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
194 ("\\rfloor" . "\\rfloor") ("\\rceil" . "\\lceil")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
195 ("\\rangle" . "\\langle") ("\\backslash")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
196 ("\\uparrow") ("\\downarrow") ("\\updownarrow") ("\\Updownarrow"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
197 "TeX math delimiter, which can be completed after \\right or \\left.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
198
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
199 (defvar YaTeX:left-right-default nil "Default string of YaTeX:right.")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
200
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
201 (defun YaTeX:left ()
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
202 (let ((minibuffer-completion-table YaTeX:left-right-delimiters)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
203 delimiter (leftp (string= single-command "left")))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
204 (setq delimiter
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
205 (read-from-minibuffer
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
206 (format "Delimiter%s: "
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
207 (if YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
208 (format "(default=`%s')" YaTeX:left-right-default)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
209 "(SPC for menu)"))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
210 nil YaTeX-minibuffer-quick-map))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
211 (if (string= "" delimiter) (setq delimiter YaTeX:left-right-default))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
212 (setq single-command (if leftp "right" "left")
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
213 YaTeX:left-right-default
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
214 (or (cdr (assoc delimiter YaTeX:left-right-delimiters)) delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
215 delimiter))
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
216
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
217 (fset 'YaTeX:right 'YaTeX:left)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
218
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
219
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
220 (defun YaTeX:read-coordinates (&optional mes varX varY)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
221 (concat
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
222 "("
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
223 (read-string (format "%s %s: " (or mes "Dimension") (or varX "X")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
224 ","
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
225 (read-string (format "%s %s: " (or mes "Dimension") (or varY "Y")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
226 ")")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
227 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
228
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
229 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
230 ;;Sample functions for maketitle-type command.
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
231 ;;;
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
232 (defun YaTeX:sum ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
233 "Read range of summation."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
234 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
235 (concat (YaTeX:read-boundary "_") (YaTeX:read-boundary "^"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
236 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
237
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
238 (fset 'YaTeX:int 'YaTeX:sum)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
239
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
240 (defun YaTeX:lim ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
241 "Insert limit notation of \\lim."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
242 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
243 (let ((var (read-string "Variable: ")) limit)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
244 (if (string= "" var) ""
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
245 (setq limit (read-string "Limit ($ means infinity): "))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
246 (if (string= "$" limit) (setq limit "\\infty"))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
247 (concat "_{" var " \\rightarrow " limit "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
248 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
249
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
250 (defun YaTeX:gcd ()
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
251 "Add-in function for \\gcd(m,n)."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
252 (YaTeX:check-completion-type 'maketitle)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
253 (YaTeX:read-coordinates "\\gcd" "(?,)" "(,?)")
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
254 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
255
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
256 (defun YaTeX:read-boundary (ULchar)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
257 "Read boundary usage by _ or ^. _ or ^ is indicated by argument ULchar."
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
258 (let ((bndry (read-string (concat ULchar "{???} ($ for infinity): "))))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
259 (if (string= bndry "") ""
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
260 (if (string= bndry "$") (setq bndry "\\infty"))
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
261 (concat ULchar "{" bndry "}")))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
262 )
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
263
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
264 (defun YaTeX:verb ()
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
265 "Enclose \\verb's contents with the same characters."
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
266 (let ((quote-char (read-string "Quoting char: " "|"))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
267 (contents (read-string "Quoted contents: ")))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
268 (concat quote-char contents quote-char))
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
269 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
270 (fset 'YaTeX:verb* 'YaTeX:verb)
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
271
43
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
272 (defun YaTeX:footnotemark ()
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
273 (setq section-name "footnotetext")
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
274 nil
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
275 )
ef686a35472d Change the default section-type command to footnotetext after
yuuji
parents: 23
diff changeset
276
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
277 (defun YaTeX:cite ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
278 (let ((comment (read-string "Comment for citation: ")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
279 (if (string= comment "") ""
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
280 (concat "[" comment "]")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
281 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
282
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
283 (defun YaTeX:bibitem ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
284 (let ((label (read-string "Citation label: ")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
285 (if (string= label "") ""
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
286 (concat "[" label "]")))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
287 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
288
53
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
289 (defun YaTeX:item ()
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
290 (YaTeX-indent-line)
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
291 (setq section-name "label")
5f4b18da14b3 Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents: 52
diff changeset
292 " ")
52
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
293 (fset 'YaTeX:item\[\] 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
294 (fset 'YaTeX:subitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
295 (fset 'YaTeX:subsubitem 'YaTeX:item)
5d94deabb9f9 Set YaTeX-indent-line to 'indent-line-function.
yuuji
parents: 51
diff changeset
296
58
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
297 (defun YaTeX:linebreak ()
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
298 (let (obl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
299 (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
300 (setq obl (char-to-string (read-char)))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
301 (if (string-match "[0-4]" obl)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
302 (concat "[" obl "]")
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
303 ""))
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
304 )
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
305 (fset 'YaTeX:pagebreak 'YaTeX:linebreak)
3a7c0c2bf16d Official support for AMS-LaTeX, HTML, xdvi -remote, Netscape
yuuji
parents: 57
diff changeset
306
14
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
307 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
308 ;;Subroutine
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
309 ;;;
b7b023a74293 Region-based section-type completion.
yuuji
parents: 13
diff changeset
310
8
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
311 (defun YaTeX:check-completion-type (type)
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
312 "Check valid completion type."
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
313 (if (not (eq type YaTeX-current-completion-type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
314 (error "This should be completed with %s-type completion." type))
c746646cecf5 Restrict YaTeX:framebox in picture environment.
yuuji
parents: 6
diff changeset
315 )
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
316
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
317
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
318 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
319 ;;; [[Add-in functions for reading section arguments]]
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
320 ;;;
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
321 ;; All of add-in functions for reading sections arguments should
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
322 ;; take an argument ARGP that specify the argument position.
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
323 ;; If argument position is out of range, nil should be returned,
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
324 ;; else nil should NOT be returned.
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
325
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
326 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
327 ; Label selection
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
328 ;;
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
329 (defvar YaTeX-label-menu-other
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
330 (if YaTeX-japan "':‘¼‚̃oƒbƒtƒ@‚̃‰ƒxƒ‹\n" "':LABEL IN OTHER BUFFER.\n"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
331 (defvar YaTeX-label-menu-repeat
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
332 (if YaTeX-japan ".:’¼‘O‚Ì\\ref‚Æ“¯‚¶\n" "/:REPEAT LAST \ref{}\n"))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
333 (defvar YaTeX-label-menu-any
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
334 (if YaTeX-japan "*:”CˆÓ‚Ì•¶Žš—ñ\n" "*:ANY STRING.\n"))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
335 (defvar YaTeX-label-buffer "*Label completions*")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
336 (defvar YaTeX-label-guide-msg "Select label and hit RETURN.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
337 (defvar YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
338 "Key map used in label selection buffer.")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
339 (defun YaTeX::label-setup-key-map ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
340 (if YaTeX-label-select-map nil
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
341 (message "Setting up label selection mode map...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
342 (setq YaTeX-label-select-map (copy-keymap global-map))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
343 (suppress-keymap YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
344 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
345 'previous-line 'YaTeX::label-previous YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
346 (substitute-all-key-definition
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
347 'next-line 'YaTeX::label-next YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
348 (define-key YaTeX-label-select-map "\C-n" 'YaTeX::label-next)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
349 (define-key YaTeX-label-select-map "\C-p" 'YaTeX::label-previous)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
350 (define-key YaTeX-label-select-map "<" 'beginning-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
351 (define-key YaTeX-label-select-map ">" 'end-of-buffer)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
352 (define-key YaTeX-label-select-map "\C-m" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
353 (define-key YaTeX-label-select-map "\C-j" 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
354 (define-key YaTeX-label-select-map " " 'exit-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
355 (define-key YaTeX-label-select-map "\C-g" 'abort-recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
356 (define-key YaTeX-label-select-map "/" 'isearch-forward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
357 (define-key YaTeX-label-select-map "?" 'isearch-backward)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
358 (define-key YaTeX-label-select-map "'" 'YaTeX::label-search-tag)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
359 (define-key YaTeX-label-select-map "." 'YaTeX::label-search-tag)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
360 (define-key YaTeX-label-select-map "*" 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
361 (message "Setting up label selection mode map...Done")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
362 (let ((key ?A))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
363 (while (<= key ?Z)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
364 (define-key YaTeX-label-select-map (char-to-string key)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
365 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
366 (define-key YaTeX-label-select-map (char-to-string (+ key (- ?a ?A)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
367 'YaTeX::label-search-tag)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
368 (setq key (1+ key)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
369 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
370 (defun YaTeX::label-next ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
371 (interactive) (forward-line 1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
372 (defun YaTeX::label-previous ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
373 (interactive) (forward-line -1) (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
374 (defun YaTeX::label-search-tag ()
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
375 (interactive)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
376 (let ((case-fold-search t) (tag (regexp-quote (this-command-keys))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
377 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
378 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
379 (forward-char 1)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
380 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
381 (goto-char (match-beginning 0)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
382 ((save-excursion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
383 (goto-char (point-min))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
384 (re-search-forward (concat "^" tag) nil t))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
385 (goto-char (match-beginning 0))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
386 (message YaTeX-label-guide-msg))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
387 )
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
388 (defun YaTeX::ref (argp &optional labelcmd refcmd)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
389 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
390 ((= argp 1)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
391 (save-excursion
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
392 (let ((lnum 0) e0 label label-list (buf (current-buffer))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
393 (labelcmd (or labelcmd "label")) (refcmd (or refcmd "ref"))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
394 (p (point)) initl line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
395 (goto-char (point-min))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
396 (message "Collecting labels...")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
397 (save-window-excursion
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
398 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
399 YaTeX-label-buffer (function (lambda (x) (window-width x))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
400 (with-output-to-temp-buffer YaTeX-label-buffer
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
401 (while (YaTeX-re-search-active-forward
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
402 (concat "\\\\" labelcmd "\\b")
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
403 (regexp-quote YaTeX-comment-prefix) nil t)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
404 (goto-char (match-beginning 0))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
405 (skip-chars-forward "^{")
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
406 (setq label
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
407 (buffer-substring
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
408 (1+ (point))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
409 (prog2 (forward-list 1) (setq e0 (1- (point)))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
410 label-list (cons label label-list))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
411 (or initl
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
412 (if (< p (point)) (setq initl lnum)))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
413 (beginning-of-line)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
414 (skip-chars-forward " \t\n" nil)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
415 (princ (format "%c:{%s}\t<<%s>>\n" (+ (% lnum 26) ?A) label
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
416 (buffer-substring (point) (point-end-of-line))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
417 (setq lnum (1+ lnum))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
418 (message "Collecting \\%s{}... %d" labelcmd lnum)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
419 (goto-char e0))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
420 (princ YaTeX-label-menu-other)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
421 (princ YaTeX-label-menu-repeat)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
422 (princ YaTeX-label-menu-any)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
423 );with
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
424 (goto-char p)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
425 (message "Collecting %s...Done" labelcmd)
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
426 (YaTeX-showup-buffer YaTeX-label-buffer nil t)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
427 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
428 (setq truncate-lines t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
429 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
430 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
431 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
432 (goto-line (or initl lnum)) ;goto recently defined label line
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
433 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
434 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
435 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
436 (set-buffer (get-buffer YaTeX-label-buffer)) ;assertion
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
437 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
438 (setq line (count-lines (point-min)(point)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
439 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
440 ((= line lnum) (setq label (YaTeX-label-other)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
441 ((= line (1+ lnum))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
442 (save-excursion
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
443 (switch-to-buffer buf)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
444 (goto-char p)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
445 (if (re-search-backward
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
446 (concat "\\\\" refcmd "{\\([^}]+\\)}") nil t)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
447 (setq label (YaTeX-match-string 1))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
448 (setq label ""))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
449 ((>= line (+ lnum 2))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
450 (setq label (read-string (format "\\%s{???}: " refcmd))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
451 (t (setq label (nth (- lnum line 1) label-list)))))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
452 (bury-buffer YaTeX-label-buffer)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
453 label
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
454 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
455 ))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
456 )
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
457 (fset 'YaTeX::pageref 'YaTeX::ref)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
458 (defun YaTeX::cite (argp)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
459 (cond
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
460 ((eq argp 1)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
461 (YaTeX::ref argp "bibitem\\(\\[.*\\]\\)?" "cite"))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
462 (t nil)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
463
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
464 (defun YaTeX-yatex-buffer-list ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
465 (save-excursion
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
466 (delq nil (mapcar (function (lambda (buf)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
467 (set-buffer buf)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
468 (if (eq major-mode 'yatex-mode) buf)))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
469 (buffer-list))))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
470 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
471
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
472 (defun YaTeX-select-other-yatex-buffer ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
473 "Select buffer from all yatex-mode's buffers interactivelly."
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
474 (interactive)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
475 (let ((lbuf "*YaTeX mode buffers*") (blist (YaTeX-yatex-buffer-list))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
476 (lnum -1) buf rv
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
477 (ff "**find-file**"))
12
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
478 (YaTeX-showup-buffer
a7f397790cdc Revise YaTeX-typeset faster.
yuuji
parents: 11
diff changeset
479 lbuf (function (lambda (x) 1))) ;;Select next window surely.
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
480 (with-output-to-temp-buffer lbuf
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
481 (while blist
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
482 (princ
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
483 (format "%c:{%s}\n" (+ (% (setq lnum (1+ lnum)) 26) ?A)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
484 (buffer-name (car blist))))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
485 (setq blist (cdr blist)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
486 (princ (format "':{%s}" ff)))
59
48ac97a6b6ce Call drawing tools
yuuji
parents: 58
diff changeset
487 (YaTeX-showup-buffer lbuf nil t)
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
488 (YaTeX::label-setup-key-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
489 (setq buffer-read-only t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
490 (use-local-map YaTeX-label-select-map)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
491 (message YaTeX-label-guide-msg)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
492 (unwind-protect
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
493 (progn
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
494 (recursive-edit)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
495 (set-buffer lbuf)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
496 (beginning-of-line)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
497 (setq rv
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
498 (if (re-search-forward "{\\([^\\}]+\\)}" (point-end-of-line) t)
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
499 (buffer-substring (match-beginning 1) (match-end 1)) nil)))
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
500 (kill-buffer lbuf))
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
501 (if (string= rv ff)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
502 (progn
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
503 (call-interactively 'find-file)
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
504 (current-buffer))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
505 rv))
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
506 )
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
507
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
508 (defun YaTeX-label-other ()
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
509 (let ((rv (YaTeX-select-other-yatex-buffer)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
510 (cond
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
511 ((null rv) "")
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
512 (t
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
513 (set-buffer rv)
48
a0640ff3f72f Inter-file ref/label, cite/bibitem jump.
yuuji
parents: 46
diff changeset
514 (YaTeX::ref argp labelcmd refcmd)))
11
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
515 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
516 )
390df0e505da Label completion works.
yuuji
parents: 8
diff changeset
517
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
518 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
519 ; completion for the arguments of \newcommand
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
520 ;;
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
521 (defun YaTeX::newcommand (&optional argp)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
522 (cond
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
523 ((= argp 1)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
524 (let ((command (read-string "Define newcommand: " "\\")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
525 (put 'YaTeX::newcommand 'command (substring command 1))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
526 command))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
527 ((= argp 2)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
528 (let ((argc
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
529 (string-to-int (read-string "Number of arguments(Default 0): ")))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
530 (def (read-string "Definition: "))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
531 (command (get 'YaTeX::newcommand 'command)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
532 ;;!!! It's illegal to insert string in the add-in function !!!
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
533 (if (> argc 0) (insert (format "[%d]" argc)))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
534 (if (and (stringp command)
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
535 (string< "" command)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
536 (y-or-n-p "Update dictionary?"))
18
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
537 (cond
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
538 ((= argc 0)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
539 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
540 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
541 'singlecmd-table 'user-singlecmd-table 'tmp-singlecmd-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
542 ((= argc 1)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
543 (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
544 (list command)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
545 'section-table 'user-section-table 'tmp-section-table))
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
546 (t (YaTeX-update-table
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
547 (list command argc)
adc2f1472409 Make variables for temporary dictionary buffer-local.
yuuji
parents: 16
diff changeset
548 'section-table 'user-section-table 'tmp-section-table))))
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
549 (message "")
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
550 def ;return command name
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
551 ))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
552 (t ""))
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
553 )
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
554
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
555 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
556 ; completion for the arguments of \pagestyle
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
557 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
558 (defun YaTeX::pagestyle (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
559 "Read the pagestyle with completion."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
560 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
561 "Page style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
562 '(("plain") ("empty") ("headings") ("myheadings") ("normal") nil))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
563 )
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
564 (fset 'YaTeX::thispagestyle 'YaTeX::pagestyle)
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
565
16
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
566 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
567 ; completion for the arguments of \pagenumbering
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
568 ;;
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
569 (defun YaTeX::pagenumbering (&optional argp)
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
570 "Read the numbering style."
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
571 (completing-read
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
572 "Page numbering style: "
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
573 '(("arabic") ("Alpha") ("alpha") ("Roman") ("roman")))
cb9afa9c1213 Auto-indentation at begin-type completion works correctly.
yuuji
parents: 14
diff changeset
574 )
13
eafae54794a0 Show message at comment-region on begin/end mode.
yuuji
parents: 12
diff changeset
575
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
576 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
577 ; Length
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
578 ;;
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
579 (defvar YaTeX:style-parameters-default
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
580 '(("\\arraycolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
581 ("\\arrayrulewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
582 ("\\baselineskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
583 ("\\columnsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
584 ("\\columnseprule")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
585 ("\\doublerulesep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
586 ("\\evensidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
587 ("\\footheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
588 ("\\footskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
589 ("\\headheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
590 ("\\headsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
591 ("\\itemindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
592 ("\\itemsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
593 ("\\labelsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
594 ("\\labelwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
595 ("\\leftmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
596 ("\\linewidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
597 ("\\listparindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
598 ("\\marginparsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
599 ("\\marginparwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
600 ("\\mathindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
601 ("\\oddsidemargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
602 ("\\parindent")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
603 ("\\parsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
604 ("\\parskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
605 ("\\partopsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
606 ("\\rightmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
607 ("\\tabcolsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
608 ("\\textheight")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
609 ("\\textwidth")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
610 ("\\topmargin")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
611 ("\\topsep")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
612 ("\\topskip")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
613 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
614 "Alist of LaTeX style parameters.")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
615 (defvar YaTeX:style-parameters-private nil
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
616 "*User definable alist of style parameters.")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
617 (defvar YaTeX:style-parameters-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
618 "*User definable alist of local style parameters.")
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
619
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
620 (defvar YaTeX:length-history nil "Holds history of length.")
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
621 (put 'YaTeX:length-history 'no-default t)
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
622 (defun YaTeX::setlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
623 "YaTeX add-in function for arguments of \\setlength."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
624 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
625 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
626 ;;(completing-read "Length variable: " YaTeX:style-parameters nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
627 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
628 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
629 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
630 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
631 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
632 nil nil "\\")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
633 )
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
634 ((equal 2 argp)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
635 (read-string-with-history "Length: " nil 'YaTeX:length-history)))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
636 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
637 (fset 'YaTeX::addtolength 'YaTeX::setlength)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
638
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
639 (defun YaTeX::settowidth (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
640 "YaTeX add-in function for arguments of \\settowidth."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
641 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
642 ((equal 1 argp)
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
643 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
644 "Length variable: "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
645 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
646 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
647 'YaTeX:style-parameters-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
648 nil nil "\\"))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
649 ((equal 2 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
650 (read-string "Text: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
651 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
652 (defun YaTeX::newlength (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
653 "YaTeX add-in function for arguments of \\newlength"
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
654 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
655 ((equal argp 1)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
656 (let ((length (read-string "Length variable: " "\\")))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
657 (if (string< "" length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
658 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
659 (list length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
660 'YaTeX:style-parameters-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
661 'YaTeX:style-parameters-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
662 'YaTeX:style-parameters-local))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
663 length)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
664 ))
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
665 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
666
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
667 ;; \multicolumn's arguments
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
668 (defun YaTeX::multicolumn (&optional argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
669 "YaTeX add-in function for arguments of \\multicolumn."
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
670 (cond
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
671 ((equal 1 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
672 (read-string "Number of columns: "))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
673 ((equal 2 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
674 (let (c)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
675 (while (not (string-match
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
676 (progn (message "Format(one of l,r,c): ")
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
677 (setq c (char-to-string (read-char))))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
678 "lrc")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
679 c))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
680 ((equal 3 argp)
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
681 (read-string "Item: ")))
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
682 )
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
683
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
684 (defvar YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
685 '(("article") ("jarticle") ("j-article")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
686 ("book") ("jbook") ("j-book")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
687 ("report") ("jreport") ("j-report")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
688 ("letter") ("ascjletter"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
689 "List of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
690 (defvar YaTeX:documentstyles-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
691 "*User defined list of LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
692 (defvar YaTeX:documentstyles-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
693 "*User defined list of local LaTeX documentstyles.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
694 (defvar YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
695 '(("a4j") ("a5j") ("b4j") ("b5j")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
696 ("twocolumn") ("jtwocolumn") ("epsf") ("epsfig") ("epsbox") ("nfig"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
697 "List of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
698 (defvar YaTeX:documentstyle-options-private nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
699 "*User defined list of LaTeX documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
700 (defvar YaTeX:documentstyle-options-local nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
701 "List of LaTeX local documentstyle options.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
702
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
703 (defvar YaTeX-minibuffer-completion-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
704 "Minibuffer completion key map that allows comma completion.")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
705 (if YaTeX-minibuffer-completion-map nil
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
706 (setq YaTeX-minibuffer-completion-map
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
707 (copy-keymap minibuffer-local-completion-map))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
708 (define-key YaTeX-minibuffer-completion-map " "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
709 'YaTeX-minibuffer-complete)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
710 (define-key YaTeX-minibuffer-completion-map "\t"
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
711 'YaTeX-minibuffer-complete))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
712
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
713 (defun YaTeX:documentstyle ()
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
714 (let*((delim ",")
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
715 (dt (append YaTeX:documentstyle-options-local
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
716 YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
717 YaTeX:documentstyle-options-default))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
718 (minibuffer-completion-table dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
719 (opt (read-from-minibuffer
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
720 "Style options ([opt1,opt2,...]): "
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
721 nil YaTeX-minibuffer-completion-map nil))
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
722 (substr opt) o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
723 (if (string< "" opt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
724 (progn
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
725 (while substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
726 (setq o (substring substr 0 (string-match delim substr)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
727 (or (assoc o dt)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
728 (YaTeX-update-table
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
729 (list o)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
730 'YaTeX:documentstyle-options-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
731 'YaTeX:documentstyle-options-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
732 'YaTeX:documentstyle-options-local))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
733 (setq substr
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
734 (if (string-match delim substr)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
735 (substring substr (1+ (string-match delim substr))))))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
736 (concat "[" opt "]"))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
737 "")))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
738
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
739 (defun YaTeX::documentstyle (&optional argp)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
740 "YaTeX add-in function for arguments of \\documentstyle."
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
741 (cond
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
742 ((equal argp 1)
51
b0371b6ed799 Created `ChangeLog'.
yuuji
parents: 49
diff changeset
743 (setq env-name "document")
49
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
744 (let ((sname
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
745 (YaTeX-cplread-with-learning
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
746 (format "Documentstyle (default %s): "
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
747 YaTeX-default-document-style)
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
748 'YaTeX:documentstyles-default
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
749 'YaTeX:documentstyles-private
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
750 'YaTeX:documentstyles-local)))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
751 (if (string= "" sname) (setq sname YaTeX-default-document-style))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
752 (setq YaTeX-default-document-style sname))))
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
753 )
eb0512bfcb7f Abolish user-article table.
yuuji
parents: 48
diff changeset
754
57
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
755 ;;; -------------------- LaTeX2e stuff --------------------
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
756 (defvar YaTeX:documentclass-options-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
757 '(("a4paper") ("a5paper") ("b5paper") ("10pt") ("11pt") ("12pt")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
758 ("latterpaper") ("legalpaper") ("executivepaper") ("landscape")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
759 ("oneside") ("twoside") ("draft") ("final") ("leqno") ("fleqn") ("openbib")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
760 ("clock") ;for slides class only
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
761 )
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
762 "Default options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
763 (defvar YaTeX:documentclass-options-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
764 "*User defined options list for documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
765 (defvar YaTeX:documentclass-options-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
766 "*User defined options list for local documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
767
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
768 (defun YaTeX:documentclass ()
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
769 (let*((delim ",")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
770 (dt (append YaTeX:documentclass-options-local
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
771 YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
772 YaTeX:documentclass-options-default))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
773 (minibuffer-completion-table dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
774 (opt (read-from-minibuffer
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
775 "Documentclass options ([opt1,opt2,...]): "
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
776 nil YaTeX-minibuffer-completion-map nil))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
777 (substr opt) o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
778 (if (string< "" opt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
779 (progn
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
780 (while substr
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
781 (setq o (substring substr 0 (string-match delim substr)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
782 (or (assoc o dt)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
783 (YaTeX-update-table
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
784 (list o)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
785 'YaTeX:documentclass-options-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
786 'YaTeX:documentclass-options-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
787 'YaTeX:documentclass-options-local))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
788 (setq substr
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
789 (if (string-match delim substr)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
790 (substring substr (1+ (string-match delim substr))))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
791 (concat "[" opt "]"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
792 "")))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
793
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
794 (defvar YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
795 '(("article") ("jarticle") ("report") ("jreport") ("book") ("jbook")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
796 ("j-article") ("j-report") ("j-book")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
797 ("letter") ("slides") ("ltxdoc") ("ltxguide") ("ltnews") ("proc"))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
798 "Default documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
799 (defvar YaTeX:documentclasses-private nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
800 "*User defined documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
801 (defvar YaTeX:documentclasses-local nil
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
802 "*User defined local documentclass alist")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
803 (defvar YaTeX-default-documentclass (if YaTeX-japan "jarticle" "article")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
804 "*Default documentclass")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
805
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
806 (defun YaTeX::documentclass (&optional argp)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
807 (cond
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
808 ((equal argp 1)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
809 (setq env-name "document")
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
810 (let ((sname
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
811 (YaTeX-cplread-with-learning
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
812 (format "Documentclass (default %s): " YaTeX-default-documentclass)
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
813 'YaTeX:documentclasses-default
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
814 'YaTeX:documentclasses-private
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
815 'YaTeX:documentclasses-local)))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
816 (if (string= "" sname) (setq sname YaTeX-default-documentclass))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
817 (setq YaTeX-default-documentclass sname)))))
18f4939986e6 (j)LaTeX2e supported
yuuji
parents: 53
diff changeset
818
23
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
819 ;;; -------------------- End of yatexadd --------------------
b00c74813e56 Change the YaTeX-math-mode's prefix from `,' to `;'.
yuuji
parents: 18
diff changeset
820 (provide 'yatexadd)

yatex.org