1 ;;; latex-math-symbol.el --- LaTeX math symbol decoder
3 ;; Copyright (C) 1996,1997 MORIOKA Tomohiko
5 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
8 ;; $Id: latex-math-symbol.el,v 1.3 1997/01/14 11:30:27 morioka Exp morioka $
9 ;; Keywords: LaTeX, math, mule
11 ;; This file is part of MU (Message Utilities).
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.
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.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
31 ;; bytecompile this file and copy it to the apropriate directory.
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.
41 (defvar latex-math-symbol-table-alist
42 '(("\\alpha" . "
\e,Fa
\e(B")
43 ("\\beta" . "
\e,Fb
\e(B")
44 ("\\gamma" . "
\e,Fc
\e(B")("\\Gamma" . "
\e$B&#
\e(B")
45 ("\\delta" . "
\e,Fd
\e(B")("\\Delta" . "
\e$B&$
\e(B")
46 ("\\epsilon" . "
\e,Fe
\e(B")("\\varepsilon" . "
\e$B&E
\e(B")
47 ("\\zeta" . "
\e,Ff
\e(B")
48 ("\\eta" . "
\e,Fg
\e(B")
49 ("\\theta" . "
\e,Fh
\e(B")("\\Theta" . "
\e$B&(
\e(B")
50 ("\\iota" . "
\e,Fi
\e(B")
51 ("\\kappa" . "
\e,Fj
\e(B")
52 ("\\lambda" . "
\e,Fk
\e(B")("\\Lambda" . "
\e$B&+
\e(B")
53 ("\\mu" . "
\e,Fl
\e(B")
54 ("\\nu" . "
\e,Fm
\e(B")
55 ("\\xi" . "
\e,Fn
\e(B")("\\Xi" . "
\e$B&.
\e(B")
56 ("\\pi" . "
\e,Fp
\e(B")("\\Pi" . "
\e$B&0
\e(B")
57 ("\\rho" . "
\e,Fq
\e(B")
58 ("\\sigma" . "
\e,Fs
\e(B")("\\Sigma" . "
\e$B&2
\e(B")
59 ("\\varsigma" . "
\e,Fr
\e(B")
60 ("\\tau" . "
\e,Ft
\e(B")
61 ("\\upsilon" . "
\e,Fu
\e(B")("\\Upsilon" . "
\e$B&4
\e(B")
62 ("\\phi" . "
\e$B&U
\e(B")("\\Phi" . "
\e$B&5
\e(B")
63 ("\\varphi" . "
\e,Fv
\e(B")
64 ("\\chi" . "
\e,Fw
\e(B")
65 ("\\psi" . "
\e,Fx
\e(B")("\\Psi" . "
\e$B&7
\e(B")
66 ("\\omega" . "
\e,Fy
\e(B")("\\Omega" . "
\e$B&8
\e(B")
68 ("\\{" . "
\e$B!P
\e(B")("\\}" . "
\e$B!Q
\e(B")
69 ("\\langle\\!\\langle" . "
\e$B!T
\e(B")("\\rangle\\!\\rangle" . "
\e$B!U
\e(B")
70 ("\\langle" . "
\e$B!R
\e(B")("\\rangle" . "
\e$B!S
\e(B")
72 ("\\cdots" . "
\e$B!D
\e(B")
74 ("\\ln" . "
\e$(G"L
\e(B")
75 ("\\log" . "
\e$(G"K
\e(B")
77 ("\\pm" . "
\e$B!^
\e(B")
78 ("\\cdot" . "
\e$B!&
\e(B")
79 ("\\times" . "
\e$B!_
\e(B")("\\ast" . "
\e$B!v
\e(B")
80 ("\\star" . "
\e$B!z
\e(B")
81 ("\\bullet" . "
\e$B!&
\e(B")
82 ("\\div" . "
\e$B!`
\e(B")
83 ("\\cap" . "
\e$B"A
\e(B")("\\cup" . "
\e$B"@
\e(B")
84 ("\\lhd" . "
\e$(C"7
\e(B")("\\rhd" . "
\e$(C"9
\e(B")
85 ("\\bigcirc" . "
\e$B"~
\e(B")
86 ("\\vee" . "
\e$B"K
\e(B")("\\lor" . "
\e$B"K
\e(B")
87 ("\\wedge" . "
\e$B"J
\e(B")("\\land" . "
\e$B"J
\e(B")
88 ("\\oplus" . "
\e$(G"S
\e(B")
89 ("\\odot" . "
\e$(G"T
\e(B")
90 ("\\dagger" . "
\e$B"w
\e(B")("\\ddagger" . "
\e$B"x
\e(B")
92 ("\\leq" . "
\e$(C!B
\e(B")("\\geq" . "
\e$(C!C
\e(B")
93 ("\\le" . "
\e$(C!B
\e(B")("\\ge" . "
\e$(C!C
\e(B")
94 ("\\ll" . "
\e$B"c
\e(B")("\\gg" . "
\e$B"d
\e(B")
95 ("\\subseteq" . "
\e$B"<
\e(B")("\\supseteq" . "
\e$B"=
\e(B")
96 ("\\subset" . "
\e$B">
\e(B")("\\supset" . "
\e$B"?
\e(B")
97 ("\\in" . "
\e$B":
\e(B")
98 ("\\ni" . "
\e$B";
\e(B")("\\owns" . "
\e$B";
\e(B")
99 ("\\frown" . "
\e$B"^
\e(B")
100 ("\\mid" . "
\e$B!C
\e(B")("\\parallel" . "
\e$B!B
\e(B")
101 ("\\sim" . "
\e$B!A
\e(B")
102 ("\\equiv" . "
\e$B"a
\e(B")
103 ("\\approx" . "
\e$A!V
\e(B")
104 ("\\not=" . "
\e$B!b
\e(B")
105 ("\\neq" . "
\e$B!b
\e(B")("\\ne" . "
\e$B!b
\e(B")
106 ("\\perp" . "
\e$B"]
\e(B")
108 ("\\triangleup" . "
\e$B"$
\e(B")
109 ("\\forall" . "
\e$B"O
\e(B")
111 ("\\hbar" . "
\e,C1
\e(B")("\\imath" . "
\e,C9
\e(B")
112 ("\\ell" . "
\e$(C'$
\e(B")
113 ("\\partial" . "
\e$B"_
\e(B")
114 ("\\infty" . "
\e$B!g
\e(B")
115 ("\\smallint" . "
\e$B"i
\e(B")
116 ("\\P" . "
\e$B"y
\e(B")
117 ("\\prime" . "
\e$B!l
\e(B")
118 ("\\nabla" . "
\e$B"`
\e(B")
119 ("\\top" . "
\e$(D0#
\e(B")("\\bot" . "
\e$(D0"
\e(B")
120 ("\\vert" . "
\e$B!C
\e(B")("\\Vert" . "
\e$B!B
\e(B")
121 ("\\angle" . "
\e$B"\
\e(B")
122 ("\\triangle" . "
\e$B"$
\e(B")
123 ("\\backslash" . "
\e$B!@
\e(B")
124 ("\\S" . "
\e$B!x
\e(B")
125 ("\\forall" . "
\e$B"O
\e(B")
126 ("\\exists" . "
\e$B"P
\e(B")
127 ("\\neg" . "
\e$B"L
\e(B")("\\lnot" . "
\e$B"L
\e(B")
128 ("\\flat" . "
\e$B"u
\e(B")("\\sharp" . "
\e$B"t
\e(B")
129 ("\\clubsuit" . "
\e$(C"@
\e(B")
130 ("\\diamondsuit" . "
\e$B!~
\e(B")
131 ("\\heartsuit" . "
\e$(C"=
\e(B")
132 ("\\spadesuit" . "
\e$(C"<
\e(B")
134 ("\\leftarrow" . "
\e$B"+
\e(B")("\\rightarrow" . "
\e$B"*
\e(B")
135 ("\\gets" . "
\e$B"+
\e(B")("\\to" . "
\e$B"*
\e(B")
137 ("^1" . "
\e,A9
\e(B")("^{1}" . "
\e,A9
\e(B")
138 ("^2" . "
\e,A2
\e(B")("^{2}" . "
\e,A2
\e(B")
139 ("^3" . "
\e,A3
\e(B")("^{3}" . "
\e,A3
\e(B")
140 ("^4" . "
\e$(C)y
\e(B")("^{4}" . "
\e$(C)y
\e(B")
141 ("^n" . "
\e$(C)z
\e(B")("^{n}" . "
\e$(C)z
\e(B")
142 ("_1" . "
\e$(C){
\e(B")("_{1}" . "
\e$(C){
\e(B")
143 ("_2" . "
\e$(C)|
\e(B")("_{2}" . "
\e$(C)|
\e(B")
144 ("_3" . "
\e$(C)}
\e(B")("_{3}" . "
\e$(C)}
\e(B")
145 ("_4" . "
\e$(C)~
\e(B")("_{4}" . "
\e$(C)~
\e(B")
149 (defun latex-math-decode-region (beg end)
152 (narrow-to-region beg end)
153 (let ((rest latex-math-symbol-table-alist)
154 (case-fold-search nil)
157 (setq cell (car rest))
159 (while (re-search-forward
161 (regexp-quote (car cell))
162 "\\)\\([^a-zA-Z]\\|$\\)")
164 (delete-region (match-beginning 1)(match-end 1))
165 (goto-char (match-beginning 0))
168 (setq rest (cdr rest))
172 (defun latex-math-decode-buffer ()
174 (latex-math-decode-region (point-min)(point-max))
181 (provide 'latex-math-symbol)
183 ;;; latex-math-symbol.el ends here