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