;;; latex-math-symbol.el --- LaTeX math symbol decoder
-;; Copyright (C) 1996 MORIOKA Tomohiko
+;; Copyright (C) 1996,1997 MORIOKA Tomohiko
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1996/7/1
;; Version:
-;; $Id: latex-math-symbol.el,v 1.2 1996/09/02 16:03:43 morioka Exp $
+;; $Id: latex-math-symbol.el,v 2.0 1997/01/17 05:11:03 morioka Exp $
;; Keywords: LaTeX, math, mule
;; This file is part of MU (Message Utilities).
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with this program; see the file COPYING. If not, write to
-;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;; Code:
(defvar latex-math-symbol-table-alist
- '(("\\pi" . "\e$B&P\e(B")
+ '(("\\alpha" . "\e,Fa\e(B")
+ ("\\beta" . "\e,Fb\e(B")
+ ("\\gamma" . "\e,Fc\e(B")("\\Gamma" . "\e$B&#\e(B")
+ ("\\delta" . "\e,Fd\e(B")("\\Delta" . "\e$B&$\e(B")
+ ("\\epsilon" . "\e,Fe\e(B")("\\varepsilon" . "\e$B&E\e(B")
+ ("\\zeta" . "\e,Ff\e(B")
+ ("\\eta" . "\e,Fg\e(B")
+ ("\\theta" . "\e,Fh\e(B")("\\Theta" . "\e$B&(\e(B")
+ ("\\iota" . "\e,Fi\e(B")
+ ("\\kappa" . "\e,Fj\e(B")
+ ("\\lambda" . "\e,Fk\e(B")("\\Lambda" . "\e$B&+\e(B")
+ ("\\mu" . "\e,Fl\e(B")
+ ("\\nu" . "\e,Fm\e(B")
+ ("\\xi" . "\e,Fn\e(B")("\\Xi" . "\e$B&.\e(B")
+ ("\\pi" . "\e,Fp\e(B")("\\Pi" . "\e$B&0\e(B")
+ ("\\rho" . "\e,Fq\e(B")
+ ("\\sigma" . "\e,Fs\e(B")("\\Sigma" . "\e$B&2\e(B")
+ ("\\varsigma" . "\e,Fr\e(B")
+ ("\\tau" . "\e,Ft\e(B")
+ ("\\upsilon" . "\e,Fu\e(B")("\\Upsilon" . "\e$B&4\e(B")
+ ("\\phi" . "\e$B&U\e(B")("\\Phi" . "\e$B&5\e(B")
+ ("\\varphi" . "\e,Fv\e(B")
+ ("\\chi" . "\e,Fw\e(B")
+ ("\\psi" . "\e,Fx\e(B")("\\Psi" . "\e$B&7\e(B")
+ ("\\omega" . "\e,Fy\e(B")("\\Omega" . "\e$B&8\e(B")
("\\{" . "\e$B!P\e(B")("\\}" . "\e$B!Q\e(B")
+ ("\\langle\\!\\langle" . "\e$B!T\e(B")("\\rangle\\!\\rangle" . "\e$B!U\e(B")
+ ("\\langle" . "\e$B!R\e(B")("\\rangle" . "\e$B!S\e(B")
+ ("\\cdots" . "\e$B!D\e(B")
+
+ ("\\ln" . "\e$(G"L\e(B")
+ ("\\log" . "\e$(G"K\e(B")
+
+ ("\\pm" . "\e$B!^\e(B")
("\\cdot" . "\e$B!&\e(B")
- ("\\times" . "\e$B!_\e(B")
+ ("\\times" . "\e$B!_\e(B")("\\ast" . "\e$B!v\e(B")
+ ("\\star" . "\e$B!z\e(B")
+ ("\\bullet" . "\e$B!&\e(B")
+ ("\\div" . "\e$B!`\e(B")
("\\cap" . "\e$B"A\e(B")("\\cup" . "\e$B"@\e(B")
+ ("\\lhd" . "\e$(C"7\e(B")("\\rhd" . "\e$(C"9\e(B")
+ ("\\bigcirc" . "\e$B"~\e(B")
+ ("\\vee" . "\e$B"K\e(B")("\\lor" . "\e$B"K\e(B")
+ ("\\wedge" . "\e$B"J\e(B")("\\land" . "\e$B"J\e(B")
+ ("\\oplus" . "\e$(G"S\e(B")
+ ("\\odot" . "\e$(G"T\e(B")
+ ("\\dagger" . "\e$B"w\e(B")("\\ddagger" . "\e$B"x\e(B")
("\\leq" . "\e$(C!B\e(B")("\\geq" . "\e$(C!C\e(B")
("\\le" . "\e$(C!B\e(B")("\\ge" . "\e$(C!C\e(B")
+ ("\\ll" . "\e$B"c\e(B")("\\gg" . "\e$B"d\e(B")
("\\subseteq" . "\e$B"<\e(B")("\\supseteq" . "\e$B"=\e(B")
("\\subset" . "\e$B">\e(B")("\\supset" . "\e$B"?\e(B")
- ("\\in" . "\e$B":\e(B")("\\ni" . "\e$B";\e(B")
- ("\\mid" . "\e$B!C\e(B")
+ ("\\in" . "\e$B":\e(B")
+ ("\\ni" . "\e$B";\e(B")("\\owns" . "\e$B";\e(B")
+ ("\\frown" . "\e$B"^\e(B")
+ ("\\mid" . "\e$B!C\e(B")("\\parallel" . "\e$B!B\e(B")
+ ("\\sim" . "\e$B!A\e(B")
+ ("\\equiv" . "\e$B"a\e(B")
+ ("\\approx" . "\e$A!V\e(B")
+ ("\\not=" . "\e$B!b\e(B")
("\\neq" . "\e$B!b\e(B")("\\ne" . "\e$B!b\e(B")
+ ("\\perp" . "\e$B"]\e(B")
+
+ ("\\triangleup" . "\e$B"$\e(B")
+ ("\\forall" . "\e$B"O\e(B")
+ ("\\hbar" . "\e,C1\e(B")("\\imath" . "\e,C9\e(B")
+ ("\\ell" . "\e$(C'$\e(B")
+ ("\\partial" . "\e$B"_\e(B")
+ ("\\infty" . "\e$B!g\e(B")
+ ("\\smallint" . "\e$B"i\e(B")
+ ("\\P" . "\e$B"y\e(B")
+ ("\\prime" . "\e$B!l\e(B")
+ ("\\nabla" . "\e$B"`\e(B")
+ ("\\top" . "\e$(D0#\e(B")("\\bot" . "\e$(D0"\e(B")
+ ("\\vert" . "\e$B!C\e(B")("\\Vert" . "\e$B!B\e(B")
+ ("\\angle" . "\e$B"\\e(B")
+ ("\\triangle" . "\e$B"$\e(B")
+ ("\\backslash" . "\e$B!@\e(B")
+ ("\\S" . "\e$B!x\e(B")
("\\forall" . "\e$B"O\e(B")
+ ("\\exists" . "\e$B"P\e(B")
+ ("\\neg" . "\e$B"L\e(B")("\\lnot" . "\e$B"L\e(B")
+ ("\\flat" . "\e$B"u\e(B")("\\sharp" . "\e$B"t\e(B")
+ ("\\clubsuit" . "\e$(C"@\e(B")
+ ("\\diamondsuit" . "\e$B!~\e(B")
+ ("\\heartsuit" . "\e$(C"=\e(B")
+ ("\\spadesuit" . "\e$(C"<\e(B")
("\\leftarrow" . "\e$B"+\e(B")("\\rightarrow" . "\e$B"*\e(B")
("\\gets" . "\e$B"+\e(B")("\\to" . "\e$B"*\e(B")
- ("^1" . "\e,A9\e(B")
- ("^2" . "\e,A2\e(B")
- ("^3" . "\e,A3\e(B")
+ ("^1" . "\e,A9\e(B")("^{1}" . "\e,A9\e(B")
+ ("^2" . "\e,A2\e(B")("^{2}" . "\e,A2\e(B")
+ ("^3" . "\e,A3\e(B")("^{3}" . "\e,A3\e(B")
+ ("^4" . "\e$(C)y\e(B")("^{4}" . "\e$(C)y\e(B")
+ ("^n" . "\e$(C)z\e(B")("^{n}" . "\e$(C)z\e(B")
+ ("_1" . "\e$(C){\e(B")("_{1}" . "\e$(C){\e(B")
+ ("_2" . "\e$(C)|\e(B")("_{2}" . "\e$(C)|\e(B")
+ ("_3" . "\e$(C)}\e(B")("_{3}" . "\e$(C)}\e(B")
+ ("_4" . "\e$(C)~\e(B")("_{4}" . "\e$(C)~\e(B")
))
(defun latex-math-decode-region (beg end)
(save-restriction
(narrow-to-region beg end)
(let ((rest latex-math-symbol-table-alist)
+ (case-fold-search nil)
cell)
(while rest
(setq cell (car rest))
(goto-char beg)
- (while (search-forward (car cell) nil t)
- (replace-match (cdr cell))
+ (while (re-search-forward
+ (concat "\\("
+ (regexp-quote (car cell))
+ "\\)\\([^a-zA-Z]\\|$\\)")
+ nil t)
+ (delete-region (match-beginning 1)(match-end 1))
+ (goto-char (match-beginning 0))
+ (insert (cdr cell))
)
(setq rest (cdr rest))
))))
;;; mu-cite.el --- yet another citation tool for GNU Emacs
-;; Copyright (C) 1995,1996 Free Software Foundation, Inc.
+;; Copyright (C) 1995,1996,1997 Free Software Foundation, Inc.
;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; MINOURA Makoto <minoura@netlaputa.or.jp>
;; Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
;; Maintainer: Shuhei KOBAYASHI <shuhei-k@jaist.ac.jp>
-;; Version: $Revision: 7.42 $
+;; Version: $Revision: 7.44 $
;; Keywords: mail, news, citation
-;; This file is part of tl (Tiny Library).
+;; This file is part of MU (Message Utilities).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;;;
(defconst mu-cite/RCS-ID
- "$Id: mu-cite.el,v 7.42 1996/10/03 06:44:24 morioka Exp $")
+ "$Id: mu-cite.el,v 7.44 1997/01/13 15:49:13 morioka Exp $")
(defconst mu-cite/version (get-version-string mu-cite/RCS-ID))
;;; @ message editing utilities
;;;
+
+(defvar citation-mark-chars ">}|"
+ "*String of characters for citation delimiter. [mu-cite.el]")
-(defvar cited-prefix-regexp "^[^ \t>]*[>|]+[ \t#]*"
- "*Regexp to match the citation prefix.")
+(defun detect-paragraph-cited-prefix ()
+ (save-excursion
+ (goto-char (point-min))
+ (let ((i 0)
+ (prefix
+ (buffer-substring
+ (progn (beginning-of-line)(point))
+ (progn (end-of-line)(point))
+ ))
+ str ret)
+ (while (and (= (forward-line) 0)
+ (setq str (buffer-substring
+ (progn (beginning-of-line)(point))
+ (progn (end-of-line)(point))))
+ (setq ret (string-compare-from-top prefix str))
+ )
+ (setq prefix (second ret))
+ (setq i (1+ i))
+ )
+ (cond ((> i 1) prefix)
+ ((> i 0)
+ (goto-char (point-min))
+ (save-restriction
+ (narrow-to-region (point)
+ (+ (point)(length prefix)))
+ (goto-char (point-max))
+ (if (re-search-backward
+ (concat "[" citation-mark-chars "]") nil t)
+ (progn
+ (goto-char (match-end 0))
+ (if (looking-at "[ \t]+")
+ (goto-char (match-end 0))
+ )
+ (buffer-substring (point-min)(point))
+ )
+ prefix)))
+ ((progn
+ (goto-char (point-max))
+ (re-search-backward (concat "[" citation-mark-chars "]")
+ nil t)
+ )
+ (goto-char (match-end 0))
+ (if (looking-at "[ \t]+")
+ (goto-char (match-end 0))
+ )
+ (buffer-substring (point-min)(point))
+ )
+ (t ""))
+ )))
(defun fill-cited-region (beg end)
(interactive "*r")
(save-excursion
(save-restriction
(goto-char end)
- (while (not (eolp))
- (backward-char)
- )
- (setq end (point))
+ (and (search-backward "\n" nil t)
+ (setq end (match-end 0))
+ )
(narrow-to-region beg end)
- (goto-char (point-min))
- (let* ((fill-prefix
- (let* ((str1 (buffer-substring
- (progn (beginning-of-line)(point))
- (progn (end-of-line)(point))
- ))
- (str2 (let ((p0 (point)))
- (forward-line)
- (if (> (count-lines p0 (point)) 0)
- (buffer-substring
- (progn (beginning-of-line)(point))
- (progn (end-of-line)(point))
- ))))
- (ret (string-compare-from-top str1 str2))
- )
- (if ret
- (let ((prefix (nth 1 ret)))
- (if (string-match cited-prefix-regexp prefix)
- (substring prefix 0 (match-end 0))
- prefix))
- (goto-char (point-min))
- (if (re-search-forward cited-prefix-regexp nil t)
- (buffer-substring (match-beginning 0) (match-end 0))
- ))))
- (pat (concat "\n" fill-prefix))
+ (let* ((fill-prefix (detect-paragraph-cited-prefix))
+ (pat (concat fill-prefix "\n"))
)
(goto-char (point-min))
(while (search-forward pat nil t)
(fill-region (point-min) (point-max))
))))
-(defvar citation-mark-chars ">}|")
-
(defun compress-cited-prefix ()
(interactive)
(save-excursion