8
|
1 ;;; latex-math-symbol.el --- LaTeX math symbol decoder
|
|
2
|
|
3 ;; Copyright (C) 1996 MORIOKA Tomohiko
|
|
4
|
|
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
|
|
6 ;; Created: 1996/7/1
|
|
7 ;; Version:
|
|
8 ;; $Id: latex-math-symbol.el,v 1.1 1996/12/22 00:35:05 steve Exp $
|
|
9 ;; Keywords: LaTeX, math, mule
|
|
10
|
|
11 ;; This file is part of MU (Message Utilities).
|
|
12
|
|
13 ;; This program is free software; you can redistribute it and/or
|
|
14 ;; modify it under the terms of the GNU General Public License as
|
|
15 ;; published by the Free Software Foundation; either version 2, or (at
|
|
16 ;; your option) any later version.
|
|
17
|
|
18 ;; This program is distributed in the hope that it will be useful, but
|
|
19 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
21 ;; General Public License for more details.
|
|
22
|
|
23 ;; You should have received a copy of the GNU General Public License
|
|
24 ;; along with this program; see the file COPYING. If not, write to
|
|
25 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
26 ;; Boston, MA 02111-1307, USA.
|
|
27
|
|
28 ;;; Commentary:
|
|
29
|
|
30 ;; - How to install
|
|
31 ;; bytecompile this file and copy it to the apropriate directory.
|
|
32 ;; - How to use
|
|
33 ;; If you use tm, please put following to your ~/.emacs:
|
|
34 ;; (autoload 'latex-math-decode-buffer "latex-math-symbol" nil t)
|
|
35 ;; (add-hook 'mime-viewer/plain-text-preview-hook
|
|
36 ;; 'latex-math-decode-buffer)
|
|
37 ;; Of course, it may be available for other hooks to filter messages.
|
|
38
|
|
39 ;;; Code:
|
|
40
|
|
41 (defvar latex-math-symbol-table-alist
|
|
42 '(("\\pi" . "$B&P(B")
|
|
43
|
|
44 ("\\{" . "$B!P(B")("\\}" . "$B!Q(B")
|
|
45
|
|
46 ("\\cdot" . "$B!&(B")
|
|
47 ("\\times" . "$B!_(B")
|
|
48 ("\\cap" . "$B"A(B")("\\cup" . "$B"@(B")
|
|
49
|
|
50 ("\\leq" . "$(C!B(B")("\\geq" . "$(C!C(B")
|
|
51 ("\\le" . "$(C!B(B")("\\ge" . "$(C!C(B")
|
|
52 ("\\subseteq" . "$B"<(B")("\\supseteq" . "$B"=(B")
|
|
53 ("\\subset" . "$B">(B")("\\supset" . "$B"?(B")
|
|
54 ("\\in" . "$B":(B")("\\ni" . "$B";(B")
|
|
55 ("\\mid" . "$B!C(B")
|
|
56 ("\\neq" . "$B!b(B")("\\ne" . "$B!b(B")
|
|
57
|
|
58 ("\\forall" . "$B"O(B")
|
|
59
|
|
60 ("\\leftarrow" . "$B"+(B")("\\rightarrow" . "$B"*(B")
|
|
61 ("\\gets" . "$B"+(B")("\\to" . "$B"*(B")
|
|
62
|
|
63 ("^1" . ",A9(B")
|
|
64 ("^2" . ",A2(B")
|
|
65 ("^3" . ",A3(B")
|
|
66 ))
|
|
67
|
|
68 (defun latex-math-decode-region (beg end)
|
|
69 (interactive "r")
|
|
70 (save-restriction
|
|
71 (narrow-to-region beg end)
|
|
72 (let ((rest latex-math-symbol-table-alist)
|
|
73 cell)
|
|
74 (while rest
|
|
75 (setq cell (car rest))
|
|
76 (goto-char beg)
|
|
77 (while (search-forward (car cell) nil t)
|
|
78 (replace-match (cdr cell))
|
|
79 )
|
|
80 (setq rest (cdr rest))
|
|
81 ))))
|
|
82
|
|
83 (defun latex-math-decode-buffer ()
|
|
84 (interactive)
|
|
85 (latex-math-decode-region (point-min)(point-max))
|
|
86 )
|
|
87
|
|
88
|
|
89 ;;; @ end
|
|
90 ;;;
|
|
91
|
|
92 (provide 'latex-math-symbol)
|
|
93
|
|
94 ;;; latex-math-symbol.el ends here
|