yatex

view yatexmth.el @ 183:1c41dc8a28eb

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