yatex

view yatexmth.el @ 441:564510b9caca

Add verbatim package for verbatiminput macro
author HIROSE Yuuji <yuuji@gentei.org>
date Sun, 09 Oct 2016 15:58:27 +0859
parents 627a7b77a39d
children 7a9d30752353
line source
1 ;;; yatexmth.el --- YaTeX math-mode-specific functions -*- coding: sjis -*-
2 ;;;
3 ;;; (c)1993-2015 by HIROSE Yuuji [yuuji@yatex.org]
4 ;;; Last modified Sun Jul 12 10:02:36 2015 on firestorm
5 ;;; $Id$
7 ;;; Commentary:
8 ;;; [Customization guide]
9 ;;;
10 ;;; By default, you can use two completion groups in YaTeX math
11 ;;; mode, `;' for mathematical signs and `:' for greek letters. But
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
15 ;;; completion as follows(prefix key is `,'):
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 ;;;
27 ;;; Typing `s' after `,' makes `\sin', `hs' after `,' makes `\sinh'
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
41 ;;; '(("," . YaTeX-math-funcs-list)
42 ;;; ("'" . Other-List-if-any)))
43 ;;;
44 ;;; Put these expressions into your ~/.emacs, and you can use this
45 ;;; completion in the math-mode.
46 ;;;
47 ;;; And you can add your favorite completion sequences to the
48 ;;; default completion list invoked with `;', by defining those lists
49 ;;; into variable YaTeX-math-sign-alist-private.
51 ;;; 【イメージ補完の追加方法】
52 ;;;
53 ;;; 標準のイメージ補完では、「;」で始まる数式記号補完と、「:」で始
54 ;;; まるギリシャ文字補完が使用可能ですが、これ以外の文字で始まる補完
55 ;;; シリーズも定義することができます。例えば、「,」で始まる次のよう
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 ;;;
68 ;;; 「,」のあとに s を押すと \sin が、hs を押すと \sinh が入力されま
69 ;;; す。このような補完リストの登録は以下のようにします(変数名は任意)。
70 ;;;
71 ;;; (setq YaTeX-math-funcs-list
72 ;;; '(("s" "sin")
73 ;;; ("S" "arcsin")
74 ;;; :
75 ;;; ("hs" "sinh")))
76 ;;;
77 ;;; さらに、「,」を押した時にイメージ補完が始まるよう次の変数に、起動キー
78 ;;; と上で定義した補完用変数の登録を行ないます。
79 ;;;
80 ;;; (setq YaTeX-math-key-list-private
81 ;;; '(("," . YaTeX-math-funcs-list)
82 ;;; ("'" . ほかに定義したいシリーズがあれば…)))
83 ;;;
84 ;;; これらを ~/.emacs に書いておけば、math-mode で自分専用のイメージ
85 ;;; 補完が利用できます。
87 ;;; Code:
88 (defvar YaTeX-jisold
89 (and (boundp 'dos-machine-type)
90 (eq dos-machine-type 'pc98)))
92 (defmacro YaTeX-setq-math-sym (sym old new)
93 (list 'setq sym (list 'if 'YaTeX-jisold old new)))
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" "♭")
110 (YaTeX-setq-math-sym YaTeX-image-sqrt "" "√")
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  ̄"))
117 (defvar
118 YaTeX-math-sign-alist-default
119 '(
120 ;frequently used
121 ("||" "|" ("||" "‖"))
122 ("sum" "sum" ("\\-+\n >\n/-+" "Σ"))
123 ("sigma" "sum" ("\\-+\n >\n/-+" "Σ"))
124 ("integral" "int" (" /\\\n \\\n\\/" YaTeX-image-int))
125 ("ointegral" "oint" " /\\\n(\\)\n\\/")
126 ("sqrt" "sqrt" (" __\n,/" YaTeX-image-sqrt))
127 ("root" "sqrt" (" __\n,/" YaTeX-image-sqrt))
128 ("A" "forall" "|_|\nV")
129 ("E" "exists" "-+\n-+\n-+")
130 ("!" "neg" ("--+\n |" YaTeX-image-neg))
131 ("oo" "infty" ("oo" "∞"))
132 ("\\" "backslash" ("\\" "\"))
133 ("..." "cdots" ("..." "…"))
135 ;;binary operators
136 ("+-" "pm" ("+\n-" "±"))
137 ("-+" "mp" "-\n+")
138 ("x" "times" ("x" "×"))
139 ("/" "div" (",\n-\n'" "÷"))
140 ("f" "frac" "xxx\n---\nyyy" "÷")
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" "<>")
156 ("/\\-" "bigtriangleup" ("/\\\n~~" "△"))
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")
170 ("t" "dagger" ("+\n|" YaTeX-image-dagger))
171 ("tt" "ddagger" ("+\n+\n|" YaTeX-image-ddagger))
172 ("II" "amalg" "II")
173 ; :
174 ;;relational operators
175 ("<" "leq" ("<\n-" "<\n-"))
176 ("=<" "leqq" ("<\n=" "≦"))
177 (">" "geq" (">\n-" ">\n-"))
178 (">=" "geqq" (">\n=" "≧"))
179 ("=:" "fallingdotseq" (".\n==\n ." "≒"))
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))
187 ("[" "sqsubset" "[")
188 ("[-" "sqsubseteq" "[\n~")
189 ("]" "sqsupset" "]")
190 ("]-" "sqsupseteq" "]\n~")
191 ("{" "in" ("(-" YaTeX-image-in))
192 ("}" "ni" ("-)" YaTeX-image-ni))
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" ("<<" "《"))
214 ("<<" "lll" "<<<")
215 (">>" "gg" (">>" "》"))
216 (">>>" "ggg" ">>>")
217 ; :
218 ;;arrows
219 ("<-" "leftarrow" ("<-" "←"))
220 ("\C-b" "leftarrow" ("<-" "←"))
221 ("<--" "longleftarrow" ("<--" "←--"))
222 ("<=" "Leftarrow" "<=")
223 ("<==" "Longleftarrow" "<==")
224 ("->" "rightarrow" ("->" "→"))
225 ("\C-f" "rightarrow" ("->" "→"))
226 ("-->" "longrightarrow" ("-->" "--→"))
227 ("=>" "Rightarrow" "=>")
228 ("==>" "Longrightarrow" "==>")
229 ("<->" "leftrightarrow" ("<->" "←→"))
230 ("<-->" "longleftrightarrow" ("<---->" "←--→"))
231 ("<=>" "Leftrightarrow" "<=>")
232 ("<==>" "Longleftrightarrow" "<==>")
233 ("^|" "uparrow" ("^\n|" "↑"))
234 ("\C-p" "uparrow" ("^\n|" "↑"))
235 ("^||" "Uparrow" "/\\\n||")
236 ("\C-n" "downarrow" ("|\nv" "↓"))
237 ("v|" "downarrow" ("|\nv" "↓"))
238 ("v||" "Downarrow" "||\n\\/")
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)
251 ("|->" "mapsto" ("|->" "|→"))
252 ("<-)" "hookleftarrow" (" ,\n<--+" " ヽ\n<--/"))
253 ("(->" "hookrightarrow" ("`\n+-->" "/\n\-->"))
254 ("/-" "leftharpoonup" "/\n~~~")
255 ("\\-" "leftharpoondown" "__\n\\")
256 ("-/" "rightharpoondown" "__\n/")
257 ("-\\" "rightharpoonup" "~~\n\\")
258 ;;left and right
259 ("left" "left" "(leftmark)")
260 ("right" "right" "(rightmark)")
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
286 ("angle" "angle" ("/\n~" "∠"))
287 ("/_" "angle" ("/\n~" "∠"))
288 ("Z" "aleph" "|\\|")
289 ("|\\|" "aleph" "|\\|")
290 ("h-" "hbar" "_\nh")
291 ; ("i" "imath" "i") ;These chars are appeared only
292 ; ("j" "jmath" "j") ;as section-type arguments
293 ("l" "ell" "l")
294 ("wp" "wp" "???")
295 ("R" "Re" ")R")
296 ("Im" "Im" "???")
297 ("mho" "mho" "~|_|~")
298 ("'" "prime" "'")
299 ("0" "emptyset" "0")
300 ("nabla" "nabla" ("___\n\\\\/" YaTeX-image-nabla))
301 ("\\/" "surd" "-\\/")
302 ("surd" "surd" "-\\/")
303 ("top" "top" "T")
304 ("bot" "bot" ("_|_" YaTeX-image-bot))
305 ("b" "flat" ("b" YaTeX-image-flat))
306 ("LT" "natural" "|\nLT\n |")
307 ("6" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial))
308 ("partial" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial))
309 ("round" "partial" (" -+\n+-+\n+-+" YaTeX-image-partial))
310 ("[]" "Box" "[]")
311 ("no" "notag" "\\notag")
312 (":" "colon" ":")
313 (".'." "therefore" (".'." "∴"))
314 ("'.'" "because" ("'.'" "∵"))
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 /\\")
321 ("mi" "mathit" "\\mathit{}")
322 ("mr" "mathrm" "\\mathrm{}")
323 ("mb" "mathbf" "\\mathbf{}")
324 ("mt" "mathtt" "\\mathtt{}")
325 ("ms" "mathsf" "\\mathsf{}")
326 ("mc" "mathcal" "\\mathcal{}")
327 ("mn" "mathnormal" "\\mathnormal{}")
328 )
329 "Default LaTeX-math-command alist.")
331 (defvar YaTeX-math-sign-alist-private nil
332 "*User definable key vs LaTeX-math-command alist.")
334 (defvar YaTeX-math-quit-with-strict-match nil
335 "*T for quitting completion as soon as strict-match is found.")
336 (defvar YaTeX-math-sign-alist
337 (append YaTeX-math-sign-alist-private YaTeX-math-sign-alist-default))
339 ;;(defun YaTeX-math-alist2array (alist array)
340 ;; (set array
341 ;; (let ((array (make-vector (length alist) "")) (list alist) (i 0))
342 ;; (while list
343 ;; (aset array i (car (car list)))
344 ;; (setq i (1+ i) list (cdr list)))
345 ;; array))
346 ;;)
348 (defvar YaTeX-greek-key-alist-default
349 '(
350 ("a" "alpha" ("a" "α"))
351 ("b" "beta" ("|>\n|>\n|" "β"))
352 ("g" "gamma" ("~r" "γ"))
353 ("G" "Gamma" ("|~" "Γ"))
354 ("d" "delta" ("<~\n<>" "δ"))
355 ("D" "Delta" ("/\\\n~~" "Δ"))
356 ("e" "epsilon" "<\n<~")
357 ("e-" "varepsilon" ("(\n(~" "ε"))
358 ("z" "zeta" ("(~\n >" "ζ"))
359 ("et" "eta" ("n\n/" "η"))
360 ("th" "theta" ("8" "θ"))
361 ("Th" "Theta" ("(8)" "Θ"))
362 ("th-" "vartheta" ("-8" "-θ"))
363 ("i" "iota" ("i\n\\_/" "ι"))
364 ("k" "kappa" ("k" "κ"))
365 ("l" "lambda" ("\\n/\\" "λ"))
366 ("L" "Lambda" ("/\\" "Λ"))
367 ("m" "mu" (" u_\n/" "μ"))
368 ("n" "nu" ("|/" "ν"))
369 ("x" "xi" ("E\n >" "ξ"))
370 ("X" "Xi" ("---\n -\n---" "Ξ"))
371 ("p" "pi" ("__\n)(" "π"))
372 ("P" "Pi" ("__\n||" "Π"))
373 ("p-" "varpi" ("_\nw" "__\nω"))
374 ("r" "rho" ("/O" "ρ"))
375 ("r-" "varrho" ("/O\n~~" "ρ\n~~"))
376 ("s" "sigma" ("o~" "σ"))
377 ("S" "Sigma" ("\\-+\n >\n/-+" "Σ"))
378 ("s-" "varsigma" "(~~ \n>")
379 ("t" "tau" ("__\n(" "τ"))
380 ("u" "upsilon" ("~v" "υ"))
381 ("y" "upsilon" ("~v" "υ"))
382 ("U" "Upsilon" ("~Y~" "Υ"))
383 ("Y" "Upsilon" ("~Y~" "Υ"))
384 ("ph" "phi" (" /\n(/)\n/" "φ"))
385 ("Ph" "Phi" (" _\n(|)\n ~" "Φ"))
386 ("ph-" "varphi" "\\O\n|")
387 ("c" "chi" ("x" "χ"))
388 ("ps" "psi" ("\\|/\\n |" "ψ"))
389 ("Ps" "Psi" (" ~\n\\|/\\n |" "Ψ"))
390 ("o" "omega" ("w" "ω"))
391 ("w" "omega" ("w" "ω"))
392 ("O" "Omega" ("(~)\n~ ~" "Ω"))
393 ("W" "Omega" ("(~)\n~ ~" "Ω"))
394 ("f" "foo")
395 )
396 "Default LaTeX-math-command alist.")
398 (defvar YaTeX-greek-key-alist-private nil
399 "*User definable key vs LaTeX-math-command alist.")
401 (defvar YaTeX-greek-key-alist
402 (append YaTeX-greek-key-alist-private YaTeX-greek-key-alist-default))
404 ;;(mapcar (function (lambda (x) (YaTeX-math-alist2array x)))
405 ;; YaTeX-math-key-list)
407 (defvar YaTeX-math-indicator "KEY\tLaTeX sequence\t\tsign")
409 (defvar YaTeX-math-need-image t
410 "*T for displaying pseudo image momentarily.")
411 (defvar YaTeX-math-max-key 8)
412 (defvar YaTeX-math-max-seq
413 (* 8 (1+ (/ (length "\\longleftrightarrow") 8))))
414 (defvar YaTeX-math-max-sign 5)
415 (defvar YaTeX-math-sign-width
416 (+ YaTeX-math-max-key YaTeX-math-max-seq YaTeX-math-max-sign))
417 (defvar YaTeX-math-display-width
418 (* 8 (1+ (/ YaTeX-math-sign-width 8))))
419 (defvar YaTeX-math-menu-map nil
420 "Keymap used in YaTeX mathematical sign menu mode.")
422 (if YaTeX-math-menu-map nil
423 (setq YaTeX-math-menu-map (make-sparse-keymap))
424 (define-key YaTeX-math-menu-map "n" 'next-line)
425 (define-key YaTeX-math-menu-map "p" 'previous-line)
426 (define-key YaTeX-math-menu-map "f" 'YaTeX-math-forward)
427 (define-key YaTeX-math-menu-map "b" 'YaTeX-math-backward)
428 (define-key YaTeX-math-menu-map "v" 'scroll-up)
429 (define-key YaTeX-math-menu-map " " 'scroll-up)
430 (define-key YaTeX-math-menu-map "c" 'scroll-up)
431 (define-key YaTeX-math-menu-map "V" 'scroll-down)
432 (define-key YaTeX-math-menu-map "r" 'scroll-down)
433 (define-key YaTeX-math-menu-map "\^h" 'scroll-down)
434 (define-key YaTeX-math-menu-map "<" 'beginning-of-buffer)
435 (define-key YaTeX-math-menu-map ">" 'end-of-buffer)
436 (define-key YaTeX-math-menu-map "\^m" 'exit-recursive-edit)
437 (define-key YaTeX-math-menu-map "q" 'abort-recursive-edit))
439 (defvar YaTeX-math-exit-key "\e"
440 "*Key sequence after prefix key of YaTeX-math-mode to exit from math-mode.")
442 (defmacro YaTeX-math-japanese-sign (list)
443 (list 'nth 1 list))
445 (defvar YaTeX-math-cmd-regexp (concat (regexp-quote YaTeX-ec) "[A-z|]"))
447 ;;; alltt goes into YaTeX-verbatim-environments 2011/3/16
448 ;;(defvar YaTeX-math-verbatim-environments
449 ;; '("alltt")
450 ;; "*List of environments in which LaTeX math mode is disabled.
451 ;;This value is appended with YaTeX-verbatim-environments.")
453 ;;;
454 ;;YaTeX math-mode functions
455 ;;;
456 ;;;###autoload
457 (defun YaTeX-toggle-math-mode (&optional arg)
458 (interactive "P")
459 (or (memq 'YaTeX-math-mode mode-line-format) nil
460 (setq mode-line-format
461 (append (list "" 'YaTeX-math-mode) mode-line-format)))
462 (if YaTeX-auto-math-mode nil ;Only effective on manual mode.
463 (if (or arg (null YaTeX-math-mode))
464 (let (keys)
465 (setq YaTeX-math-mode "math:")
466 (message "Turn on math mode. Prefix keys are %s"
467 (mapconcat 'car YaTeX-math-key-list " "))
468 (sit-for 3)
469 (message
470 (concat "To exit from math-mode, type `ESC' after prefix, "
471 "or type `"
472 (key-description
473 (car
474 (where-is-internal
475 'YaTeX-switch-mode-menu YaTeX-mode-map)))
476 " $'")))
477 (setq YaTeX-math-mode nil)
478 (message "Exit from math mode."))
479 (set-buffer-modified-p (buffer-modified-p))))
481 (defun YaTeX-math-forward (arg)
482 (interactive "p")
483 (re-search-forward YaTeX-math-cmd-regexp nil t arg))
485 (defun YaTeX-math-backward (arg)
486 (interactive "p")
487 (re-search-backward YaTeX-math-cmd-regexp nil t arg))
489 (defun YaTeX-math-gets (sign)
490 (cond
491 ((null sign) nil)
492 ((listp sign)
493 (setq sign
494 (cond
495 (YaTeX-japan (YaTeX-math-japanese-sign sign))
496 (t (car sign))))
497 (YaTeX-math-gets sign))
498 ((symbolp sign)
499 (YaTeX-math-gets (symbol-value sign)))
500 (t sign)))
502 (defun YaTeX-math-get-sign (list)
503 (YaTeX-math-gets (car (cdr-safe (cdr-safe list)))))
505 (defvar YaTeX-math-section-type-regexp
506 "eqn\\\\\\sw+\\b"
507 "*Regexp of section-type math-mode macro")
509 (defun YaTeX-in-math-mode-p ()
510 "If current position is supposed to be in LaTeX-math-mode, return t.
511 This function refers a local variable `source-window' in YaTeX-make-section."
512 (save-excursion
513 (and (boundp 'source-window) source-window
514 (set-buffer (window-buffer source-window)))
515 (or (YaTeX-quick-in-environment-p
516 (append
517 '("math" "eqnarray" "equation" "eqnarray*" "displaymath") ;LaTeX
518 (if YaTeX-use-AMS-LaTeX
519 ;; And math modes of AMS-LaTeX
520 ;;'("align" "align*" "split" "multline" "multline*" "gather"
521 ;; "gather*" "aligned*" "gathered" "gathered*" "alignat"
522 ;; "equation*" "cases" "flalign" "flalign*"
523 ;; "alignat*" "xalignat" "xalignat*" "xxalignat" "xxalignat*"
524 YaTeX-math-begin-list
525 )))
526 (let*((p (point)) (nest 0) me0 r firstp dollar
527 (delim (concat YaTeX-sectioning-regexp "\\|^$\\|^\C-l"))
528 (boundary
529 (save-excursion
530 (if (looking-at delim)
531 (goto-char (max (point-min) (1- (point)))))
532 (re-search-backward delim nil 1)
533 (point))))
534 (save-excursion
535 (cond
536 ((catch 'open
537 (save-excursion
538 (while (and (>= nest 0)
539 (re-search-backward
540 (concat YaTeX-ec-regexp ;\
541 "\\([()]\\|[][]\\)") boundary t))
542 (setq me0 (match-end 0))
543 (if (or (YaTeX-on-comment-p)
544 (YaTeX-literal-p)) nil
545 (if (or (= (char-after (1- me0)) ?\))
546 (= (char-after (1- me0)) ?\]))
547 (setq nest (1+ nest))
548 (if (= (preceding-char) ?\\ ) nil ;;\\[5pt]
549 (setq nest (1- nest))))))
550 (if (< nest 0)
551 (throw 'open (cons (YaTeX-match-string 0) (point)))))))
552 ((and (setq r (YaTeX-on-section-command-p
553 YaTeX-math-section-type-regexp))
554 (numberp r)
555 (> r 0))
556 t)
557 (t (catch 'dollar
558 (while ;(search-backward "$" boundary t);little bit fast.
559 (YaTeX-re-search-active-backward ;;;;;; Too slow???
560 "\\$" (concat "[^\\\\]" YaTeX-comment-prefix) boundary t)
561 (setq dollar "$")
562 (cond
563 ((equal (char-after (1- (point))) ?$) ; $$ equation $$
564 (setq dollar "$$")
565 (backward-char 1)
566 (setq nest (1+ nest)))
567 ((YaTeX-literal-p)
568 nil)
569 ((and (equal (char-after (1- (point))) ?\\ )
570 (not (equal (char-after (- (point) 3)) ?\\ )))
571 nil) ;\$
572 (t (setq nest (1+ nest))))
573 (if (and (= nest 1) (null firstp))
574 (setq firstp (cons dollar (point)))))
575 (if (= (% nest 2) 1)
576 (throw 'dollar firstp))))))))))
578 (defun YaTeX-mark-mathenv ()
579 "Mark current mathematic environment."
580 (interactive)
581 (let ((mmp (YaTeX-in-math-mode-p)) type bpt)
582 (if (or (null mmp) (not (stringp (setq type (car mmp)))))
583 nil ;if nil or not string, do nothing
584 (setq bpt (cdr mmp))
585 (goto-char bpt)
586 (cond
587 ((string-match "\\$" type)
588 (set-mark-command nil)
589 (skip-chars-forward "$")
590 (YaTeX-search-active-forward
591 type YaTeX-comment-prefix nil) ;if it cause error, obey it
592 (goto-char (match-end 0)))
593 ;;
594 ((string-match "^\\\\[\\[(]" type)
595 (set-mark-command nil)
596 (YaTeX-goto-corresponding-leftright)
597 (skip-chars-forward "])\\\\"))
598 ;;
599 ((string-match "^[a-z]" type) ; \begin\end type math
600 (set-mark-command nil)
601 (YaTeX-goto-corresponding-environment)
602 (goto-char (match-end 0)))))))
604 (defun YaTeX-math-display-list (list cols)
605 (goto-char (point-max))
606 (if (= cols 0) (if (not (eolp)) (newline 1))
607 (forward-line -1)
608 (while (looking-at "[ \t\n]") (forward-line -1)))
609 (end-of-line)
610 (let ((indent (* YaTeX-math-display-width cols)) sign str to)
611 (indent-to indent)
612 (insert (car list))
613 (indent-to (setq indent (+ indent YaTeX-math-max-key)))
614 (insert "\\" (car (cdr list)))
615 (setq indent (+ indent YaTeX-math-max-seq))
616 (setq sign (YaTeX-math-get-sign list))
617 (while (and sign (not (string= "" sign)))
618 (setq to (string-match "\n" sign)
619 str (if to (substring sign 0 to) sign))
620 (end-of-line)
621 (indent-to indent)
622 (insert str)
623 (cond ((eobp) (newline 1))
624 ((> cols 0) (forward-line 1)))
625 (setq sign (if to (substring sign (1+ to)) "")))))
627 (defvar YaTeX-math-menu-buffer "*math-mode-signs*")
629 (defun YaTeX-math-show-menu (match-str)
630 (save-window-excursion
631 (YaTeX-showup-buffer YaTeX-math-menu-buffer nil t)
632 (let ((maxcols (max 1 (/ (YaTeX-screen-width) YaTeX-math-sign-width)))
633 (case-fold-search nil)
634 (cols 0) (list alist) command)
635 (erase-buffer)
636 (insert
637 "Candidates of sign. [n:next p:prev f:forw b:back q:quit RET:select]\n")
638 (insert YaTeX-math-indicator "\t")
639 (insert YaTeX-math-indicator)
640 (newline 1)
641 (insert-char ?- (1- (YaTeX-screen-width)))
642 (newline 1)
643 (while list
644 (if (string-match match-str (car (car list)))
645 (progn (YaTeX-math-display-list (car list) cols)
646 (setq cols (% (1+ cols) maxcols))))
647 (setq list (cdr list)))
648 (goto-char (point-min)) (forward-line 3)
649 (use-local-map YaTeX-math-menu-map)
650 (setq buffer-read-only t)
651 (unwind-protect
652 (recursive-edit)
653 (skip-chars-backward "^ \t\n")
654 (setq command
655 (if (re-search-forward YaTeX-math-cmd-regexp nil t)
656 (buffer-substring
657 (match-beginning 0)
658 (prog2 (skip-chars-forward "^ \t\n") (point)))
659 nil))
660 (kill-buffer YaTeX-math-menu-buffer))
661 command)))
663 (defun YaTeX-math-show-image (image &optional exit-char)
664 "Momentarily display IMAGE at the beginning of the next line;
665 erase it on the next keystroke. The window is recentered if necessary
666 to make the whole string visible. If the window isn't large enough,
667 at least you get to read the beginning."
668 (if (and image (not (string= image "")))
669 (let ((buffer-read-only nil)
670 (modified (buffer-modified-p))
671 (name buffer-file-name)
672 insert-start
673 insert-end)
674 (unwind-protect
675 (progn
676 (save-excursion
677 ;; defeat file locking... don't try this at home, kids!
678 (setq buffer-file-name nil)
679 (forward-line 1)
680 (setq insert-start (point))
681 (if (eobp) (newline))
682 (insert image)
683 (setq insert-end (point)))
684 ; make sure the whole string is visible
685 (if (not (pos-visible-in-window-p insert-end))
686 (recenter (max 0
687 (- (window-height)
688 (count-lines insert-start insert-end)
689 2))))
690 (let ((char (read-char)))
691 (or (eq char exit-char)
692 (if (boundp 'unread-command-events)
693 (setq unread-command-events (list char))
694 (setq unread-command-char char)))))
695 (if insert-end
696 (save-excursion
697 (delete-region insert-start insert-end)))
698 (setq buffer-file-name name)
699 (set-buffer-modified-p modified)))))
701 (defun YaTeX-math-insert-sequence (&optional force initial)
702 "Insert math-mode sequence with image completion."
703 (interactive "P")
704 (let*((key (or initial "")) regkey str last-char list i
705 (case-fold-search nil) match sign
706 (this-key (char-to-string (YaTeX-last-key)))
707 (alistsym (cdr (assoc this-key YaTeX-math-key-list)))
708 (alistname (symbol-name alistsym))
709 (alist (symbol-value alistsym))
710 (n (length alist)) (beg (point)) result)
711 (if initial (insert YaTeX-ec (car (cdr (assoc initial alist)))))
712 (if (string-match "^YaTeX-" alistname)
713 (setq alistname (substring alistname (length "YaTeX-"))))
714 (setq alistname (substring alistname 0 (string-match "-" alistname)))
715 (setq result
716 (catch 'complete
717 (if (and (not force)
718 (if YaTeX-auto-math-mode
719 (not (YaTeX-in-math-mode-p))
720 (not YaTeX-math-mode)))
721 (throw 'complete 'escape));this tag should be exit, but...
722 (while t
723 (message "%ssequence%s: %s"
724 (if YaTeX-simple-messages "" (concat alistname " "))
725 (if YaTeX-simple-messages "" "(TAB for menu)") key)
726 (setq last-char (read-char)
727 key (concat key (char-to-string last-char))
728 i 0)
729 (cond
730 ((string= key this-key) ;;invoke key itself
731 (throw 'complete 'escape))
732 ((string= key YaTeX-math-exit-key) ;;exit from math-mode
733 (throw 'complete 'exit))
734 ((string-match "\r" key) ;;RET = kakutei
735 (throw 'complete 'select))
736 ((string-match "[\C-g\C-c]" key) ;;C-g = abort
737 (throw 'complete 'abort))
738 ((string-match "[\t\n]" key) ;;TAB, LFD = menu
739 (throw 'complete 'menu))
740 ((string-match "[\C-h\C-?]" key) ;;BS, DEL = BS
741 (if (< (length key) 2) (throw 'complete 'abort))
742 (setq key (substring key 0 -2))))
744 (setq regkey (concat "^" (regexp-quote key)))
745 (message "Sequence%s: %s"
746 (if YaTeX-simple-messages "" "(TAB for menu)") key)
747 (if
748 (catch 'found
749 ;;(1)input string strictly matches with alist
750 (setq match (assoc key alist))
751 ;;remember previous match
753 ;;(2)search partial match into alist
754 (setq list alist)
755 (while (< i n)
756 (if (string-match
757 regkey
758 ;;(aref array i)
759 ;;(car (nth i alist))
760 (car (car list)))
761 (progn
762 (or match
763 ;;(setq match (nth i alist))
764 (setq match (car list)))
765 (throw 'found t)))
766 (setq i (1+ i) list (cdr list)))) ;catch 'found
767 nil ;;if any match, continue reading
768 ;;else reading of sequence has been done.
769 (message "complete.")
770 (throw 'complete t))
772 (if match
773 (progn (delete-region beg (point))
774 (setq YaTeX-single-command (car (cdr match)))
775 (insert YaTeX-ec YaTeX-single-command)
776 (if (and YaTeX-math-need-image
777 (setq sign (YaTeX-math-get-sign match)))
778 (YaTeX-math-show-image (concat sign "\n")))
779 )
780 nil)
781 )))
782 (delete-region beg (point))
783 (cond
784 ((memq result '(t select))
785 (if (eq result t)
786 (if (boundp 'unread-command-events)
787 (setq unread-command-events (list last-char))
788 (setq unread-command-char last-char))
789 (message "Done."))
790 (if (assoc YaTeX-single-command section-table)
791 (YaTeX-make-section nil nil nil YaTeX-single-command)
792 (setq YaTeX-current-completion-type 'maketitle)
793 (YaTeX-make-singlecmd YaTeX-single-command)))
794 ((eq result 'abort)
795 (message "Abort."))
796 ((eq result 'escape)
797 (call-interactively (lookup-key global-map this-key)))
798 ((eq result 'exit)
799 (YaTeX-toggle-math-mode))
800 ((eq result 'menu)
801 (setq key (concat "^" (regexp-quote (substring key 0 -1))))
802 (insert (YaTeX-math-show-menu key))))))
804 ;; ----- Change image completion types -----
805 (defun YaTeX-math-member-p (item)
806 "Check if ITEM is a member of image completion.
807 If so return the cons of its invocation key and image-string."
808 (let ((lists YaTeX-math-key-list) list)
809 (catch 'found
810 (while lists
811 (setq list (symbol-value (cdr (car lists))))
812 (while list
813 (if (string= item (nth 1 (car list)))
814 (throw 'found (cons (car (car lists)) (nth 0 (car list)))))
815 (setq list (cdr list)))
816 (setq lists (cdr lists))))))
818 ;;; ----- for AMS LaTeX (by matsu<at>math.s.chiba-u.ac.jp) -----
819 (defvar YaTeX-ams-paren-modifier
820 '(("Biggl" . "Biggr") ("biggl" . "biggr")
821 ("Bigl" . "Bigr") ("bigl" . "bigr")
822 ("left" . "right") ("" . ""))
823 "Alist of modifier of parentheses.")
825 (defvar YaTeX-left-paren "(\\|\\[\\|\\\\{")
826 (defvar YaTeX-right-paren ")\\|\\]\\|\\\\}")
827 (defvar YaTeX-paren
828 (concat YaTeX-left-paren "\\|" YaTeX-right-paren))
830 (defun YaTeX-on-parenthesis-p ()
831 "If cursor is on an (AMS-LaTeX) parenthesis, return the parenthesis."
832 (interactive)
833 (let* ((list YaTeX-ams-paren-modifier)
834 (longest 0) ;; the longest length of parenthesis command strings
835 (flag t) ;; flag for whether on braces not following \
836 (point (point))
837 (move 0)
838 (paren))
839 (while list
840 (setq longest
841 (max longest (length (car (car list))) (length (cdr (car list)))))
842 (setq list (cdr list)))
843 (save-excursion
844 ;; search {} and, if it does not follow `\', set flag nil.
845 ;; if it is right after `\', set flag t and move to the position of \.
846 ;; mmmmm.
847 (if (looking-at "{\\|}")
848 (if (not (equal (char-after (1- (point))) 92))
849 (setq flag nil)
850 (forward-char -1)))
851 ;; if flag is nil, do nothing.
852 (if (and flag (re-search-forward YaTeX-paren
853 (+ (point) 3 longest) t))
854 (progn
855 (setq move (- (point) point))
856 (setq paren (YaTeX-match-string 0))
857 (setq list YaTeX-ams-paren-modifier)
858 ;; criterion for whether on [] () \{\} or not.
859 (if (string-match YaTeX-left-paren paren)
860 (while (and list flag)
861 (let* ((mod (car (car list)))
862 (mod-length 0) ;; length of modifier
863 paren-regexp ;; regexp of paren.
864 mod-regexp) ;; regexp of modifier.
865 (if (> (length mod) 0)
866 (setq mod-regexp (concat "\\\\" mod)
867 mod-length (1+ (length mod))))
868 (cond ((string= paren "\\{")
869 (setq paren-regexp (concat "\\" paren)))
870 ((string= paren "[")
871 (setq paren-regexp "\\["))
872 (t (setq paren-regexp paren)))
873 (save-excursion
874 (if (and (>= (- (point) (point-min))
875 (+ mod-length (length paren)))
876 (not (forward-char
877 (- 0 mod-length (length paren))))
878 (looking-at (concat "\\(" mod-regexp "\\)\\("
879 paren-regexp "\\)")))
880 (setq flag nil)))
881 (setq list (cdr list))))
882 (while (and list flag)
883 (let* ((mod (cdr (car list)))
884 (mod-length 0)
885 paren-regexp
886 mod-regexp)
887 (if (> (length mod) 0)
888 (setq mod-regexp (concat "\\\\" mod)
889 mod-length (1+ (length mod))))
890 (cond ((string= paren "\\}")
891 (setq paren-regexp (concat "\\" paren)))
892 ((string= paren "]")
893 (setq paren-regexp "\\]"))
894 (t (setq paren-regexp paren)))
895 (save-excursion
896 (if (and (>= (- (point) (point-min))
897 (+ mod-length (length paren)))
898 (not (forward-char
899 (- 0 mod-length (length paren))))
900 (looking-at (concat "\\(" mod-regexp "\\)\\("
901 paren-regexp "\\)")))
902 (setq flag nil)))
903 (setq list (cdr list)))))
904 (if (<= move (length (YaTeX-match-string 0)))
905 (YaTeX-match-string 0)))))))
907 (defun YaTeX-goto-open-paren (&optional jumpto-co)
908 "Jump to the exact position of open parenthesis.
909 If optional argument JUMPTO-CO is non-nil, goto corresponding parentheses."
910 (interactive)
911 (let ((paren)
912 (backslash-syntax (char-to-string (char-syntax ?\\))))
913 (if (setq paren (YaTeX-on-parenthesis-p))
914 (if (string-match "(\\|{\\|\\[" paren (1- (length paren)))
915 (progn
916 (re-search-forward "(\\|{\\|\\[" (+ (point) (length paren)) t)
917 (backward-char)
918 (if jumpto-co
919 (unwind-protect
920 (progn
921 (modify-syntax-entry ?\\ " ")
922 (forward-list)
923 (backward-char))
924 (modify-syntax-entry ?\\ backslash-syntax)))
925 (point))
926 (re-search-forward ")\\|}\\|\\]" (+ (point) (length paren)) t)
927 (unwind-protect
928 (progn
929 (modify-syntax-entry ?\\ " ")
930 (backward-list)
931 (point))
932 (modify-syntax-entry ?\\ backslash-syntax))))))
934 ;;;###autoload
935 (defun YaTeX-goto-corresponding-paren ()
936 "Go to corresponding mathematical parentheses."
937 (if (YaTeX-on-parenthesis-p)
938 (YaTeX-goto-open-paren t)
939 nil))
941 (defun YaTeX-change-parentheses ()
942 "Change the size of parentheses, braces, and brackets of AMS-LaTeX."
943 (interactive)
944 (if (not (and YaTeX-use-AMS-LaTeX (YaTeX-on-parenthesis-p)))
945 nil
946 (let* ((mod (YaTeX-match-string 1)) ;; modifier
947 (paren (if mod (YaTeX-match-string 2) (YaTeX-match-string 0))) ;; paren
948 (mod-length (if (or (string= mod "\\left") (string= mod "\\right"))
949 5 ;; 5 in case left or right
950 (length mod))) ;; length of modifier
951 (paren-length (length paren)) ;; length of paren
952 (length (+ mod-length paren-length)) ;; length of whole string
953 (big-p t) ;; flag whether new modifier is "[Bb]ig+" or not.
954 size ;; left, big, Big etc.
955 type ;; parentheses type
956 lr ;; "l" or "r".
957 char newsize newsize-length
958 (backslash-syntax (char-to-string (char-syntax ?\\)))
959 (case-fold-search))
960 ;; decide lr and size from mod and paren.
961 (cond ((string-match "\\(\\\\[Bb]ig+\\)[lr]" mod)
962 (setq size (substring mod 1 (match-end 1))
963 lr (substring mod (match-end 1) (match-end 0))))
964 ((string-match "\\\\left" mod)
965 (setq size "left-right" lr "l"))
966 ((string-match "\\\\right" mod)
967 (setq size "left-right" lr "r"))
968 ((string-match "(\\|\\[\\|\\\\{" paren)
969 (setq size "null" lr "l"))
970 ((string-match ")\\|\\]\\|\\\\}" paren)
971 (setq size "null" lr "r"))
972 (t
973 (setq size nil lr nil)))
974 (while (not newsize)
975 (message (format (concat "Change from %s: "
976 "l(big) L(Big) h(bigg) H(Bigg) "
977 "r(left-right) n(NONE) ( { [") size))
978 (setq char (read-char)
979 newsize (cond ((char-equal char ?l) "\\big")
980 ((char-equal char ?L) "\\Big")
981 ((char-equal char ?h) "\\bigg")
982 ((char-equal char ?H) "\\Bigg")
983 ((char-equal char ?r)
984 (setq big-p nil) "\\left")
985 ((memq char '(?\( ?\)))
986 (setq big-p nil type '("(" . ")")) "")
987 ((memq char '(?\{ ?\}))
988 (setq big-p nil type '("\\{" . "\\}")) "")
989 ((memq char '(?\[ ?\]))
990 (setq big-p nil type '("[" . "]")) "")
991 ((char-equal char ?n)
992 (setq big-p nil) "")
993 (t nil))
994 newsize-length (length newsize)))
995 (YaTeX-goto-open-paren)
996 (forward-char)
997 (cond
998 (type
999 (delete-region (point) (- (point) paren-length))
1000 (save-excursion (insert (car type))))
1001 (t
1002 (delete-region (- (point) length) (- (point) paren-length))
1003 (backward-char paren-length)))
1004 (insert-string newsize)
1005 (if big-p (insert ?l))
1006 (unwind-protect
1007 (progn
1008 (modify-syntax-entry ?\\ " ")
1009 (forward-list)
1010 (if (string= size "left-right") (setq length (1+ length)))
1011 (if (eq char ?r) (setq newsize "\\right"))
1012 (cond
1013 (type
1014 (delete-region (point) (- (point) paren-length))
1015 (insert (cdr type)))
1016 (t
1017 (delete-region (- (point) length) (- (point) paren-length))
1018 (backward-char paren-length)
1019 (insert-string newsize)
1020 (if big-p (insert ?r))
1021 (forward-char paren-length)))
1022 (if (string= lr "l") (backward-list)))
1023 (modify-syntax-entry ?\\ backslash-syntax))
1024 t)))
1026 (defun YaTeX-insert-amsparens-region (beg end char)
1027 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ")
1028 (let* ((case-fold-search)
1029 (st (cond ((char-equal char ?l) "big")
1030 ((char-equal char ?L) "Big")
1031 ((char-equal char ?h) "bigg")
1032 ((char-equal char ?H) "Bigg"))))
1033 (if st
1034 (YaTeX-insert-braces-region
1035 beg end (concat "\\" st "l(") (concat "\\" st "r)"))
1036 (YaTeX-insert-braces-region beg end "(" ")"))))
1038 (defun YaTeX-insert-amsbraces-region (beg end char)
1039 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ")
1040 (let* ((case-fold-search)
1041 (st (cond ((char-equal char ?l) "big")
1042 ((char-equal char ?L) "Big")
1043 ((char-equal char ?h) "bigg")
1044 ((char-equal char ?H) "Bigg"))))
1045 (if st
1046 (YaTeX-insert-braces-region
1047 beg end (concat "\\" st "l\\{") (concat "\\" st "r\\}"))
1048 (YaTeX-insert-braces-region beg end "\\{" "\\}"))))
1050 (defun YaTeX-insert-amsbrackets-region (beg end char)
1051 (interactive "r\ncWhich one ? l(big) L(Big) h(bigg) H(Bigg): ")
1052 (let* ((case-fold-search)
1053 (st (cond ((char-equal char ?l) "big")
1054 ((char-equal char ?L) "Big")
1055 ((char-equal char ?h) "bigg")
1056 ((char-equal char ?H) "Bigg"))))
1057 (if st
1058 (YaTeX-insert-braces-region
1059 beg end (concat "\\" st "l[") (concat "\\" st "r]"))
1060 (YaTeX-insert-braces-region beg end "[" "]"))))
1063 ;;
1064 (provide 'yatexmth)
1066 ; Local variables:
1067 ; fill-prefix: ";;; "
1068 ; paragraph-start: "^$\\| \\|;;;$"
1069 ; paragraph-separate: "^$\\| \\|;;;$"
1070 ; End: