diff --git a/docs/yatex.ref b/docs/yatex.ref index 1f76114..d7474a7 100644 --- a/docs/yatex.ref +++ b/docs/yatex.ref @@ -112,6 +112,8 @@ �V�K�쐬/�X�V���[�h�A�������[�h�̐؂�ւ����j���[���o�܂��B + ��%# �L�@�̕ҏW [prefix] % + �L���Y�� yuuji@ae.keio.ac.jp pcs39334(ASCII-NET) diff --git a/yahtml.el b/yahtml.el new file mode 100644 index 0000000..d0ede52 --- /dev/null +++ b/yahtml.el @@ -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 "") + (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") +) diff --git a/yatex.el b/yatex.el index 93291ef..a18eb8c 100644 --- a/yatex.el +++ b/yatex.el Binary files differ diff --git a/yatex.new b/yatex.new index 4c38a11..a767192 100644 --- a/yatex.new +++ b/yatex.new @@ -2,6 +2,16 @@ Yet Another tex-mode for Emacs yatex.el �e�o�[�W�����̕ύX�_�ɂ‚��āB +1.45: comment-region �� begin/end �s�ŋN���������Ƀ��b�Z�[�W���o���B + yatexmth:�C���[�W�⊮�ŕ����̕⊮�e�[�u�����g����悤�ɂ��A + /�Ŏn�܂�M���V�������⊮��lj��B + YaTeX-mark-evrironment ��lj��B + [prefix] % �� %#�L�@�ҏW���j���[��lj��B + dviout�N����(DOS)�ɃJ�[�\���������悤�ɂ����B + section�^�R�}���h�̈������͎��� section/large/maketitle �^�⊮�� + �ċA�I�ɗ��p�ł���悤�ɂ����B + yatexadd�̈����^�t���֐��ɑ������Ȍ�̏������s���Ȃ��o�O���C���B + 1.44: �^�C�v�Z�b�g�v���O�����̋N���������������B �G���[�W�����v�̃E�B���h�E���p�̍œK���B �������[�h/�C�����[�h�̃��[�h���C���\���C���B diff --git a/yatex.prj b/yatex.prj index 4b0113b..350b074 100644 --- a/yatex.prj +++ b/yatex.prj @@ -1,11 +1,22 @@ //����̊g���\��// -�ysection�^�⊮�̈����̌��z +�ysection�^�⊮�̈����̌��z �� (setq section-table '(("part" 0) ;...�i���R�}���h�Ȃ�... ("documentstyle" 1 YaTeX:documentstyle) ;���V���{�� ("setlength" 2 ))) +***������͌��e�[�u���ł͂Ȃ��A�A�h�C���֐��Ƃ��đΏ�����悤�ɂ����B + +�y[prefix] > ��begin/end��ł̃R�����g�̌x���z �� +�ymark begin to end�z �� +�yDemacs: dviout�N�����O��ɃJ�[�\�� on/off�z �� +�y\ref,\label�̑Ή��̕s�����͂ǂ�����?�z +�y\ref,\label �W�����v���܂��B���@�\�z +�y\ref�⊮�Ōォ��\label��郂�[�h�z +�y\[����ꂽ����\]�����Ď����C���f���g�Ȃǁz +�y�I�����C���w���v�z + Local Variables: diff --git a/yatexadd.el b/yatexadd.el index cb9c208..adc28ea 100644 --- a/yatexadd.el +++ b/yatexadd.el @@ -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 "':���̃o�b�t�@�̃��x��\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 ;;; diff --git a/yatexgen.el b/yatexgen.el index 5f3b6cc..2bce986 100644 --- a/yatexgen.el +++ b/yatexgen.el @@ -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) diff --git a/yatexm-o.el b/yatexm-o.el index 8a8842f..6b61dcb 100644 --- a/yatexm-o.el +++ b/yatexm-o.el @@ -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(�g�p���Ȃ��ꍇ�͕s�v�ł�) diff --git a/yatexmth.el b/yatexmth.el index db011d7..b9be71d 100644 --- a/yatexmth.el +++ b/yatexmth.el @@ -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. + +;;; �y�C���[�W�⊮�̒lj����@�z +;;; +;;; �W���̃C���[�W�⊮�ł́A�u,�v�Ŏn�܂鐔���L���⊮�ƁA�u/�v�Ŏn +;;; �܂�M���V�������⊮���g�p�”\�ł����A����ȊO�̕����Ŏn�܂�⊮ +;;; �V���[�Y����`���邱�Ƃ��ł��܂��B�Ⴆ�΁A�u;�v�Ŏn�܂鎟�̂悤 +;;; �ȕ⊮�V���[�Y���`����ꍇ���l���Ă݂܂��B +;;; +;;; �⊮�L�[ �⊮���� +;;; s \sin +;;; S \arcsin +;;; c \cos +;;; C \arccos +;;; : +;;; T \arctan +;;; l \log +;;; hs \sinh +;;; +;;; �u;�v�̂��Ƃ� s �������� \sin ���Ahs �������� \sinh �����͂���� +;;; ���B���̂悤�ȕ⊮���X�g�̓o�^�͈ȉ��̂悤�ɂ��܂�(�ϐ����͔C��)�B +;;; +;;; (setq YaTeX-math-funcs-list +;;; '(("s" "sin") +;;; ("S" "arcsin") +;;; : +;;; ("hs" "sinh"))) +;;; +;;; ����ɁA�u;�v�����������ɃC���[�W�⊮���n�܂�悤���̕ϐ��ɁA�N���L�[ +;;; �Ə�Œ�`�����⊮�p�ϐ��̓o�^���s�Ȃ��܂��B +;;; +;;; (setq YaTeX-math-key-list-private +;;; '((";" . YaTeX-math-funcs-list) +;;; ("'" . �ق��ɒ�`�������V���[�Y������΁c))) +;;; +;;; ������ ~/.emacs �ɏ����Ă����΁A�쒹�� math-mode �Ŏ�����p�� +;;; �C���[�W�⊮�����p�ł��܂��B + +(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�P" "��") +(YaTeX-setq-math-sym YaTeX-image-int " /\\\n \\\n\\/" "��") +(YaTeX-setq-math-sym YaTeX-image-bot "�b\n�P" "��") +(YaTeX-setq-math-sym YaTeX-image-neg "��" "��") +(YaTeX-setq-math-sym YaTeX-image-flat "��" "��") + (setq - YaTeX-math-key-alist-default + YaTeX-math-sign-alist-default '( ;frequently used ("||" "|" ("||" "�a")) ("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<--+" " �R\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)) -(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)) +;;(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)) +;;) -(defvar YaTeX-ec "\\" "Escape character of mark-up language.") +(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-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: diff --git a/yatexprc.el b/yatexprc.el index 18ad7f7..edbb18b 100644 --- a/yatexprc.el +++ b/yatexprc.el @@ -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)