tm 7.81.
[elisp/mu-cite.git] / latex-math-symbol.el
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.2 1996/09/02 16:03:43 morioka 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"             . "\e$B&P\e(B")
43     
44     ("\\{"              . "\e$B!P\e(B")("\\}"             . "\e$B!Q\e(B")
45     
46     ("\\cdot"           . "\e$B!&\e(B")
47     ("\\times"          . "\e$B!_\e(B")
48     ("\\cap"            . "\e$B"A\e(B")("\\cup"           . "\e$B"@\e(B")
49     
50     ("\\leq"            . "\e$(C!B\e(B")("\\geq"          . "\e$(C!C\e(B")
51     ("\\le"             . "\e$(C!B\e(B")("\\ge"           . "\e$(C!C\e(B")
52     ("\\subseteq"       . "\e$B"<\e(B")("\\supseteq"      . "\e$B"=\e(B")
53     ("\\subset"         . "\e$B">\e(B")("\\supset"        . "\e$B"?\e(B")
54     ("\\in"             . "\e$B":\e(B")("\\ni"            . "\e$B";\e(B")
55     ("\\mid"            . "\e$B!C\e(B")
56     ("\\neq"            . "\e$B!b\e(B")("\\ne"            . "\e$B!b\e(B")
57     
58     ("\\forall"         . "\e$B"O\e(B")
59     
60     ("\\leftarrow"      . "\e$B"+\e(B")("\\rightarrow"    . "\e$B"*\e(B")
61     ("\\gets"           . "\e$B"+\e(B")("\\to"            . "\e$B"*\e(B")
62     
63     ("^1"               . "\e,A9\e(B")
64     ("^2"               . "\e,A2\e(B")
65     ("^3"               . "\e,A3\e(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