changeset 13:eafae54794a0

Show message at comment-region on begin/end mode. Greek letters completion in yatexmth. YaTeX-mark environment and YaTeX-%-menu added. Erase cursor at the execution of dviout(DOS). Enable recursive completion at section-type completion.
author yuuji
date Sat, 29 Jan 1994 07:59:59 +0000
parents a7f397790cdc
children b7b023a74293
files docs/yatex.ref yahtml.el yatex.el yatex.new yatex.prj yatexadd.el yatexgen.el yatexm-o.el yatexmth.el yatexprc.el
diffstat 10 files changed, 476 insertions(+), 128 deletions(-) [+]
line wrap: on
line diff
--- a/docs/yatex.ref	Mon Oct 25 14:35:00 1993 +0000
+++ b/docs/yatex.ref	Sat Jan 29 07:59:59 1994 +0000
@@ -112,6 +112,8 @@
 
 	  新規作成/更新モード、数式モードの切り替えメニューが出ます。
 
+	◆%# 記法の編集			[prefix] %
+
 								   広瀬雄二
 							yuuji@ae.keio.ac.jp
 							pcs39334(ASCII-NET)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/yahtml.el	Sat Jan 29 07:59:59 1994 +0000
@@ -0,0 +1,42 @@
+;;; -*- Emacs-Lisp -*-
+;;; (c ) 1994 by HIROSE Yuuji [yuuji@ae.keio.ac.jp, pcs39334@ascii-net]
+;;; Last modified Sat Jan 29 16:58:00 1994 on gloria
+;;; This is sample hack definition for HTML.
+;;;
+;;; [Purely tentative version]
+;;; $Id$
+
+(require 'yatex)
+(defvar yahtml-prefix-map (copy-keymap YaTeX-prefix-map))
+(defvar yahtml-mode-map nil
+  "Keymap used in yahtml-mode.")
+(if yahtml-mode-map nil
+  (setq yahtml-mode-map (make-sparse-keymap))
+  (define-key yahtml-mode-map YaTeX-prefix yahtml-prefix-map))
+
+(defun yahtml-mode ()
+  (interactive)
+  (yatex-mode)
+  (setq major-mode 'yahtml-mode
+	mode-name "yahtml")
+  (make-local-variable 'YaTeX-ec)
+  (setq YaTeX-ec "")
+  (make-local-variable 'YaTeX-struct-begin)
+  (setq YaTeX-struct-begin "<%1>")
+  (make-local-variable 'YaTeX-struct-end)
+  (setq YaTeX-struct-end "</%1>")
+  (make-local-variable 'env-table)
+  (setq env-table
+	'(("HTML") ("HEAD") ("TITLE") ("BODY") ("H1") ("H2") ("H3") ("DL")))
+  (make-local-variable 'YaTeX-prefix-map)
+  (setq YaTeX-prefix-map yahtml-prefix-map)
+  (use-local-map yahtml-mode-map)
+  (YaTeX-define-begend-key "bh" "HTML")
+  (YaTeX-define-begend-key "bH" "HEAD")
+  (YaTeX-define-begend-key "bt" "TITLE")
+  (YaTeX-define-begend-key "bb" "BODY")
+  (YaTeX-define-begend-key "bd" "DL")
+  (YaTeX-define-begend-key "b1" "H1")
+  (YaTeX-define-begend-key "b2" "H2")
+  (YaTeX-define-begend-key "b3" "H3")
+)
Binary file yatex.el has changed
--- a/yatex.new	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatex.new	Sat Jan 29 07:59:59 1994 +0000
@@ -2,6 +2,16 @@
 	Yet Another tex-mode for Emacs
 	yatex.el 各バージョンの変更点について。
 
+1.45:	comment-region を begin/end 行で起動した時にメッセージを出す。
+	yatexmth:イメージ補完で複数の補完テーブルが使えるようにし、
+	/で始まるギリシャ文字補完を追加。
+	YaTeX-mark-evrironment を追加。
+	[prefix] % の %#記法編集メニューを追加。
+	dviout起動時(DOS)にカーソルを消すようにした。
+	section型コマンドの引数入力時に section/large/maketitle 型補完を
+	再帰的に利用できるようにした。
+	yatexaddの引数型付加関数に第二引数以後の処理が行かないバグを修正。
+
 1.44:	タイプセットプログラムの起動処理を高速化。
 	エラージャンプのウィンドウ利用の最適化。
 	数式モード/修正モードのモードライン表示修正。
--- a/yatex.prj	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatex.prj	Sat Jan 29 07:59:59 1994 +0000
@@ -1,11 +1,22 @@
 //今後の拡張予定//
 
-【section型補完の引数の候補】
+【section型補完の引数の候補】			○
 
 	(setq section-table
 	      '(("part" 0) ;...段落コマンドなど...
 		("documentstyle" 1 YaTeX:documentstyle)	;候補シンボル
 		("setlength" 2 )))
+***↑これは候補テーブルではなく、アドイン関数として対処するようにした。
+
+【[prefix] > のbegin/end上でのコメントの警告】	○
+【mark begin to end】				○
+【Demacs: dviout起動時前後にカーソル on/off】	○
+【\ref,\labelの対応の不整合はどうする?】
+【\ref,\label ジャンプがまだ隠し機能】
+【\ref補完で後から\label作るモード】
+【\[を入れた時に\]を入れて自動インデントなど】
+【オンラインヘルプ】
+
 
 
 Local Variables:
--- a/yatexadd.el	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatexadd.el	Sat Jan 29 07:59:59 1994 +0000
@@ -1,8 +1,8 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; YaTeX add-in functions.
-;;; yatexadd.el rev.5
-;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
-;;; Last modified Wed Oct  6 03:40:30 1993 on 98fa
+;;; yatexadd.el rev.6
+;;; (c )1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
+;;; Last modified Sat Jan 29 16:55:09 1994 on gloria
 ;;; $Id$
 
 (provide 'yatexadd)
@@ -166,6 +166,10 @@
 ;; take an argument ARGP that specify the argument position.
 ;; If argument position is out of range, nil should be returned,
 ;; else nil should NOT be returned.
+
+;;
+; Label selection
+;;
 (defvar YaTeX-label-menu-other
   (if YaTeX-japan "':他のバッファのラベル\n" "':LABEL IN OTHER BUFFER.\n"))
 (defvar YaTeX-label-menu-any
@@ -317,6 +321,35 @@
     )
 )
 
+;;
+; completion for the arguments of \newcommand
+;;
+(defun YaTeX::newcommand (&optional argp)
+  (cond
+   ((= argp 1)
+    (let ((command (read-string "Define newcommand: " "\\")))
+      (put 'YaTeX::newcommand 'command (substring command 1))
+      command))
+   ((= argp 2)
+    (let ((argc
+	   (string-to-int (read-string "Number of arguments(Default 0): ")))
+	  (def (read-string "Definition: "))
+	  (command (get 'YaTeX::newcommand 'command)))
+      ;;!!! It's illegal to insert string in the add-in function !!!
+      (if (> argc 0) (insert (format "[%d]" argc)))
+      (if (and (stringp command)
+	       (string< "" command)
+	       (y-or-n-p "Update user completion table?"))
+	  (YaTeX-update-table
+	   (if (> argc 1) (list command argc) (list command))
+	   'section-table 'user-section-table 'tmp-section-table))
+      (message "")
+      def				;return command name
+      ))
+   (t ""))
+)
+
+
 ;;;
 ;; global subroutines
 ;;;
--- a/yatexgen.el	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatexgen.el	Sat Jan 29 07:59:59 1994 +0000
@@ -1,8 +1,8 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; Generate add-in functions for YaTeX.
 ;;; yatexgen.el rev.1(beta2)
-;;; (c)1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
-;;; Last modified Mon Sep 20 17:55:13 1993 on gloria
+;;; (c )1991-1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
+;;; Last modified Sat Jan 29 16:55:07 1994 on gloria
 ;;; $Id$
 
 (require 'yatex)
--- a/yatexm-o.el	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatexm-o.el	Sat Jan 29 07:59:59 1994 +0000
@@ -1,7 +1,7 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; Sample startup file to invoke yatex-mode with outline-minor mode.
-;;; (C)1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
-;;; Last modified Wed Apr 28 04:25:16 1993 on 98fa
+;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
+;;; Last modified Sat Jan 29 16:55:05 1994 on gloria
 
 ;;;
 ;; outline-minor-mode(使用しない場合は不要です)
--- a/yatexmth.el	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatexmth.el	Sat Jan 29 07:59:59 1994 +0000
@@ -1,22 +1,124 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; YaTeX interface for math-mode.
-;;; yatexmth.el rev.0
-;;; (C)1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
-;;; Last modified Tue Aug  3 23:37:07 1993 on 98fa
+;;; yatexmth.el rev.2
+;;; (c )1993 by HIROSE Yuuji [yuuji@ae.keio.ac.jp]
+;;; Last modified Sat Jan 29 16:55:03 1994 on gloria
 ;;; $Id$
 
+;;; [Customization guide]
+;;;
+;;;	  By default,  you can use two  completion  groups in YaTeX math
+;;;	mode, `,' for mathematical signs and `/' for greek letters.  But
+;;;	you  can add other completion groups   by defining the  alist of
+;;;	`prefix  key'    vs   `completion   list'    into  the  variable
+;;;	YaTeX-math-key-list-private.  If  you wish  to    accomplish the
+;;;	completion as follows(prefix key is `;'):
+;;;
+;;;		KEY		COMPLETION
+;;;		s		\sin
+;;;		S		\arcsin
+;;;		c		\cos
+;;;		C		\arccos
+;;;			:
+;;;		T		\arctan
+;;;		l		\log
+;;;		hs		\sinh
+;;;
+;;;	Typing `s' after `;' makes `\sin', `hs' after `;' makes `\sinh'
+;;;	and so on.  First, you have to define list of key-completion
+;;;	pairs.  Variable name(YaTeX-math-funcs-list) is arbitrary.
+;;;
+;;;		(setq YaTeX-math-funcs-list
+;;;		      '(("s"	"sin")
+;;;			("S"	"arcsin")
+;;;				:
+;;;			("hs"	"sinh")))
+;;;
+;;;	Next, define the list of prefix-key vs completion list(defined
+;;;	above) into the variable YaTeX-math-key-list-private.
+;;;
+;;;		(setq YaTeX-math-key-list-private
+;;;		      '((";" . YaTeX-math-funcs-list)
+;;;			("'" . Other-List-if-any)))
+;;;
+;;;	  Put these expressions into your ~/.emacs, and you can use this
+;;;	completion in the YaTeX-math-mode.
+;;;
+;;;	  And you can add your favorite completion sequences to the
+;;;	default completion list invoked with `,', by defining those lists
+;;;	into variable YaTeX-math-sign-alist-private.
+
+;;; 【イメージ補完の追加方法】
+;;;
+;;;	  標準のイメージ補完では、「,」で始まる数式記号補完と、「/」で始
+;;;	まるギリシャ文字補完が使用可能ですが、これ以外の文字で始まる補完
+;;;	シリーズも定義することができます。例えば、「;」で始まる次のよう
+;;;	な補完シリーズを定義する場合を考えてみます。
+;;;
+;;;		補完キー	補完結果
+;;;		s		\sin
+;;;		S		\arcsin
+;;;		c		\cos
+;;;		C		\arccos
+;;;			:
+;;;		T		\arctan
+;;;		l		\log
+;;;		hs		\sinh
+;;;
+;;;	「;」のあとに s を押すと \sin が、hs を押すと \sinh が入力されま
+;;;	す。このような補完リストの登録は以下のようにします(変数名は任意)。
+;;;
+;;;		(setq YaTeX-math-funcs-list
+;;;		      '(("s"	"sin")
+;;;			("S"	"arcsin")
+;;;				:
+;;;			("hs"	"sinh")))
+;;;
+;;;	さらに、「;」を押した時にイメージ補完が始まるよう次の変数に、起動キー
+;;;	と上で定義した補完用変数の登録を行ないます。
+;;;
+;;;		(setq YaTeX-math-key-list-private
+;;;		      '((";" . YaTeX-math-funcs-list)
+;;;			("'" . ほかに定義したいシリーズがあれば…)))
+;;;
+;;;	これらを ~/.emacs に書いておけば、野鳥の math-mode で自分専用の
+;;;	イメージ補完が利用できます。
+
+(defvar YaTeX-jisold
+  (and (boundp 'dos-machine-type)
+       (eq dos-machine-type 'pc98)))
+
+(defmacro YaTeX-setq-math-sym (sym old new)
+  (list 'setq sym (list 'if 'YaTeX-jisold old new)))
+
+(YaTeX-setq-math-sym YaTeX-image-in		"E"    		"∈")
+(YaTeX-setq-math-sym YaTeX-image-ni		"ヨ"		"∋")
+(YaTeX-setq-math-sym YaTeX-image-subset		" _\n(\n ~"	"⊂")
+(YaTeX-setq-math-sym YaTeX-image-subseteq	" _\n(_\n ~"	"⊆")
+(YaTeX-setq-math-sym YaTeX-image-supset		"_\n )\n~"	"⊃")
+(YaTeX-setq-math-sym YaTeX-image-supseteq	"_\n_)\n~" 	"⊇")
+(YaTeX-setq-math-sym YaTeX-image-nabla		"___\n\\\\/"	"∇")
+(YaTeX-setq-math-sym YaTeX-image-partial	" -+\n+-+\n+-+" "∂")
+(YaTeX-setq-math-sym YaTeX-image-dagger		"+\n|"		"†")
+(YaTeX-setq-math-sym YaTeX-image-ddagger	"+\n+\n|"	"‡")
+(YaTeX-setq-math-sym YaTeX-image-equiv		"=\n ̄"	"≡")
+(YaTeX-setq-math-sym YaTeX-image-int		" /\\\n \\\n\\/" "∫")
+(YaTeX-setq-math-sym YaTeX-image-bot		"|\n ̄"	"⊥")
+(YaTeX-setq-math-sym YaTeX-image-neg		"イ"		"¬")
+(YaTeX-setq-math-sym YaTeX-image-flat		"b"		"♭")
+
 (setq
- YaTeX-math-key-alist-default
+ YaTeX-math-sign-alist-default
  '(
    ;frequently used
    ("||"	"|"		("||"		"‖"))
    ("sum"	"sum"		("\\-+\n >\n/-+" "Σ"))
    ("sigma"	"sum"		("\\-+\n >\n/-+" "Σ"))
-   ("integral"	"int"		" /\\\n \\\n\\/")
+   ("integral"	"int"		(" /\\\n \\\n\\/" YaTeX-image-int))
    ("ointegral"	"oint"		" /\\\n(\\)\n\\/")
    ("A"		"forall"	"|_|\nV")
    ("E"		"exists"	"-+\n-+\n-+")
-   ("!"		"neg"		"--+\n  |")
+   ("!"		"neg"		("--+\n  |" YaTeX-image-neg))
    ("oo"	"infty"		("oo"		"∞"))
    ("\\"	"backslash"	("\\"		"\"))
 
@@ -54,26 +156,26 @@
    ("o/"	"oslash"	" _\n(/)\n ~")
    ("o."	"odot"		"(.)")
    ("O"		"bigcirc"	"O")
-   ("t"		"dagger"	"+\n|")
-   ("tt"	"ddagger"	"+\n+\n|")
+   ("t"		"dagger"	("+\n|" YaTeX-image-dagger))
+   ("tt"	"ddagger"	("+\n+\n|" YaTeX-image-ddagger))
    ("II"	"amalg"		"II")
    ;	:
    ;;relational operators
    ("<"		"leq"		("<\n-"		"≦"))
    (">"		"geq"		(">\n-"		"≧"))
-   ("-="	"equiv"		"=\n-")
-   ("=-"	"equiv"		"=\n-")
-   ("---"	"equiv"		"=\n-")
-   ("("		"subset"	" _\n(\n ~")
-   ("(-"	"subseteq"	" _\n(_\n~")
-   (")"		"supset"	"_\n )\n~")
-   (")-"	"supseteq"	"_\n_)\n~")
+   ("-="	"equiv"		("=\n-"		YaTeX-image-equiv))
+   ("=-"	"equiv"		("=\n-"		YaTeX-image-equiv))
+   ("---"	"equiv"		("=\n-"		YaTeX-image-equiv))
+   ("("		"subset"	(" _\n(\n ~"	YaTeX-image-subset))
+   ("(-"	"subseteq"	(" _\n(_\n ~"	YaTeX-image-subseteq))
+   (")"		"supset"	("_\n )\n~"	YaTeX-image-supset))
+   (")-"	"supseteq"	("_\n_)\n~"	YaTeX-image-supseteq))
    ("["		"sqsubset"	"[")
    ("[-"	"sqsubseteq"	"[\n~")
    ("]"		"sqsupset"	"]")
    ("]-"	"sqsupseteq"	"]\n~")
-   ("{"		"in"		"(-")
-   ("}"		"ni"		"-)")
+   ("{"		"in"		("(-" YaTeX-image-in))
+   ("}"		"ni"		("-)" YaTeX-image-ni))
    ("|-"	"vdash"		"|-")
    ("-|"	"dashv"		"-|")
    ("~"		"sim"		"~(tild)")
@@ -98,10 +200,12 @@
    ;	:
    ;;arrows
    ("<-"	"leftarrow"	("<-"		"←"))
-   ("<--"	"longleftarrow"	("<-"		"←--"))
+   ("\C-b"	"leftarrow"	("<-"		"←"))
+   ("<--"	"longleftarrow"	("<--"		"←--"))
    ("<="	"Leftarrow"	"<=")
    ("<=="	"Longleftarrow"	"<==")
    ("->"	"rightarrow"	("->"		"→"))
+   ("\C-f"	"rightarrow"	("->"		"→"))
    ("-->"	"longrightarrow" ("-->"		"--→"))
    ("==>"	"Longrightarrow" "==>")
    ("<->"	"leftrightarrow" ("<->"		"←→"))
@@ -109,9 +213,11 @@
    ("<=>"	"leftrightarrow" "<=>")
    ("<==>"	"Longleftrightarrow" "<==>")
    ("^|"	"uparrow"	("^\n|" "↑"))
+   ("\C-p"	"uparrow"	("^\n|" "↑"))
    ("^||"	"Uparrow"	"/\\\n||")
    ("\C-n"	"downarrow"	("|\nv" "↓"))
-   ("^|"	"uparrow"	("^\n|" "↑"))
+   ("v|"	"downarrow"	("|\nv" "↓"))
+   ("v||"	"Downarrow"	"||\n\\/")
    ("|->"	"mapsto"	("|->"		"|→"))
    ("<-)"	"hookleftarrow"	("   ,\n<--+"	"   ヽ\n<--/"))
    ("/-"	"leftharpoonup"	"/\n~~~")
@@ -131,16 +237,16 @@
    ("mho"	"mho"		"~|_|~")
    ("'"		"prime"		"'")
    ("0"		"emptyset"	"0")
-   ("nabla"	"nabla"		"___\n\\\\/")
+   ("nabla"	"nabla"		("___\n\\\\/" YaTeX-image-nabla))
    ("\\/"	"surd"		"-\\/")
    ("surd"	"surd"		"-\\/")
    ("top"	"top"		"T")
-   ("bot"	"bot"		"_|_")
-   ("b"		"flat"		"b")
+   ("bot"	"bot"		("_|_"		YaTeX-image-bot))
+   ("b"		"flat"		("b"		YaTeX-image-flat))
    ("LT"	"natural"	"|\nLT\n |")
-   ("6"		"partial"	" -+\n+-+\n+-+")
-   ("partial"	"partial"	" -+\n+-+\n+-+")
-   ("round"	"partial"	" -+\n+-+\n+-+")
+   ("6"		"partial"	(" -+\n+-+\n+-+" YaTeX-image-partial))
+   ("partial"	"partial"	(" -+\n+-+\n+-+" YaTeX-image-partial))
+   ("round"	"partial"	(" -+\n+-+\n+-+" YaTeX-image-partial))
    ("[]"	"box"		"[]")
    ("Diamond"	"Diamond"	"/\\\n\\/")
    ("3"		"triangle"	"/\\\n~~")
@@ -151,23 +257,82 @@
 
    ))
 
-(defvar YaTeX-math-key-alist-private nil
+(defvar YaTeX-math-sign-alist-private nil
   "*User definable key vs LaTeX-math-command alist.")
 
 (defvar YaTeX-math-quit-with-strict-match nil
   "*T for quitting completion as soon as strict-match is found.")
-(setq YaTeX-math-key-alist
-      (append YaTeX-math-key-alist-private YaTeX-math-key-alist-default))
+(setq YaTeX-math-sign-alist
+      (append YaTeX-math-sign-alist-private YaTeX-math-sign-alist-default))
+
+;;(defun YaTeX-math-alist2array (alist array)
+;;  (set array
+;;       (let ((array (make-vector (length alist) "")) (list alist) (i 0))
+;;	 (while list
+;;	   (aset array i (car (car list)))
+;;	   (setq i (1+ i) list (cdr list)))
+;;	 array))
+;;)
 
-(setq YaTeX-math-key-array
-  (let ((array (make-vector (length YaTeX-math-key-alist) ""))
-	(list YaTeX-math-key-alist) (i 0))
-    (while list
-      (aset array i (car (car list)))
-      (setq i (1+ i) list (cdr list)))
-    array))
+(setq YaTeX-greek-key-alist-default
+  '(
+    ("a"	"alpha"		("a" "α"))
+    ("b"	"beta"		("|>\n|>\n|" "β"))
+    ("g"	"gamma"		("~r" "γ"))
+    ("G"	"Gamma"		("|~" "Γ"))
+    ("d"	"delta"		("<~\n<>" "δ"))
+    ("D"	"Delta"		("/\\\n~~" "Δ"))
+    ("e"	"epsilon"	"<\n<~")
+    ("e-"	"varepsilon"	("(\n(~" "ε"))
+    ("z"	"zeta"		("(~\n >" "ζ"))
+    ("et"	"eta"		("n\n/" "η"))
+    ("th"	"theta"		("8" "θ"))
+    ("Th"	"Theta"		("(8)" "Θ"))
+    ("th-"	"vartheta"	("-8" "-θ"))
+    ("i"	"iota"		("i\n\\_/" "ι"))
+    ("k"	"kappa"		("k" "κ"))
+    ("l"	"lambda"	("\\n/\\" "λ"))
+    ("L"	"Lambda"	("/\\" "Λ"))
+    ("m"	"mu"		(" u_\n/" "μ"))
+    ("n"	"nu"		("|/" "ν"))
+    ("x"	"xi"		("E\n >" "ξ"))
+    ("X"	"Xi"		("---\n -\n---" "Ξ"))
+    ("p"	"pi"		("__\n)(" "π"))
+    ("P"	"Pi"		("__\n||" "Π"))
+    ("p-"	"varpi"		("_\nw" "__\nω"))
+    ("r"	"rho"		("/O" "ρ"))
+    ("r-"	"varrho"	("/O\n~~" "ρ\n~~"))
+    ("s"	"sigma"		("o~" "σ"))
+    ("S"	"Sigma"		("\\-+\n >\n/-+" "Σ"))
+    ("s-"	"varsigma"	"(~~ \n>")
+    ("t"	"tau"		("__\n(" "τ"))
+    ("u"	"upsilon"	("~v" "υ"))
+    ("y"	"upsilon"	("~v" "υ"))
+    ("U"	"Upsilon"	("~Y~" "Υ"))
+    ("Y"	"Upsilon"	("~Y~" "Υ"))
+    ("ph"	"phi"		("  /\n(/)\n/" "φ"))
+    ("Ph"	"Phi"		(" _\n(|)\n ~" "Φ"))
+    ("ph-"	"varphi"	"\\O\n|")
+    ("c"	"chi"		("x" "χ"))
+    ("ps"	"psi"		("\\|/\\n |" "ψ"))
+    ("Ps"	"Psi"		(" ~\n\\|/\\n |" "Ψ"))
+    ("o"	"omega"		("w" "ω"))
+    ("w"	"omega"		("w" "ω"))
+    ("O"	"Omega"		("(~)\n~ ~" "Ω"))
+    ("W"	"Omega"		("(~)\n~ ~" "Ω"))
+    ("f" "foo")
+    )
+)
 
-(defvar YaTeX-ec "\\" "Escape character of mark-up language.")
+(defvar YaTeX-greek-key-alist-private nil
+  "*User definable key vs LaTeX-math-command alist.")
+
+(setq YaTeX-greek-key-alist
+      (append YaTeX-greek-key-alist-private YaTeX-greek-key-alist-default))
+
+;;(mapcar (function (lambda (x) (YaTeX-math-alist2array x)))
+;;	YaTeX-math-key-list)
+
 (setq YaTeX-math-indicator
   "KEY\tLaTeX sequence\t\tsign")
 
@@ -201,11 +366,69 @@
   (define-key YaTeX-math-menu-map "\^m"	'exit-recursive-edit)
   (define-key YaTeX-math-menu-map "q"	'abort-recursive-edit))
 
+(defvar YaTeX-math-key-list-default
+  '(("," . YaTeX-math-sign-alist)
+    ("/" . YaTeX-greek-key-alist))
+  "Default key sequence to invoke math-mode's image completion."
+)
+(defvar YaTeX-math-key-list-private nil
+  "*User defined alist, math-mode-prefix vs completion alist"
+)
+(defvar YaTeX-math-key-list
+  (append YaTeX-math-key-list-private YaTeX-math-key-list-default)
+  "Key sequence to invoke math-mode's image completion."
+)
+(defvar YaTeX-math-exit-key "\e"
+  "*Key sequence after prefix key of YaTeX-math-mode to exit from math-mode."
+)
+
 (defmacro YaTeX-math-japanese-sign (list)
   (list 'nth 1 list))
 
 (defvar YaTeX-math-cmd-regexp (concat (regexp-quote YaTeX-ec) "[A-z]"))
 
+;;;
+;;YaTeX math-mode functions
+;;;
+;##autoload from yatex.el
+(defun YaTeX-toggle-math-mode (&optional arg)
+  (interactive "P")
+  (require 'yatexmth)
+  (or (memq 'YaTeX-math-mode mode-line-format) nil
+      (setq mode-line-format
+	    (append (list "" 'YaTeX-math-mode) mode-line-format)))
+  (if (or arg (null YaTeX-math-mode))
+      (let ((keys ""))
+	(setq YaTeX-math-mode "math:")
+	(mapcar
+	 (function (lambda (x)
+		     (let ((key (car x)) (list (cdr x)))
+		       (setq keys (concat keys " " key))
+		       (put 'YaTeX-math-key-list list (key-binding key))
+		       (define-key YaTeX-mode-map key
+			 'YaTeX-math-insert-sequence))))
+	 YaTeX-math-key-list)
+	(message "Turn on math mode. Prefix keys are %s" keys)
+	(sit-for 3)
+	(message
+	 (concat "To exit from math-mode, type `ESC' after prefix, "
+		 "or type `"
+		 (key-description
+		  (car
+		   (where-is-internal 'YaTeX-switch-mode-menu YaTeX-mode-map)))
+		 " $'")))
+    (setq YaTeX-math-mode nil)
+    (mapcar
+     (function (lambda (x)
+		 (let ((key (car x)) (list (cdr x)))
+		   (define-key YaTeX-mode-map key
+		     (get 'YaTeX-math-key-list list)))))
+     YaTeX-math-key-list)
+    (setq YaTeX-math-mode nil)
+    (message "Exit from math mode."))
+  (set-buffer-modified-p (buffer-modified-p))
+)
+
 (defun YaTeX-math-forward (arg)
   (interactive "p")
   (re-search-forward YaTeX-math-cmd-regexp nil t arg))
@@ -214,13 +437,22 @@
   (interactive "p")
   (re-search-backward YaTeX-math-cmd-regexp nil t arg))
 
+(defun YaTeX-math-gets (sign)
+  (cond
+   ((null sign) nil)
+   ((listp sign)
+    (setq sign
+	  (cond
+	   (YaTeX-japan (YaTeX-math-japanese-sign sign))
+	   (t (car sign))))
+    (YaTeX-math-gets sign))
+   ((symbolp sign)
+    (YaTeX-math-gets (symbol-value sign)))
+   (t sign))
+)
+
 (defun YaTeX-math-get-sign (list)
-  (let ((sign (car (cdr (cdr list)))))
-    (if (listp sign)
-	(setq sign (cond
-		    (YaTeX-japan (YaTeX-math-japanese-sign sign))
-		    (t (car sign)))))
-    sign)
+  (YaTeX-math-gets (car (cdr-safe (cdr-safe list))))
 )
 
 (defun YaTeX-math-display-list (list cols)
@@ -236,7 +468,7 @@
     (insert "\\" (car (cdr list)))
     (setq indent (+ indent YaTeX-math-max-seq))
     (setq sign (YaTeX-math-get-sign list))
-    (while (not (string= "" sign))
+    (while (and sign (not (string= "" sign)))
       (setq to (string-match "\n" sign)
 	    str (if to (substring sign 0 to) sign))
       (end-of-line)
@@ -253,8 +485,10 @@
     (pop-to-buffer YaTeX-math-menu-buffer)
     (let ((maxcols (max 1 (/ (screen-width) YaTeX-math-sign-width)))
 	  (case-fold-search nil)
-	  (cols 0) (list YaTeX-math-key-alist) command)
+	  (cols 0) (list alist) command)
       (erase-buffer)
+      (insert 
+       "Candidates of sign. [n:next p:prev f:forw b:back q:quit RET:select]\n")
       (insert YaTeX-math-indicator "\t")
       (insert YaTeX-math-indicator)
       (newline 1)
@@ -265,7 +499,7 @@
 	    (progn (YaTeX-math-display-list (car list) cols)
 		   (setq cols (% (1+ cols) maxcols))))
 	(setq list (cdr list)))
-      (goto-char (point-min))
+      (goto-line 4)
       (use-local-map YaTeX-math-menu-map)
       (unwind-protect
 	  (recursive-edit)
@@ -286,67 +520,85 @@
 erase it on the next keystroke.  The window is recentered if necessary
 to make the whole string visible.  If the window isn't large enough,
 at least you get to read the beginning."
-  (let ((buffer-read-only nil)
-	(modified (buffer-modified-p))
-	(name buffer-file-name)
-	insert-start
-	insert-end)
-    (unwind-protect
-	(progn
-	  (save-excursion
-	    ;; defeat file locking... don't try this at home, kids!
-	    (setq buffer-file-name nil)
-	    (forward-line 1)
-	    (setq insert-start (point))
-	    (if (eobp) (newline))
-	    (insert image)
-	    (setq insert-end (point)))
-	  ; make sure the whole string is visible
-	  (if (not (pos-visible-in-window-p insert-end))
-	      (recenter (max 0
-			     (- (window-height)
-				(count-lines insert-start insert-end)
-				2))))
-	  (let ((char (read-char)))
-	    (or (eq char exit-char)
-		(setq unread-command-char char))))
-      (if insert-end
-	  (save-excursion
-	    (delete-region insert-start insert-end)))
-      (setq buffer-file-name name)
-      (set-buffer-modified-p modified))))
+  (if (and image (not (string= image "")))
+      (let ((buffer-read-only nil)
+	    (modified (buffer-modified-p))
+	    (name buffer-file-name)
+	    insert-start
+	    insert-end)
+	(unwind-protect
+	    (progn
+	      (save-excursion
+		;; defeat file locking... don't try this at home, kids!
+		(setq buffer-file-name nil)
+		(forward-line 1)
+		(setq insert-start (point))
+		(if (eobp) (newline))
+		(insert image)
+		(setq insert-end (point)))
+					; make sure the whole string is visible
+	      (if (not (pos-visible-in-window-p insert-end))
+		  (recenter (max 0
+				 (- (window-height)
+				    (count-lines insert-start insert-end)
+				    2))))
+	      (let ((char (read-char)))
+		(or (eq char exit-char)
+		    (setq unread-command-char char))))
+	  (if insert-end
+	      (save-excursion
+		(delete-region insert-start insert-end)))
+	  (setq buffer-file-name name)
+	  (set-buffer-modified-p modified)))))
 
 (defun YaTeX-math-insert-sequence ()
   (interactive)
-  (let ((key "") regkey str  last-char list i
-	(case-fold-search nil) match
-	(n (length YaTeX-math-key-array)) (beg (point)) result)
+  (let*((key "") regkey str  last-char list i
+	(case-fold-search nil) match sign
+	(this-key (char-to-string last-command-char))
+	(alist (symbol-value (cdr (assoc this-key YaTeX-math-key-list))))
+	(n (length alist)) (beg (point)) result)
     (setq result
 	  (catch 'complete
 	    (while t
+	      (message "Sequence: %s" key)
 	      (setq last-char (read-char)
 		    key (concat key (char-to-string last-char))
-		    regkey (concat "^" (regexp-quote key)) i 0)
+		    i 0)
 	      (cond
-	       ((string= key YaTeX-math-invoke-key)	;;invoke key itself
+	       ((string= key this-key)	;;invoke key itself
 		(throw 'complete 'escape))
+	       ((string= key YaTeX-math-exit-key)	;;exit from math-mode
+		(throw 'complete 'exit))
 	       ((string-match "[\C-g\C-c]" key) (throw 'complete 'abort))
-	       ((string-match "[\n\r]" key) (throw 'complete 'menu)))
+	       ((string-match "[\n\r]" key) (throw 'complete 'menu))
+	       ((string-match "[\C-h\C-?]" key)
+		(if (string= key "") (throw 'complete 'abort))
+		(setq key (substring key 0 -2))))
+	      
+	      (setq regkey (concat "^" (regexp-quote key)))
+	      (message "Sequence: %s" key)
 	      (if
 		  (catch 'found
 		    ;;(1)input string strictly matches with alist
 		    (setq single-command (car (cdr match))
 			  ;;remember previous match
-			  match (assoc key YaTeX-math-key-alist))
+			  match (assoc key alist))
 		    ;;(2)search partial match into alist
+		    (setq list alist)
 		    (while (< i n)
 		      (if (string-match
-			   regkey (aref YaTeX-math-key-array i))
+			   regkey
+			   ;;(aref array i)
+			   ;;(car (nth i alist))
+			   (car (car list))
+			   )
 			  (progn
 			    (or match
-				(setq match (nth i YaTeX-math-key-alist)))
+				;;(setq match (nth i alist))
+				(setq match (car list)))
 			    (throw 'found t)))
-		      (setq i (1+ i)))) 		;catch 'found
+		      (setq i (1+ i) list (cdr list))))	;catch 'found
 		  nil ;;if any match, continue reading
 		;;else reading of sequence has been done.
 		(message "complete.")
@@ -355,9 +607,9 @@
 	      (if match
 		  (progn (delete-region beg (point))
 			 (insert YaTeX-ec (car (cdr match)))
-			 (if YaTeX-math-need-image
-			     (YaTeX-math-show-image
-			      (concat (YaTeX-math-get-sign match) "\n")))
+			 (if (and YaTeX-math-need-image
+				  (setq sign (YaTeX-math-get-sign match)))
+			     (YaTeX-math-show-image (concat sign "\n")))
 			 )
 		nil)
 	      )))
@@ -370,7 +622,7 @@
 	;;(recursive-edit)
 	(insert YaTeX-ec single-command)
 	)
-      (sit-for 1)
+      ;;;(sit-for 1)
       (setq unread-command-char last-char)
       (insert (YaTeX-addin single-command)))
      ((eq result 'abort)
@@ -378,7 +630,10 @@
       (message "Abort."))
      ((eq result 'escape)
       (delete-region beg (point))
-      (insert YaTeX-math-invoke-key))
+      (insert this-key))
+     ((eq result 'exit)
+      (delete-region beg (point))
+      (YaTeX-toggle-math-mode))
      ((eq result 'menu)
       (delete-region beg (point))
       (setq key (concat "^" (regexp-quote (substring key 0 -1))))
@@ -386,3 +641,9 @@
 )
 ;;
 (provide 'yatexmth)
+
+; Local variables: 
+; fill-prefix: ";;;	" 
+; paragraph-start: "^$\\|\\|;;;$" 
+; paragraph-separate: "^$\\|\\|;;;$" 
+; End: 
--- a/yatexprc.el	Mon Oct 25 14:35:00 1993 +0000
+++ b/yatexprc.el	Sat Jan 29 07:59:59 1994 +0000
@@ -1,8 +1,8 @@
 ;;; -*- Emacs-Lisp -*-
 ;;; YaTeX process handler.
-;;; yatexprc.el rev.1.44
-;;; (c)1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
-;;; Last modified Mon Oct 25 17:48:39 1993 on figaro
+;;; yatexprc.el
+;;; (c )1993 by HIROSE Yuuji.[yuuji@ae.keio.ac.jp]
+;;; Last modified Sat Jan 29 16:54:54 1994 on gloria
 ;;; $Id$
 
 (require 'yatex)
@@ -35,11 +35,11 @@
 	(YaTeX-kill-typeset-process YaTeX-typeset-process))
     (YaTeX-visit-main t);;execution directory
     ;;Select under-most window if there are more than 2 windows and
-    ;;typeset buffer isn't seen.
+    ;;typeset buffer not seen.
     (YaTeX-showup-buffer
      buffer (function (lambda (x) (nth 3 (window-edges x)))))
     (with-output-to-temp-buffer buffer
-      (if (eq system-type 'ms-dos)	;if MS-DOS
+      (if YaTeX-dos			;if MS-DOS
 	  (progn
 	    (message (concat "Typesetting " (buffer-name) "..."))
 	    (YaTeX-put-nonstopmode)
@@ -63,7 +63,7 @@
 	       (set-kanji-process-code YaTeX-latex-message-code))))
     (message "Type SPC to continue.")
     (goto-char (point-max))
-    (if (eq system-type 'ms-dos) (message "Done.")
+    (if YaTeX-dos (message "Done.")
       (insert (message " "))
       (set-marker (process-mark YaTeX-typeset-process) (1- (point))))
     (if (bolp) (forward-line -1))
@@ -95,7 +95,7 @@
                        (concat ": "
                                (symbol-name (process-status proc))))
 		 (message "latex typesetting done.")
-                 ;; If buffer and mode line will show that the process
+                 ;; If buffer and mode line shows that the process
                  ;; is dead, we can delete it now.  Otherwise it
                  ;; will stay around until M-x list-processes.
                  (delete-process proc)
@@ -173,7 +173,7 @@
   "Typeset whole buffer.  If %#! usage says other buffer is main text,
 visit main buffer to confirm if its includeonly list contains current
 buffer's file.  And if it doesn't contain editing text, ask user which
-action want to be done, A:Add list, R:Replace list, %:comment-out list."
+action wants to be done, A:Add list, R:Replace list, %:comment-out list."
   (interactive)
   (YaTeX-save-buffers)
   (let*((me (substring (buffer-name) 0 (rindex (buffer-name) ?.)))
@@ -242,7 +242,7 @@
   "Kill process PROC after sending signal to PROC.
 PROC should be process identifier."
   (cond
-   ((eq system-type 'ms-dos)
+   (YaTeX-dos
     (error "MS-DOS can't have concurrent process."))
    ((or (null proc) (not (eq (process-status proc) 'run)))
     (error "No typesetting process."))
@@ -254,16 +254,16 @@
   "Execute some command on buffer.  Not a official function."
   (save-excursion
     (with-output-to-temp-buffer buffer
-      (if (eq system-type 'ms-dos)
+      (if YaTeX-dos
 	  (call-process shell-file-name nil buffer nil "/c " command)
-	(start-process "system" buffer shell-file-name "-c " command))))
+	(start-process "system" buffer shell-file-name "-c" command))))
 )
 
 (defun YaTeX-preview (preview-command preview-file)
   "Execute xdvi (or other) to tex-preview."
   (interactive
    (list (read-string "Preview command: " dvi2-command)
-	 (read-string "Prefiew file[.dvi]: "
+	 (read-string "Preview file[.dvi]: "
 		      ;;(substring (buffer-name) 0 -4)
 		      (if (get 'dvi2-command 'region)
 			  (substring YaTeX-texput-file
@@ -274,10 +274,11 @@
   (save-excursion
     (YaTeX-visit-main t)
     (with-output-to-temp-buffer "*dvi-preview*"
-      (if (eq system-type 'ms-dos)
-	  (progn (send-string-to-terminal "\e[2J")	;if MS-DOS
+      (if YaTeX-dos			;if MS-DOS
+	  (progn (send-string-to-terminal "\e[2J\e[>5h") ;CLS & hide cursor
 		 (call-process shell-file-name "con" "*dvi-preview*" nil
 			       "/c " dvi2-command preview-file)
+		 (send-string-to-terminal "\e[>5l") ;show cursor
 		 (redraw-display))
 	(start-process "preview" "*dvi-preview*" shell-file-name "-c"
 		       (concat dvi2-command " " preview-file)) ;if UNIX
@@ -287,7 +288,7 @@
 
 (defun YaTeX-prev-error ()
   "Visit previous error.  The reason why not NEXT-error is to
-avoid make confliction of line numbers by editing."
+avoid making confliction of line numbers by editing."
   (interactive)
   (let ((cur-buf (buffer-name)) (cur-win (selected-window))
 	YaTeX-error-line typeset-win error-buffer error-win)
@@ -295,7 +296,7 @@
 	(message "There is no output buffer of typesetting.")
       (YaTeX-pop-to-buffer YaTeX-typeset-buffer)
       (setq typeset-win (selected-window))
-      (if (eq system-type 'ms-dos)
+      (if YaTeX-dos
 	  (if (search-backward latex-dos-emergency-message nil t)
 	      (progn (goto-char (point-max))
 		     (setq error-regexp latex-error-regexp))
@@ -317,7 +318,7 @@
 			 (skip-chars-forward "^0-9")
 			 (point))
 		  (progn (skip-chars-forward "0-9") (point)))))
-	(message "No more error on %s" cur-buf)
+	(message "No more errors on %s" cur-buf)
 	(ding))
       (setq error-buffer (YaTeX-get-error-file cur-buf)); arg. is default buf.
       (setq error-win (get-buffer-window error-buffer))
@@ -342,7 +343,7 @@
 )
 
 (defun YaTeX-jump-error-line ()
-  "Jump corresponding line on latex command's error message."
+  "Jump to corresponding line on latex command's error message."
   (interactive)
   (let ((p (point))
 	(end (progn (end-of-line) (point)))
@@ -497,18 +498,6 @@
 	))))
 )
 
-(defun YaTeX-replace-format (string format repl)
-  "In STRING, replace first appearance of FORMAT to REPL as if
-function `format' does.  FORMAT does not contain `%'"
-  (let ((beg (or (string-match (concat "^\\(%" format "\\)") string)
-		 (string-match (concat "[^%]\\(%" format "\\)") string)))
-	(len (length format)))
-    (if (null beg) string ;no conversion
-      (concat
-       (substring string 0 (match-beginning 1)) repl
-       (substring string (match-end 1)))))
-)
-
 (defun YaTeX-lpr (arg)
   "Print out.  If prefix arg ARG is non nil, call print driver without
 page range description."
@@ -542,7 +531,7 @@
     (save-excursion
       (YaTeX-visit-main t) ;;change execution directory
       (with-output-to-temp-buffer "*dvi-printing*"
-	(if (eq system-type 'ms-dos)
+	(if YaTeX-dos
 	    (call-process shell-file-name "con" "*dvi-printing*" nil
 			  "/c " cmd)
 	  (start-process "print" "*dvi-printing*" shell-file-name "-c" cmd)

yatex.org