Mercurial > hgrepos > hgweb.cgi > yatex
annotate yatexmth.el @ 587:c6a26b422d30 draft
Add-in for wraptable added
author | HIROSE Yuuji <yuuji@gentei.org> |
---|---|
date | Wed, 21 Sep 2022 21:34:29 +0900 |
parents | a2ef47ba407f |
children | c11261c0960f |
rev | line source |
---|---|
395 | 1 ;;; yatexmth.el --- YaTeX math-mode-specific functions -*- coding: sjis -*- |
287 | 2 ;;; |
558
a2ef47ba407f
Why 'insert-string was used??
HIROSE Yuuji <yuuji@gentei.org>
parents:
527
diff
changeset
|
3 ;;; (c)1993-2018 by HIROSE Yuuji [yuuji@yatex.org] |
a2ef47ba407f
Why 'insert-string was used??
HIROSE Yuuji <yuuji@gentei.org>
parents:
527
diff
changeset
|
4 ;;; Last modified Tue Dec 25 20:02:12 2018 on firestorm |
366 | 5 ;;; $Id$ |
11 | 6 |
287 | 7 ;;; Commentary: |
13 | 8 ;;; [Customization guide] |
9 ;;; | |
10 ;;; By default, you can use two completion groups in YaTeX math | |
52 | 11 ;;; mode, `;' for mathematical signs and `:' for greek letters. But |
13 | 12 ;;; you can add other completion groups by defining the alist of |
13 ;;; `prefix key' vs `completion list' into the variable | |
14 ;;; YaTeX-math-key-list-private. If you wish to accomplish the | |
23 | 15 ;;; completion as follows(prefix key is `,'): |
13 | 16 ;;; |
17 ;;; KEY COMPLETION | |
18 ;;; s \sin | |
19 ;;; S \arcsin | |
20 ;;; c \cos | |
21 ;;; C \arccos | |
22 ;;; : | |
23 ;;; T \arctan | |
24 ;;; l \log | |
25 ;;; hs \sinh | |
26 ;;; | |
23 | 27 ;;; Typing `s' after `,' makes `\sin', `hs' after `,' makes `\sinh' |
13 | 28 ;;; and so on. First, you have to define list of key-completion |
29 ;;; pairs. Variable name(YaTeX-math-funcs-list) is arbitrary. | |
30 ;;; | |
31 ;;; (setq YaTeX-math-funcs-list | |
32 ;;; '(("s" "sin") | |
33 ;;; ("S" "arcsin") | |
34 ;;; : | |
35 ;;; ("hs" "sinh"))) | |
36 ;;; | |
37 ;;; Next, define the list of prefix-key vs completion list(defined | |
38 ;;; above) into the variable YaTeX-math-key-list-private. | |
39 ;;; | |
40 ;;; (setq YaTeX-math-key-list-private | |
23 | 41 ;;; '(("," . YaTeX-math-funcs-list) |
13 | 42 ;;; ("'" . Other-List-if-any))) |
43 ;;; | |
44 ;;; Put these expressions into your ~/.emacs, and you can use this | |
51 | 45 ;;; completion in the math-mode. |
13 | 46 ;;; |
47 ;;; And you can add your favorite completion sequences to the | |
23 | 48 ;;; default completion list invoked with `;', by defining those lists |
13 | 49 ;;; into variable YaTeX-math-sign-alist-private. |
50 | |
51 ;;; 【イメージ補完の追加方法】 | |
52 ;;; | |
52 | 53 ;;; 標準のイメージ補完では、「;」で始まる数式記号補完と、「:」で始 |
13 | 54 ;;; まるギリシャ文字補完が使用可能ですが、これ以外の文字で始まる補完 |
23 | 55 ;;; シリーズも定義することができます。例えば、「,」で始まる次のよう |
13 | 56 ;;; な補完シリーズを定義する場合を考えてみます。 |
57 ;;; | |
58 ;;; 補完キー 補完結果 | |
59 ;;; s \sin | |
60 ;;; S \arcsin | |
61 ;;; c \cos | |
62 ;;; C \arccos | |
63 ;;; : | |
64 ;;; T \arctan | |
65 ;;; l \log | |
66 ;;; hs \sinh | |
67 ;;; | |
23 | 68 ;;; 「,」のあとに s を押すと \sin が、hs を押すと \sinh が入力されま |
13 | 69 ;;; す。このような補完リストの登録は以下のようにします(変数名は任意)。 |
70 ;;; | |
71 ;;; (setq YaTeX-math-funcs-list | |
72 ;;; '(("s" "sin") | |
73 ;;; ("S" "arcsin") | |
74 ;;; : | |
75 ;;; ("hs" "sinh"))) | |
76 ;;; | |
23 | 77 ;;; さらに、「,」を押した時にイメージ補完が始まるよう次の変数に、起動キー |
13 | 78 ;;; と上で定義した補完用変数の登録を行ないます。 |
79 ;;; | |
80 ;;; (setq YaTeX-math-key-list-private | |
23 | 81 ;;; '(("," . YaTeX-math-funcs-list) |
13 | 82 ;;; ("'" . ほかに定義したいシリーズがあれば…))) |
83 ;;; | |
51 | 84 ;;; これらを ~/.emacs に書いておけば、math-mode で自分専用のイメージ |
85 ;;; 補完が利用できます。 | |
13 | 86 |
287 | 87 ;;; Code: |
13 | 88 (defvar YaTeX-jisold |
89 (and (boundp 'dos-machine-type) | |
90 (eq dos-machine-type 'pc98))) | |
91 | |
92 (defmacro YaTeX-setq-math-sym (sym old new) | |
93 (list 'setq sym (list 'if 'YaTeX-jisold old new))) | |
94 | |
95 (YaTeX-setq-math-sym YaTeX-image-in "E" "∈") | |
96 (YaTeX-setq-math-sym YaTeX-image-ni "ヨ" "∋") | |
97 (YaTeX-setq-math-sym YaTeX-image-subset " _\n(\n ~" "⊂") | |
98 (YaTeX-setq-math-sym YaTeX-image-subseteq " _\n(_\n ~" "⊆") | |
99 (YaTeX-setq-math-sym YaTeX-image-supset "_\n )\n~" "⊃") | |
100 (YaTeX-setq-math-sym YaTeX-image-supseteq "_\n_)\n~" "⊇") | |
101 (YaTeX-setq-math-sym YaTeX-image-nabla "___\n\\\\/" "∇") | |
102 (YaTeX-setq-math-sym YaTeX-image-partial " -+\n+-+\n+-+" "∂") | |
103 (YaTeX-setq-math-sym YaTeX-image-dagger "+\n|" "†") | |
104 (YaTeX-setq-math-sym YaTeX-image-ddagger "+\n+\n|" "‡") | |
105 (YaTeX-setq-math-sym YaTeX-image-equiv "=\n ̄" "≡") | |
106 (YaTeX-setq-math-sym YaTeX-image-int " /\\\n \\\n\\/" "∫") | |
107 (YaTeX-setq-math-sym YaTeX-image-bot "|\n ̄" "⊥") | |
108 (YaTeX-setq-math-sym YaTeX-image-neg "イ" "¬") | |
109 (YaTeX-setq-math-sym YaTeX-image-flat "b" "♭") | |
23 | 110 (YaTeX-setq-math-sym YaTeX-image-sqrt "" "√") |
80 | 111 (defvar YaTeX-image-nearrow '("__\n /|\n/" " _\n /|\n/" )) |
112 (defvar YaTeX-image-nwarrow '(" __\n|\\\n \\" " _\n|\\n \")) | |
113 (defvar YaTeX-image-searrow '("\\\n \\|\n--`" "\\n \|\n  ̄")) | |
114 (defvar YaTeX-image-swarrow '(" /\n|/\n'~~" " /\n|/\n  ̄")) | |
115 | |
13 | 116 |
52 | 117 (defvar |
13 | 118 YaTeX-math-sign-alist-default |
11 | 119 '( |
120 ;frequently used | |
121 ("||" "|" ("||" "‖")) | |
122 ("sum" "sum" ("\\-+\n >\n/-+" "Σ")) | |
123 ("sigma" "sum" ("\\-+\n >\n/-+" "Σ")) | |
13 | 124 ("integral" "int" (" /\\\n \\\n\\/" YaTeX-image-int)) |
11 | 125 ("ointegral" "oint" " /\\\n(\\)\n\\/") |
23 | 126 ("sqrt" "sqrt" (" __\n,/" YaTeX-image-sqrt)) |
127 ("root" "sqrt" (" __\n,/" YaTeX-image-sqrt)) | |
11 | 128 ("A" "forall" "|_|\nV") |
129 ("E" "exists" "-+\n-+\n-+") | |
13 | 130 ("!" "neg" ("--+\n |" YaTeX-image-neg)) |
11 | 131 ("oo" "infty" ("oo" "∞")) |
132 ("\\" "backslash" ("\\" "\")) | |
68 | 133 ("..." "cdots" ("..." "…")) |
11 | 134 |
135 ;;binary operators | |
136 ("+-" "pm" ("+\n-" "±")) | |
137 ("-+" "mp" "-\n+") | |
138 ("x" "times" ("x" "×")) | |
139 ("/" "div" (",\n-\n'" "÷")) | |
23 | 140 ("f" "frac" "xxx\n---\nyyy" "÷") |
11 | 141 ("*" "ast" "*") |
142 ("#" "star" ("_/\\_\n\\ /\n//\\\\" "★")) | |
143 ("o" "circ" "o") | |
144 ("o*" "bullet" " _\n(*)\n ~") | |
145 ("." "cdot" ".") | |
146 ("cap" "cap" "/-\\\n| |") | |
147 ("cup" "cup" "| |\n\\-/") | |
148 ("u+" "uplus" "|+|\n\\-/") | |
149 ("|~|" "sqcap" "|~|") | |
150 ("|_|" "sqcup" "|_|") | |
151 ("v" "vee" "v") | |
152 ("^" "wedge" "^") | |
153 ("\\\\" "setminus" "\\") | |
154 (")(" "wr" " )\n(") | |
155 ("<>" "diamond" "<>") | |
128 | 156 ("/\\-" "bigtriangleup" ("/\\\n~~" "△")) |
11 | 157 ("-\\/" "bigtriangledown" ("__\n\\/" "▽")) |
158 ("<|" "triangleleft" "<|") | |
159 ("|>" "triangleright" "|>") | |
160 ("<||" "lhd" "/|\n\\|") | |
161 ("||>" "rhd" "|\\\n|/") | |
162 ("<|-" "unlhd" "<|\n~~") | |
163 ("|>-" "unrhd" "|>\n~~") | |
164 ("o+" "oplus" " _\n(+)\n ~") | |
165 ("o-" "ominus" " _\n(-)\n ~") | |
166 ("ox" "otimes" " _\n(x)\n ~") | |
167 ("o/" "oslash" " _\n(/)\n ~") | |
168 ("o." "odot" "(.)") | |
169 ("O" "bigcirc" "O") | |
13 | 170 ("t" "dagger" ("+\n|" YaTeX-image-dagger)) |
171 ("tt" "ddagger" ("+\n+\n|" YaTeX-image-ddagger)) | |
11 | 172 ("II" "amalg" "II") |
173 ; : | |
174 ;;relational operators | |
134 | 175 ("<" "leq" ("<\n-" "<\n-")) |
176 ("=<" "leqq" ("<\n=" "≦")) | |
177 (">" "geq" (">\n-" ">\n-")) | |
178 (">=" "geqq" (">\n=" "≧")) | |
143 | 179 ("=:" "fallingdotseq" (".\n==\n ." "≒")) |
13 | 180 ("-=" "equiv" ("=\n-" YaTeX-image-equiv)) |
181 ("=-" "equiv" ("=\n-" YaTeX-image-equiv)) | |
182 ("---" "equiv" ("=\n-" YaTeX-image-equiv)) | |
183 ("(" "subset" (" _\n(\n ~" YaTeX-image-subset)) | |
184 ("(-" "subseteq" (" _\n(_\n ~" YaTeX-image-subseteq)) | |
185 (")" "supset" ("_\n )\n~" YaTeX-image-supset)) | |
186 (")-" "supseteq" ("_\n_)\n~" YaTeX-image-supseteq)) | |
11 | 187 ("[" "sqsubset" "[") |
188 ("[-" "sqsubseteq" "[\n~") | |
189 ("]" "sqsupset" "]") | |
190 ("]-" "sqsupseteq" "]\n~") | |
13 | 191 ("{" "in" ("(-" YaTeX-image-in)) |
192 ("}" "ni" ("-)" YaTeX-image-ni)) | |
11 | 193 ("|-" "vdash" "|-") |
194 ("-|" "dashv" "-|") | |
195 ("~" "sim" "~(tild)") | |
196 ("~-" "simeq" "~\n-") | |
197 ("asymp" "asymp" "v\n^") | |
198 ("~~" "approx" "~\n~") | |
199 ("~=" "cong" "~\n=") | |
200 ("=/" "neq" ("=/=" "≠")) | |
201 (".=" "doteq" ".\n=") | |
202 ("o<" "propto" "o<") | |
203 ("|=" "models" "|=") | |
204 ("_|_" "perp" "_|_") | |
205 ("|" "mid" "|") | |
206 ("||" "parallel" "||") | |
207 ("bowtie" "bowtie" "|><|(wide)") | |
208 ("|><|" "join" "|><|") | |
209 ("\\_/" "smile" "\\_/") | |
210 ("/~\\" "frown" "/~~\\") | |
211 ("-<" "prec" ("-<" "く")) | |
212 ("-<=" "preceq" ("-<\n-" "く\n=")) | |
213 ("<<" "ll" ("<<" "《")) | |
134 | 214 ("<<" "lll" "<<<") |
80 | 215 (">>" "gg" (">>" "》")) |
134 | 216 (">>>" "ggg" ">>>") |
11 | 217 ; : |
218 ;;arrows | |
219 ("<-" "leftarrow" ("<-" "←")) | |
13 | 220 ("\C-b" "leftarrow" ("<-" "←")) |
221 ("<--" "longleftarrow" ("<--" "←--")) | |
11 | 222 ("<=" "Leftarrow" "<=") |
223 ("<==" "Longleftarrow" "<==") | |
224 ("->" "rightarrow" ("->" "→")) | |
13 | 225 ("\C-f" "rightarrow" ("->" "→")) |
11 | 226 ("-->" "longrightarrow" ("-->" "--→")) |
64 | 227 ("=>" "Rightarrow" "=>") |
11 | 228 ("==>" "Longrightarrow" "==>") |
229 ("<->" "leftrightarrow" ("<->" "←→")) | |
230 ("<-->" "longleftrightarrow" ("<---->" "←--→")) | |
47 | 231 ("<=>" "Leftrightarrow" "<=>") |
11 | 232 ("<==>" "Longleftrightarrow" "<==>") |
233 ("^|" "uparrow" ("^\n|" "↑")) | |
13 | 234 ("\C-p" "uparrow" ("^\n|" "↑")) |
11 | 235 ("^||" "Uparrow" "/\\\n||") |
236 ("\C-n" "downarrow" ("|\nv" "↓")) | |
13 | 237 ("v|" "downarrow" ("|\nv" "↓")) |
238 ("v||" "Downarrow" "||\n\\/") | |
80 | 239 ("\C-p\C-f" "nearrow" YaTeX-image-nearrow) |
240 ("\C-f\C-p" "nearrow" YaTeX-image-nearrow) | |
241 ("ne" "nearrow" YaTeX-image-nearrow) | |
242 ("\C-p\C-b" "nwarrow" YaTeX-image-nwarrow) | |
243 ("\C-b\C-p" "nwarrow" YaTeX-image-nwarrow) | |
244 ("nw" "nwarrow" YaTeX-image-nwarrow) | |
245 ("\C-n\C-f" "searrow" YaTeX-image-searrow) | |
246 ("\C-f\C-n" "searrow" YaTeX-image-searrow) | |
247 ("se" "searrow" YaTeX-image-searrow) | |
248 ("\C-n\C-b" "swarrow" YaTeX-image-swarrow) | |
249 ("\C-b\C-n" "swarrow" YaTeX-image-swarrow) | |
250 ("sw" "swarrow" YaTeX-image-swarrow) | |
11 | 251 ("|->" "mapsto" ("|->" "|→")) |
252 ("<-)" "hookleftarrow" (" ,\n<--+" " ヽ\n<--/")) | |
69 | 253 ("(->" "hookrightarrow" ("`\n+-->" "/\n\-->")) |
11 | 254 ("/-" "leftharpoonup" "/\n~~~") |
255 ("\\-" "leftharpoondown" "__\n\\") | |
256 ("-/" "rightharpoondown" "__\n/") | |
257 ("-\\" "rightharpoonup" "~~\n\\") | |
53
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
258 ;;left and right |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
259 ("left" "left" "(leftmark)") |
5f4b18da14b3
Fix functions relating YaTeX-beginning-of-environment or
yuuji
parents:
52
diff
changeset
|
260 ("right" "right" "(rightmark)") |
68 | 261 ;;accent marks |
262 ("tilde" "tilde" "~\n?") | |
263 ("T" "tilde" "~\n?") | |
264 ("wtilde" "widetilde" "~\n?") | |
265 ("hat" "hat" "^\n?") | |
266 ("what" "widehat" "/\\\n??") | |
267 ("w^" "widehat" "/\\\n?") | |
268 ("check" "check" "v\n?") | |
269 ("bar" "bar" "_\n?") | |
270 ("overline" "overline" "_\n?") | |
271 ("wbar" "overline" "--\n??") | |
272 ("dot" "dot" ".\n?") | |
273 ("ddot" "ddot" "..\n??") | |
274 ("vec" "vec" ("->\n??" "→\n??")) | |
275 ("~>" "overrightarrow" ("-->\nAB" "→\nAB")) | |
276 ("VEC" "overrightarrow" ("-->\nAB" "→\nAB")) | |
277 ;;rage-aware stuffs | |
278 ("prod" "prod" ("-+--+-\n | |" "Π")) | |
279 ("CUP" "bigcup" "|~~|\n| |\n| |") | |
280 ("union" "bigcup" "|~~|\n| |\n| |") | |
281 ("CAP" "bigcap" "| |\n| |\n|__|") | |
282 ("isc" "bigcap" "| |\n| |\n|__|") | |
283 ("O+" "bigoplus" "/~~~\\\n| + |\n\\___/") | |
284 ("Ox" "bigotimes" "/~~~\\\n| X |\n\\___/") | |
285 ;;other marks | |
80 | 286 ("angle" "angle" ("/\n~" "∠")) |
287 ("/_" "angle" ("/\n~" "∠")) | |
11 | 288 ("Z" "aleph" "|\\|") |
289 ("|\\|" "aleph" "|\\|") | |
290 ("h-" "hbar" "_\nh") | |
68 | 291 ; ("i" "imath" "i") ;These chars are appeared only |
292 ; ("j" "jmath" "j") ;as section-type arguments | |
11 | 293 ("l" "ell" "l") |
294 ("wp" "wp" "???") | |
295 ("R" "Re" ")R") | |
296 ("Im" "Im" "???") | |
297 ("mho" "mho" "~|_|~") | |
298 ("'" "prime" "'") | |
299 ("0" "emptyset" "0") | |
13 | 300 ("nabla" "nabla" ("___\n\\\\/" YaTeX-image-nabla)) |
11 | 301 ("\\/" "surd" "-\\/") |
302 ("surd" "surd" "-\\/") | |
303 ("top" "top" "T") | |
13 | 304 ("bot" "bot" ("_|_" YaTeX-image-bot)) |
305 ("b" "flat" ("b" YaTeX-image-flat)) | |
11 | 306 ("LT" "natural" "|\nLT\n |") |
13 | 307 ("6" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial)) |
308 ("partial" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial)) | |
309 ("round" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial)) | |
59 | 310 ("[]" "Box" "[]") |
80 | 311 ("no" "notag" "\\notag") |
312 (":" "colon" ":") | |
305
53709ee88448
Add \because and \therefore to math-image completion.
HIROSE Yuuji <yuuji@gentei.org>
parents:
294
diff
changeset
|
313 (".'." "therefore" (".'." "∴")) |
53709ee88448
Add \because and \therefore to math-image completion.
HIROSE Yuuji <yuuji@gentei.org>
parents:
294
diff
changeset
|
314 ("'.'" "because" ("'.'" "∵")) |
11 | 315 ("Diamond" "Diamond" "/\\\n\\/") |
316 ("3" "triangle" "/\\\n~~") | |
317 ("C" "clubsuit" " o\no+o\n |") | |
318 ("D" "diamondsuit" "/\\\n\\/") | |
319 ("H" "heartsuit" "<^^>\n \\/") | |
320 ("S" "spadesuit" " /\\\n<++>\n /\\") | |
229 | 321 ("mi" "mathit" "\\mathit{}") |
322 ("mr" "mathrm" "\\mathrm{}") | |
323 ("mb" "mathbf" "\\mathbf{}") | |
456 | 324 ("mB" "mathbb" "\\mathbb{}") |
229 | 325 ("mt" "mathtt" "\\mathtt{}") |
326 ("ms" "mathsf" "\\mathsf{}") | |
327 ("mc" "mathcal" "\\mathcal{}") | |
328 ("mn" "mathnormal" "\\mathnormal{}") | |
52 | 329 ) |
330 "Default LaTeX-math-command alist.") | |
11 | 331 |
13 | 332 (defvar YaTeX-math-sign-alist-private nil |
11 | 333 "*User definable key vs LaTeX-math-command alist.") |
334 | |
335 (defvar YaTeX-math-quit-with-strict-match nil | |
336 "*T for quitting completion as soon as strict-match is found.") | |
52 | 337 (defvar YaTeX-math-sign-alist |
13 | 338 (append YaTeX-math-sign-alist-private YaTeX-math-sign-alist-default)) |
339 | |
340 ;;(defun YaTeX-math-alist2array (alist array) | |
341 ;; (set array | |
342 ;; (let ((array (make-vector (length alist) "")) (list alist) (i 0)) | |
343 ;; (while list | |
344 ;; (aset array i (car (car list))) | |
345 ;; (setq i (1+ i) list (cdr list))) | |
346 ;; array)) | |
347 ;;) | |
11 | 348 |
52 | 349 (defvar YaTeX-greek-key-alist-default |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
350 (append |
461 | 351 '(("a" "alpha" ("a" "α")) |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
352 ("b" "beta" ("|>\n|>\n|" "β")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
353 ("g" "gamma" ("~r" "γ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
354 ("G" "Gamma" ("|~" "Γ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
355 ("d" "delta" ("<~\n<>" "δ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
356 ("D" "Delta" ("/\\\n~~" "Δ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
357 ("e" "epsilon" "<\n<~") |
461 | 358 ("e-" "varepsilon" ("(\n(~" "_ε")) |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
359 ("z" "zeta" ("(~\n >" "ζ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
360 ("et" "eta" ("n\n/" "η")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
361 ("th" "theta" ("8" "θ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
362 ("Th" "Theta" ("(8)" "Θ")) |
461 | 363 ("th-" "vartheta" ("-8" "_θ")) |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
364 ("i" "iota" ("i\n\\_/" "ι")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
365 ("k" "kappa" ("k" "κ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
366 ("l" "lambda" ("\\n/\\" "λ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
367 ("L" "Lambda" ("/\\" "Λ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
368 ("m" "mu" (" u_\n/" "μ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
369 ("n" "nu" ("|/" "ν")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
370 ("x" "xi" ("E\n >" "ξ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
371 ("X" "Xi" ("---\n -\n---" "Ξ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
372 ("p" "pi" ("__\n)(" "π")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
373 ("P" "Pi" ("__\n||" "Π")) |
461 | 374 ("p-" "varpi" ("__\n/(" "_π")) |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
375 ("r" "rho" ("/O" "ρ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
376 ("r-" "varrho" ("/O\n~~" "ρ\n~~")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
377 ("s" "sigma" ("o~" "σ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
378 ("S" "Sigma" ("\\-+\n >\n/-+" "Σ")) |
461 | 379 ("s-" "varsigma" "/~~ \n /") |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
380 ("t" "tau" ("__\n(" "τ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
381 ("u" "upsilon" ("~v" "υ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
382 ("y" "upsilon" ("~v" "υ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
383 ("U" "Upsilon" ("~Y~" "Υ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
384 ("Y" "Upsilon" ("~Y~" "Υ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
385 ("ph" "phi" (" /\n(/)\n/" "φ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
386 ("Ph" "Phi" (" _\n(|)\n ~" "Φ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
387 ("ph-" "varphi" "\\O\n|") |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
388 ("c" "chi" ("x" "χ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
389 ("ps" "psi" ("\\|/\\n |" "ψ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
390 ("Ps" "Psi" (" ~\n\\|/\\n |" "Ψ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
391 ("o" "omega" ("w" "ω")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
392 ("w" "omega" ("w" "ω")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
393 ("O" "Omega" ("(~)\n~ ~" "Ω")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
394 ("W" "Omega" ("(~)\n~ ~" "Ω")) |
461 | 395 ("f" "foo")) |
460
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
396 (if YaTeX-use-AMS-LaTeX |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
397 '( |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
398 ("G-" "varGamma" ("/~" "_Γ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
399 ("D-" "varDelta" ("/|\n~~" "_Δ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
400 ("Th-" "varTheta" ("/8/" "_Θ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
401 ("L-" "varLambda" ("/|" "_Λ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
402 ("X-" "varXi" (" --\n -\n-- " "_Ξ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
403 ("S-" "varSigma" (" \\-+\n >\n/-+" "_Σ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
404 ("U-" "varUpsilon" ("~~Y~" "_Υ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
405 ("Ph-" "varPhi" (" _\n(|)\n~" "_Φ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
406 ("Ps-" "varPsi" (" ~\n\\//\\n /" "Ψ")) |
1790e0d35156
Capitalized varGREEK with amssymb, added
HIROSE Yuuji <yuuji@gentei.org>
parents:
456
diff
changeset
|
407 ("O-" "varOmega" ("/~/\n~ ~" "_Ω"))))) |
52 | 408 "Default LaTeX-math-command alist.") |
11 | 409 |
13 | 410 (defvar YaTeX-greek-key-alist-private nil |
411 "*User definable key vs LaTeX-math-command alist.") | |
412 | |
52 | 413 (defvar YaTeX-greek-key-alist |
13 | 414 (append YaTeX-greek-key-alist-private YaTeX-greek-key-alist-default)) |
415 | |
416 ;;(mapcar (function (lambda (x) (YaTeX-math-alist2array x))) | |
417 ;; YaTeX-math-key-list) | |
418 | |
52 | 419 (defvar YaTeX-math-indicator "KEY\tLaTeX sequence\t\tsign") |
11 | 420 |
421 (defvar YaTeX-math-need-image t | |
422 "*T for displaying pseudo image momentarily.") | |
423 (defvar YaTeX-math-max-key 8) | |
424 (defvar YaTeX-math-max-seq | |
425 (* 8 (1+ (/ (length "\\longleftrightarrow") 8)))) | |
426 (defvar YaTeX-math-max-sign 5) | |
427 (defvar YaTeX-math-sign-width | |
428 (+ YaTeX-math-max-key YaTeX-math-max-seq YaTeX-math-max-sign)) | |
429 (defvar YaTeX-math-display-width | |
430 (* 8 (1+ (/ YaTeX-math-sign-width 8)))) | |
431 (defvar YaTeX-math-menu-map nil | |
80 | 432 "Keymap used in YaTeX mathematical sign menu mode.") |
433 | |
11 | 434 (if YaTeX-math-menu-map nil |
435 (setq YaTeX-math-menu-map (make-sparse-keymap)) | |
436 (define-key YaTeX-math-menu-map "n" 'next-line) | |
437 (define-key YaTeX-math-menu-map "p" 'previous-line) | |
438 (define-key YaTeX-math-menu-map "f" 'YaTeX-math-forward) | |
439 (define-key YaTeX-math-menu-map "b" 'YaTeX-math-backward) | |
440 (define-key YaTeX-math-menu-map "v" 'scroll-up) | |
441 (define-key YaTeX-math-menu-map " " 'scroll-up) | |
442 (define-key YaTeX-math-menu-map "c" 'scroll-up) | |
443 (define-key YaTeX-math-menu-map "V" 'scroll-down) | |
444 (define-key YaTeX-math-menu-map "r" 'scroll-down) | |
445 (define-key YaTeX-math-menu-map "\^h" 'scroll-down) | |
446 (define-key YaTeX-math-menu-map "<" 'beginning-of-buffer) | |
447 (define-key YaTeX-math-menu-map ">" 'end-of-buffer) | |
448 (define-key YaTeX-math-menu-map "\^m" 'exit-recursive-edit) | |
449 (define-key YaTeX-math-menu-map "q" 'abort-recursive-edit)) | |
450 | |
13 | 451 (defvar YaTeX-math-exit-key "\e" |
80 | 452 "*Key sequence after prefix key of YaTeX-math-mode to exit from math-mode.") |
13 | 453 |
11 | 454 (defmacro YaTeX-math-japanese-sign (list) |
455 (list 'nth 1 list)) | |
456 | |
72 | 457 (defvar YaTeX-math-cmd-regexp (concat (regexp-quote YaTeX-ec) "[A-z|]")) |
177
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
458 |
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
459 ;;; alltt goes into YaTeX-verbatim-environments 2011/3/16 |
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
460 ;;(defvar YaTeX-math-verbatim-environments |
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
461 ;; '("alltt") |
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
462 ;; "*List of environments in which LaTeX math mode is disabled. |
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
463 ;;This value is appended with YaTeX-verbatim-environments.") |
11 | 464 |
13 | 465 ;;; |
466 ;;YaTeX math-mode functions | |
467 ;;; | |
417
1ab1b9ba8698
Remove superfluous string in autoload line
HIROSE Yuuji <yuuji@gentei.org>
parents:
401
diff
changeset
|
468 ;;;###autoload |
13 | 469 (defun YaTeX-toggle-math-mode (&optional arg) |
470 (interactive "P") | |
471 (or (memq 'YaTeX-math-mode mode-line-format) nil | |
472 (setq mode-line-format | |
473 (append (list "" 'YaTeX-math-mode) mode-line-format))) | |
23 | 474 (if YaTeX-auto-math-mode nil ;Only effective on manual mode. |
475 (if (or arg (null YaTeX-math-mode)) | |
476 (let (keys) | |
477 (setq YaTeX-math-mode "math:") | |
478 (message "Turn on math mode. Prefix keys are %s" | |
479 (mapconcat 'car YaTeX-math-key-list " ")) | |
480 (sit-for 3) | |
481 (message | |
482 (concat "To exit from math-mode, type `ESC' after prefix, " | |
483 "or type `" | |
484 (key-description | |
485 (car | |
486 (where-is-internal | |
487 'YaTeX-switch-mode-menu YaTeX-mode-map))) | |
488 " $'"))) | |
489 (setq YaTeX-math-mode nil) | |
490 (message "Exit from math mode.")) | |
80 | 491 (set-buffer-modified-p (buffer-modified-p)))) |
13 | 492 |
11 | 493 (defun YaTeX-math-forward (arg) |
494 (interactive "p") | |
495 (re-search-forward YaTeX-math-cmd-regexp nil t arg)) | |
496 | |
497 (defun YaTeX-math-backward (arg) | |
498 (interactive "p") | |
499 (re-search-backward YaTeX-math-cmd-regexp nil t arg)) | |
500 | |
13 | 501 (defun YaTeX-math-gets (sign) |
502 (cond | |
503 ((null sign) nil) | |
504 ((listp sign) | |
505 (setq sign | |
506 (cond | |
507 (YaTeX-japan (YaTeX-math-japanese-sign sign)) | |
508 (t (car sign)))) | |
509 (YaTeX-math-gets sign)) | |
510 ((symbolp sign) | |
511 (YaTeX-math-gets (symbol-value sign))) | |
80 | 512 (t sign))) |
13 | 513 |
11 | 514 (defun YaTeX-math-get-sign (list) |
80 | 515 (YaTeX-math-gets (car (cdr-safe (cdr-safe list))))) |
516 | |
77 | 517 (defvar YaTeX-math-section-type-regexp |
518 "eqn\\\\\\sw+\\b" | |
519 "*Regexp of section-type math-mode macro") | |
520 | |
23 | 521 (defun YaTeX-in-math-mode-p () |
80 | 522 "If current position is supposed to be in LaTeX-math-mode, return t. |
523 This function refers a local variable `source-window' in YaTeX-make-section." | |
524 (save-excursion | |
525 (and (boundp 'source-window) source-window | |
526 (set-buffer (window-buffer source-window))) | |
527 (or (YaTeX-quick-in-environment-p | |
528 (append | |
529 '("math" "eqnarray" "equation" "eqnarray*" "displaymath") ;LaTeX | |
530 (if YaTeX-use-AMS-LaTeX | |
531 ;; And math modes of AMS-LaTeX | |
532 ;;'("align" "align*" "split" "multline" "multline*" "gather" | |
533 ;; "gather*" "aligned*" "gathered" "gathered*" "alignat" | |
534 ;; "equation*" "cases" "flalign" "flalign*" | |
535 ;; "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*" | |
536 YaTeX-math-begin-list | |
449
c2c547e147c7
YaTeX-math-other-env-alist-* for additional math-environments
HIROSE Yuuji <yuuji@gentei.org>
parents:
443
diff
changeset
|
537 ) |
450
8871fe9f563b
YaTeX-math-other-env-alist should have list form
HIROSE Yuuji <yuuji@gentei.org>
parents:
449
diff
changeset
|
538 YaTeX-math-other-env-list)) |
130
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
539 (let*((p (point)) (nest 0) me0 r firstp dollar |
80 | 540 (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l")) |
541 (boundary | |
542 (save-excursion | |
543 (if (looking-at delim) | |
544 (goto-char (max (point-min) (1- (point))))) | |
545 (re-search-backward delim nil 1) | |
546 (point)))) | |
547 (save-excursion | |
548 (cond | |
549 ((catch 'open | |
550 (save-excursion | |
551 (while (and (>= nest 0) | |
552 (re-search-backward | |
553 (concat YaTeX-ec-regexp ;\ | |
554 "\\([()]\\|[][]\\)") boundary t)) | |
555 (setq me0 (match-end 0)) | |
556 (if (or (YaTeX-on-comment-p) | |
557 (YaTeX-literal-p)) nil | |
558 (if (or (= (char-after (1- me0)) ?\)) | |
559 (= (char-after (1- me0)) ?\])) | |
560 (setq nest (1+ nest)) | |
561 (if (= (preceding-char) ?\\ ) nil ;;\\[5pt] | |
562 (setq nest (1- nest)))))) | |
130
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
563 (if (< nest 0) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
564 (throw 'open (cons (YaTeX-match-string 0) (point))))))) |
80 | 565 ((and (setq r (YaTeX-on-section-command-p |
566 YaTeX-math-section-type-regexp)) | |
567 (numberp r) | |
568 (> r 0)) | |
569 t) | |
570 (t (catch 'dollar | |
571 (while ;(search-backward "$" boundary t);little bit fast. | |
572 (YaTeX-re-search-active-backward ;;;;;; Too slow??? | |
573 "\\$" (concat "[^\\\\]" YaTeX-comment-prefix) boundary t) | |
130
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
574 (setq dollar "$") |
80 | 575 (cond |
576 ((equal (char-after (1- (point))) ?$) ; $$ equation $$ | |
130
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
577 (setq dollar "$$") |
80 | 578 (backward-char 1) |
579 (setq nest (1+ nest))) | |
177
9c5a764a871f
Treat `alltt' in YaTeX-verbatim-environments.
yuuji@gentei.org
parents:
143
diff
changeset
|
580 ((YaTeX-literal-p) |
80 | 581 nil) |
582 ((and (equal (char-after (1- (point))) ?\\ ) | |
583 (not (equal (char-after (- (point) 3)) ?\\ ))) | |
584 nil) ;\$ | |
130
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
585 (t (setq nest (1+ nest)))) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
586 (if (and (= nest 1) (null firstp)) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
587 (setq firstp (cons dollar (point))))) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
588 (if (= (% nest 2) 1) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
589 (throw 'dollar firstp)))))))))) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
590 |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
591 (defun YaTeX-mark-mathenv () |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
592 "Mark current mathematic environment." |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
593 (interactive) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
594 (let ((mmp (YaTeX-in-math-mode-p)) type bpt) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
595 (if (or (null mmp) (not (stringp (setq type (car mmp))))) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
596 nil ;if nil or not string, do nothing |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
597 (setq bpt (cdr mmp)) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
598 (goto-char bpt) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
599 (cond |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
600 ((string-match "\\$" type) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
601 (set-mark-command nil) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
602 (skip-chars-forward "$") |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
603 (YaTeX-search-active-forward |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
604 type YaTeX-comment-prefix nil) ;if it cause error, obey it |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
605 (goto-char (match-end 0))) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
606 ;; |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
607 ((string-match "^\\\\[\\[(]" type) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
608 (set-mark-command nil) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
609 (YaTeX-goto-corresponding-leftright) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
610 (skip-chars-forward "])\\\\")) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
611 ;; |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
612 ((string-match "^[a-z]" type) ; \begin\end type math |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
613 (set-mark-command nil) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
614 (YaTeX-goto-corresponding-environment) |
8703f090c628
`[prefix] t e' for YaTeX-typeset-environment.
yuuji@gentei.org
parents:
128
diff
changeset
|
615 (goto-char (match-end 0))))))) |
23 | 616 |
11 | 617 (defun YaTeX-math-display-list (list cols) |
618 (goto-char (point-max)) | |
619 (if (= cols 0) (if (not (eolp)) (newline 1)) | |
620 (forward-line -1) | |
621 (while (looking-at "[ \t\n]") (forward-line -1))) | |
622 (end-of-line) | |
623 (let ((indent (* YaTeX-math-display-width cols)) sign str to) | |
624 (indent-to indent) | |
625 (insert (car list)) | |
626 (indent-to (setq indent (+ indent YaTeX-math-max-key))) | |
627 (insert "\\" (car (cdr list))) | |
628 (setq indent (+ indent YaTeX-math-max-seq)) | |
629 (setq sign (YaTeX-math-get-sign list)) | |
13 | 630 (while (and sign (not (string= "" sign))) |
11 | 631 (setq to (string-match "\n" sign) |
632 str (if to (substring sign 0 to) sign)) | |
633 (end-of-line) | |
634 (indent-to indent) | |
635 (insert str) | |
636 (cond ((eobp) (newline 1)) | |
637 ((> cols 0) (forward-line 1))) | |
638 (setq sign (if to (substring sign (1+ to)) ""))))) | |
639 | |
640 (defvar YaTeX-math-menu-buffer "*math-mode-signs*") | |
641 | |
642 (defun YaTeX-math-show-menu (match-str) | |
643 (save-window-excursion | |
59 | 644 (YaTeX-showup-buffer YaTeX-math-menu-buffer nil t) |
70 | 645 (let ((maxcols (max 1 (/ (YaTeX-screen-width) YaTeX-math-sign-width))) |
11 | 646 (case-fold-search nil) |
13 | 647 (cols 0) (list alist) command) |
11 | 648 (erase-buffer) |
13 | 649 (insert |
650 "Candidates of sign. [n:next p:prev f:forw b:back q:quit RET:select]\n") | |
11 | 651 (insert YaTeX-math-indicator "\t") |
652 (insert YaTeX-math-indicator) | |
653 (newline 1) | |
70 | 654 (insert-char ?- (1- (YaTeX-screen-width))) |
11 | 655 (newline 1) |
656 (while list | |
657 (if (string-match match-str (car (car list))) | |
658 (progn (YaTeX-math-display-list (car list) cols) | |
659 (setq cols (% (1+ cols) maxcols)))) | |
660 (setq list (cdr list))) | |
178 | 661 (goto-char (point-min)) (forward-line 3) |
11 | 662 (use-local-map YaTeX-math-menu-map) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
663 (setq buffer-read-only t) |
11 | 664 (unwind-protect |
665 (recursive-edit) | |
666 (skip-chars-backward "^ \t\n") | |
667 (setq command | |
668 (if (re-search-forward YaTeX-math-cmd-regexp nil t) | |
669 (buffer-substring | |
670 (match-beginning 0) | |
671 (prog2 (skip-chars-forward "^ \t\n") (point))) | |
672 nil)) | |
673 (kill-buffer YaTeX-math-menu-buffer)) | |
80 | 674 command))) |
11 | 675 |
676 (defun YaTeX-math-show-image (image &optional exit-char) | |
677 "Momentarily display IMAGE at the beginning of the next line; | |
678 erase it on the next keystroke. The window is recentered if necessary | |
679 to make the whole string visible. If the window isn't large enough, | |
680 at least you get to read the beginning." | |
13 | 681 (if (and image (not (string= image ""))) |
682 (let ((buffer-read-only nil) | |
683 (modified (buffer-modified-p)) | |
684 (name buffer-file-name) | |
685 insert-start | |
686 insert-end) | |
687 (unwind-protect | |
688 (progn | |
689 (save-excursion | |
690 ;; defeat file locking... don't try this at home, kids! | |
691 (setq buffer-file-name nil) | |
692 (forward-line 1) | |
693 (setq insert-start (point)) | |
694 (if (eobp) (newline)) | |
695 (insert image) | |
696 (setq insert-end (point))) | |
697 ; make sure the whole string is visible | |
698 (if (not (pos-visible-in-window-p insert-end)) | |
699 (recenter (max 0 | |
700 (- (window-height) | |
701 (count-lines insert-start insert-end) | |
702 2)))) | |
703 (let ((char (read-char))) | |
704 (or (eq char exit-char) | |
292
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
705 (if (boundp 'unread-command-events) |
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
706 (setq unread-command-events (list char)) |
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
707 (setq unread-command-char char))))) |
13 | 708 (if insert-end |
709 (save-excursion | |
710 (delete-region insert-start insert-end))) | |
711 (setq buffer-file-name name) | |
712 (set-buffer-modified-p modified))))) | |
11 | 713 |
52 | 714 (defun YaTeX-math-insert-sequence (&optional force initial) |
23 | 715 "Insert math-mode sequence with image completion." |
716 (interactive "P") | |
52 | 717 (let*((key (or initial "")) regkey str last-char list i |
13 | 718 (case-fold-search nil) match sign |
290
1a4332ecc58b
For emacs-24.3+ and NEmacs(last-command-{char,event} handling)
HIROSE Yuuji <yuuji@gentei.org>
parents:
287
diff
changeset
|
719 (this-key (char-to-string (YaTeX-last-key))) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
720 (alistsym (cdr (assoc this-key YaTeX-math-key-list))) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
721 (alistname (symbol-name alistsym)) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
722 (alist (symbol-value alistsym)) |
13 | 723 (n (length alist)) (beg (point)) result) |
52 | 724 (if initial (insert YaTeX-ec (car (cdr (assoc initial alist))))) |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
725 (if (string-match "^YaTeX-" alistname) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
726 (setq alistname (substring alistname (length "YaTeX-")))) |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
727 (setq alistname (substring alistname 0 (string-match "-" alistname))) |
11 | 728 (setq result |
729 (catch 'complete | |
23 | 730 (if (and (not force) |
51 | 731 (if YaTeX-auto-math-mode |
732 (not (YaTeX-in-math-mode-p)) | |
733 (not YaTeX-math-mode))) | |
23 | 734 (throw 'complete 'escape));this tag should be exit, but... |
11 | 735 (while t |
60
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
736 (message "%ssequence%s: %s" |
9e08ed569d80
yahtml: change keystroke of calling browser to [prefix] t p
yuuji
parents:
59
diff
changeset
|
737 (if YaTeX-simple-messages "" (concat alistname " ")) |
56 | 738 (if YaTeX-simple-messages "" "(TAB for menu)") key) |
11 | 739 (setq last-char (read-char) |
740 key (concat key (char-to-string last-char)) | |
13 | 741 i 0) |
11 | 742 (cond |
13 | 743 ((string= key this-key) ;;invoke key itself |
11 | 744 (throw 'complete 'escape)) |
13 | 745 ((string= key YaTeX-math-exit-key) ;;exit from math-mode |
746 (throw 'complete 'exit)) | |
23 | 747 ((string-match "\r" key) ;;RET = kakutei |
748 (throw 'complete 'select)) | |
749 ((string-match "[\C-g\C-c]" key) ;;C-g = abort | |
750 (throw 'complete 'abort)) | |
751 ((string-match "[\t\n]" key) ;;TAB, LFD = menu | |
752 (throw 'complete 'menu)) | |
753 ((string-match "[\C-h\C-?]" key) ;;BS, DEL = BS | |
754 (if (< (length key) 2) (throw 'complete 'abort)) | |
13 | 755 (setq key (substring key 0 -2)))) |
756 | |
757 (setq regkey (concat "^" (regexp-quote key))) | |
56 | 758 (message "Sequence%s: %s" |
759 (if YaTeX-simple-messages "" "(TAB for menu)") key) | |
11 | 760 (if |
761 (catch 'found | |
762 ;;(1)input string strictly matches with alist | |
23 | 763 (setq match (assoc key alist)) |
764 ;;remember previous match | |
765 | |
11 | 766 ;;(2)search partial match into alist |
13 | 767 (setq list alist) |
11 | 768 (while (< i n) |
769 (if (string-match | |
13 | 770 regkey |
771 ;;(aref array i) | |
772 ;;(car (nth i alist)) | |
23 | 773 (car (car list))) |
11 | 774 (progn |
775 (or match | |
13 | 776 ;;(setq match (nth i alist)) |
777 (setq match (car list))) | |
11 | 778 (throw 'found t))) |
13 | 779 (setq i (1+ i) list (cdr list)))) ;catch 'found |
11 | 780 nil ;;if any match, continue reading |
781 ;;else reading of sequence has been done. | |
782 (message "complete.") | |
23 | 783 (throw 'complete t)) |
784 | |
11 | 785 (if match |
786 (progn (delete-region beg (point)) | |
80 | 787 (setq YaTeX-single-command (car (cdr match))) |
788 (insert YaTeX-ec YaTeX-single-command) | |
13 | 789 (if (and YaTeX-math-need-image |
790 (setq sign (YaTeX-math-get-sign match))) | |
791 (YaTeX-math-show-image (concat sign "\n"))) | |
11 | 792 ) |
793 nil) | |
794 ))) | |
68 | 795 (delete-region beg (point)) |
11 | 796 (cond |
68 | 797 ((memq result '(t select)) |
798 (if (eq result t) | |
292
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
799 (if (boundp 'unread-command-events) |
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
800 (setq unread-command-events (list last-char)) |
e1c1616c4f07
Use unread-command-events when bound.
HIROSE Yuuji <yuuji@gentei.org>
parents:
290
diff
changeset
|
801 (setq unread-command-char last-char)) |
68 | 802 (message "Done.")) |
80 | 803 (if (assoc YaTeX-single-command section-table) |
804 (YaTeX-make-section nil nil nil YaTeX-single-command) | |
68 | 805 (setq YaTeX-current-completion-type 'maketitle) |
80 | 806 (YaTeX-make-singlecmd YaTeX-single-command))) |
11 | 807 ((eq result 'abort) |
808 (message "Abort.")) | |
809 ((eq result 'escape) | |
80 | 810 (call-interactively (lookup-key global-map this-key))) |
13 | 811 ((eq result 'exit) |
812 (YaTeX-toggle-math-mode)) | |
11 | 813 ((eq result 'menu) |
814 (setq key (concat "^" (regexp-quote (substring key 0 -1)))) | |
68 | 815 (insert (YaTeX-math-show-menu key)))))) |
52 | 816 |
817 ;; ----- Change image completion types ----- | |
818 (defun YaTeX-math-member-p (item) | |
819 "Check if ITEM is a member of image completion. | |
820 If so return the cons of its invocation key and image-string." | |
821 (let ((lists YaTeX-math-key-list) list) | |
822 (catch 'found | |
823 (while lists | |
824 (setq list (symbol-value (cdr (car lists)))) | |
825 (while list | |
826 (if (string= item (nth 1 (car list))) | |
827 (throw 'found (cons (car (car lists)) (nth 0 (car list))))) | |
828 (setq list (cdr list))) | |
829 (setq lists (cdr lists)))))) | |
830 | |
193 | 831 ;;; ----- for AMS LaTeX (by matsu<at>math.s.chiba-u.ac.jp) ----- |
69 | 832 (defvar YaTeX-ams-paren-modifier |
833 '(("Biggl" . "Biggr") ("biggl" . "biggr") | |
834 ("Bigl" . "Bigr") ("bigl" . "bigr") | |
835 ("left" . "right") ("" . "")) | |
836 "Alist of modifier of parentheses.") | |
837 | |
838 (defvar YaTeX-left-paren "(\\|\\[\\|\\\\{") | |
839 (defvar YaTeX-right-paren ")\\|\\]\\|\\\\}") | |
840 (defvar YaTeX-paren | |
841 (concat YaTeX-left-paren "\\|" YaTeX-right-paren)) | |
842 | |
843 (defun YaTeX-on-parenthesis-p () | |
844 "If cursor is on an (AMS-LaTeX) parenthesis, return the parenthesis." | |
845 (interactive) | |
846 (let* ((list YaTeX-ams-paren-modifier) | |
847 (longest 0) ;; the longest length of parenthesis command strings | |
848 (flag t) ;; flag for whether on braces not following \ | |
849 (point (point)) | |
850 (move 0) | |
851 (paren)) | |
852 (while list | |
853 (setq longest | |
854 (max longest (length (car (car list))) (length (cdr (car list))))) | |
855 (setq list (cdr list))) | |
856 (save-excursion | |
857 ;; search {} and, if it does not follow `\', set flag nil. | |
858 ;; if it is right after `\', set flag t and move to the position of \. | |
859 ;; mmmmm. | |
860 (if (looking-at "{\\|}") | |
861 (if (not (equal (char-after (1- (point))) 92)) | |
862 (setq flag nil) | |
863 (forward-char -1))) | |
864 ;; if flag is nil, do nothing. | |
865 (if (and flag (re-search-forward YaTeX-paren | |
866 (+ (point) 3 longest) t)) | |
867 (progn | |
868 (setq move (- (point) point)) | |
80 | 869 (setq paren (YaTeX-match-string 0)) |
69 | 870 (setq list YaTeX-ams-paren-modifier) |
871 ;; criterion for whether on [] () \{\} or not. | |
872 (if (string-match YaTeX-left-paren paren) | |
873 (while (and list flag) | |
874 (let* ((mod (car (car list))) | |
875 (mod-length 0) ;; length of modifier | |
876 paren-regexp ;; regexp of paren. | |
877 mod-regexp) ;; regexp of modifier. | |
878 (if (> (length mod) 0) | |
879 (setq mod-regexp (concat "\\\\" mod) | |
880 mod-length (1+ (length mod)))) | |
881 (cond ((string= paren "\\{") | |
882 (setq paren-regexp (concat "\\" paren))) | |
883 ((string= paren "[") | |
884 (setq paren-regexp "\\[")) | |
885 (t (setq paren-regexp paren))) | |
886 (save-excursion | |
887 (if (and (>= (- (point) (point-min)) | |
888 (+ mod-length (length paren))) | |
889 (not (forward-char | |
890 (- 0 mod-length (length paren)))) | |
891 (looking-at (concat "\\(" mod-regexp "\\)\\(" | |
892 paren-regexp "\\)"))) | |
893 (setq flag nil))) | |
894 (setq list (cdr list)))) | |
895 (while (and list flag) | |
896 (let* ((mod (cdr (car list))) | |
897 (mod-length 0) | |
898 paren-regexp | |
899 mod-regexp) | |
900 (if (> (length mod) 0) | |
901 (setq mod-regexp (concat "\\\\" mod) | |
902 mod-length (1+ (length mod)))) | |
903 (cond ((string= paren "\\}") | |
904 (setq paren-regexp (concat "\\" paren))) | |
905 ((string= paren "]") | |
906 (setq paren-regexp "\\]")) | |
907 (t (setq paren-regexp paren))) | |
908 (save-excursion | |
909 (if (and (>= (- (point) (point-min)) | |
910 (+ mod-length (length paren))) | |
911 (not (forward-char | |
912 (- 0 mod-length (length paren)))) | |
913 (looking-at (concat "\\(" mod-regexp "\\)\\(" | |
914 paren-regexp "\\)"))) | |
915 (setq flag nil))) | |
916 (setq list (cdr list))))) | |
80 | 917 (if (<= move (length (YaTeX-match-string 0))) |
918 (YaTeX-match-string 0))))))) | |
69 | 919 |
77 | 920 (defun YaTeX-goto-open-paren (&optional jumpto-co) |
921 "Jump to the exact position of open parenthesis. | |
922 If optional argument JUMPTO-CO is non-nil, goto corresponding parentheses." | |
69 | 923 (interactive) |
924 (let ((paren) | |
925 (backslash-syntax (char-to-string (char-syntax ?\\)))) | |
926 (if (setq paren (YaTeX-on-parenthesis-p)) | |
927 (if (string-match "(\\|{\\|\\[" paren (1- (length paren))) | |
928 (progn | |
929 (re-search-forward "(\\|{\\|\\[" (+ (point) (length paren)) t) | |
77 | 930 (backward-char) |
931 (if jumpto-co | |
932 (unwind-protect | |
933 (progn | |
934 (modify-syntax-entry ?\\ " ") | |
935 (forward-list) | |
936 (backward-char)) | |
937 (modify-syntax-entry ?\\ backslash-syntax))) | |
938 (point)) | |
69 | 939 (re-search-forward ")\\|}\\|\\]" (+ (point) (length paren)) t) |
940 (unwind-protect | |
941 (progn | |
942 (modify-syntax-entry ?\\ " ") | |
77 | 943 (backward-list) |
944 (point)) | |
69 | 945 (modify-syntax-entry ?\\ backslash-syntax)))))) |
946 | |
77 | 947 ;;;###autoload |
948 (defun YaTeX-goto-corresponding-paren () | |
949 "Go to corresponding mathematical parentheses." | |
950 (if (YaTeX-on-parenthesis-p) | |
951 (YaTeX-goto-open-paren t) | |
952 nil)) | |
953 | |
69 | 954 (defun YaTeX-change-parentheses () |
955 "Change the size of parentheses, braces, and brackets of AMS-LaTeX." | |
956 (interactive) | |
957 (if (not (and YaTeX-use-AMS-LaTeX (YaTeX-on-parenthesis-p))) | |
958 nil | |
80 | 959 (let* ((mod (YaTeX-match-string 1)) ;; modifier |
960 (paren (if mod (YaTeX-match-string 2) (YaTeX-match-string 0))) ;; paren | |
69 | 961 (mod-length (if (or (string= mod "\\left") (string= mod "\\right")) |
962 5 ;; 5 in case left or right | |
963 (length mod))) ;; length of modifier | |
964 (paren-length (length paren)) ;; length of paren | |
965 (length (+ mod-length paren-length)) ;; length of whole string | |
966 (big-p t) ;; flag whether new modifier is "[Bb]ig+" or not. | |
967 size ;; left, big, Big etc. | |
77 | 968 type ;; parentheses type |
69 | 969 lr ;; "l" or "r". |
970 char newsize newsize-length | |
971 (backslash-syntax (char-to-string (char-syntax ?\\))) | |
972 (case-fold-search)) | |
973 ;; decide lr and size from mod and paren. | |
974 (cond ((string-match "\\(\\\\[Bb]ig+\\)[lr]" mod) | |
975 (setq size (substring mod 1 (match-end 1)) | |
976 lr (substring mod (match-end 1) (match-end 0)))) | |
977 ((string-match "\\\\left" mod) | |
978 (setq size "left-right" lr "l")) | |
979 ((string-match "\\\\right" mod) | |
980 (setq size "left-right" lr "r")) | |
981 ((string-match "(\\|\\[\\|\\\\{" paren) | |
982 (setq size "null" lr "l")) | |
983 ((string-match ")\\|\\]\\|\\\\}" paren) | |
984 (setq size "null" lr "r")) | |
985 (t | |
986 (setq size nil lr nil))) | |
987 (while (not newsize) | |
527
af4601ee3c6a
Format() function don't need message()
HIROSE Yuuji <yuuji@gentei.org>
parents:
497
diff
changeset
|
988 (message (concat "Change from %s: " |
69 | 989 "l(big) L(Big) h(bigg) H(Bigg) " |
527
af4601ee3c6a
Format() function don't need message()
HIROSE Yuuji <yuuji@gentei.org>
parents:
497
diff
changeset
|
990 "r(left-right) n(NONE) ( { [") size) |
69 | 991 (setq char (read-char) |
992 newsize (cond ((char-equal char ?l) "\\big") | |
993 ((char-equal char ?L) "\\Big") | |
994 ((char-equal char ?h) "\\bigg") | |
995 ((char-equal char ?H) "\\Bigg") | |
996 ((char-equal char ?r) | |
997 (setq big-p nil) "\\left") | |
77 | 998 ((memq char '(?\( ?\))) |
999 (setq big-p nil type '("(" . ")")) "") | |
1000 ((memq char '(?\{ ?\})) | |
1001 (setq big-p nil type '("\\{" . "\\}")) "") | |
1002 ((memq char '(?\[ ?\])) | |
1003 (setq big-p nil type '("[" . "]")) "") | |
69 | 1004 ((char-equal char ?n) |
1005 (setq big-p nil) "") | |
1006 (t nil)) | |
1007 newsize-length (length newsize))) | |
1008 (YaTeX-goto-open-paren) | |
1009 (forward-char) | |
77 | 1010 (cond |
1011 (type | |
1012 (delete-region (point) (- (point) paren-length)) | |
1013 (save-excursion (insert (car type)))) | |
1014 (t | |
1015 (delete-region (- (point) length) (- (point) paren-length)) | |
1016 (backward-char paren-length))) | |
558
a2ef47ba407f
Why 'insert-string was used??
HIROSE Yuuji <yuuji@gentei.org>
parents:
527
diff
changeset
|
1017 (insert newsize) |
69 | 1018 (if big-p (insert ?l)) |
1019 (unwind-protect | |
1020 (progn | |
1021 (modify-syntax-entry ?\\ " ") | |
1022 (forward-list) | |
1023 (if (string= size "left-right") (setq length (1+ length))) | |
1024 (if (eq char ?r) (setq newsize "\\right")) | |
77 | 1025 (cond |
1026 (type | |
1027 (delete-region (point) (- (point) paren-length)) | |
1028 (insert (cdr type))) | |
1029 (t | |
1030 (delete-region (- (point) length) (- (point) paren-length)) | |
1031 (backward-char paren-length) | |
558
a2ef47ba407f
Why 'insert-string was used??
HIROSE Yuuji <yuuji@gentei.org>
parents:
527
diff
changeset
|
1032 (insert newsize) |
77 | 1033 (if big-p (insert ?r)) |
1034 (forward-char paren-length))) | |
69 | 1035 (if (string= lr "l") (backward-list))) |
1036 (modify-syntax-entry ?\\ backslash-syntax)) | |
1037 t))) | |
1038 | |
1039 (defun YaTeX-insert-amsparens-region (beg end char) | |
1040 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") | |
1041 (let* ((case-fold-search) | |
1042 (st (cond ((char-equal char ?l) "big") | |
1043 ((char-equal char ?L) "Big") | |
1044 ((char-equal char ?h) "bigg") | |
1045 ((char-equal char ?H) "Bigg")))) | |
1046 (if st | |
1047 (YaTeX-insert-braces-region | |
1048 beg end (concat "\\" st "l(") (concat "\\" st "r)")) | |
1049 (YaTeX-insert-braces-region beg end "(" ")")))) | |
1050 | |
1051 (defun YaTeX-insert-amsbraces-region (beg end char) | |
1052 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") | |
1053 (let* ((case-fold-search) | |
1054 (st (cond ((char-equal char ?l) "big") | |
1055 ((char-equal char ?L) "Big") | |
1056 ((char-equal char ?h) "bigg") | |
1057 ((char-equal char ?H) "Bigg")))) | |
1058 (if st | |
1059 (YaTeX-insert-braces-region | |
1060 beg end (concat "\\" st "l\\{") (concat "\\" st "r\\}")) | |
1061 (YaTeX-insert-braces-region beg end "\\{" "\\}")))) | |
1062 | |
1063 (defun YaTeX-insert-amsbrackets-region (beg end char) | |
1064 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ") | |
1065 (let* ((case-fold-search) | |
1066 (st (cond ((char-equal char ?l) "big") | |
1067 ((char-equal char ?L) "Big") | |
1068 ((char-equal char ?h) "bigg") | |
1069 ((char-equal char ?H) "Bigg")))) | |
1070 (if st | |
1071 (YaTeX-insert-braces-region | |
1072 beg end (concat "\\" st "l[") (concat "\\" st "r]")) | |
1073 (YaTeX-insert-braces-region beg end "[" "]")))) | |
1074 | |
1075 | |
11 | 1076 ;; |
1077 (provide 'yatexmth) | |
13 | 1078 |
1079 ; Local variables: | |
1080 ; fill-prefix: ";;; " | |
1081 ; paragraph-start: "^$\\|\\|;;;$" | |
1082 ; paragraph-separate: "^$\\|\\|;;;$" | |
1083 ; End: |