1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#! /usr/bin/env python
# Copyright (c) 2007-2008 PediaPress GmbH
# See README.txt for additional licensing information.
import re
def convertSymbols(latexsource):
def repl(mo):
name=mo.group(0)
return symbolMap.get(name, name)
latexsource = texcmd.sub(repl, latexsource)
return latexsource
texcmd = re.compile(r"\\[a-zA-Z]+")
symbolMap = {'\\Bbb': '\\mathbb',
'\\Complex': '\\mathbb{C}',
'\\Dagger': '\\ddagger',
'\\Darr': '\\Downarrow',
'\\Harr': '\\Leftrightarrow',
'\\Larr': '\\Leftarrow',
'\\Lrarr': '\\Leftrightarrow',
'\\N': '\\mathbb{N}',
'\\O': '\\emptyset',
'\\R': '\\mathbb{R}',
'\\Rarr': '\\Rightarrow',
'\\Reals': '\\mathbb{R}',
'\\Uarr': '\\Uparrow',
'\\Z': '\\mathbb{Z}',
'\\alef': '\\aleph',
'\\alefsym': '\\aleph',
'\\and': '\\land',
'\\ang': '\\angle',
'\\arccos': '\\mathop{\\mathrm{arccos}}',
'\\arccot': '\\mathop{\\mathrm{arccot}}',
'\\arccsc': '\\mathop{\\mathrm{arccsc}}',
'\\arcsec': '\\mathop{\\mathrm{arcsec}}',
'\\bold': '\\mathbf',
'\\bull': '\\bullet',
'\\clubs': '\\clubsuit',
'\\cnums': '\\mathbb{C}',
'\\dArr': '\\Downarrow',
'\\darr': '\\downarrow',
'\\diamonds': '\\diamondsuit',
'\\empty': '\\emptyset',
'\\exist': '\\exists',
'\\ge': '\\geq',
'\\hAar': '\\Leftrightarrow',
'\\harr': '\\leftrightarrow',
'\\hearts': '\\heartsuit',
'\\image': '\\Im',
'\\infin': '\\infty',
'\\isin': '\\in',
'\\lArr': '\\Leftarrow',
'\\lang': '\\langle',
'\\larr': '\\leftarrow',
'\\le': '\\leq',
'\\lrArr': '\\Leftrightarrow',
'\\lrarr': '\\leftrightarrow',
'\\natnums': '\\mathbb{N}',
'\\ne': '\\neq',
'\\or': '\\lor',
'\\part': '\\partial',
'\\plusmn': '\\pm',
'\\rArr': '\\Rightarrow',
'\\rang': '\\rangle',
'\\rarr': '\\rightarrow',
'\\real': '\\Re',
'\\reals': '\\mathbb{R}',
'\\sdot': '\\cdot',
'\\sect': '\\S',
'\\sgn': '\\mathop{\\mathrm{sgn}}',
'\\spades': '\\spadesuit',
'\\sub': '\\subset',
'\\sube': '\\subseteq',
'\\supe': '\\supseteq',
'\\thetasym': '\\vartheta',
'\\uArr': '\\Uparrow',
'\\uarr': '\\uparrow',
'\\weierp': '\\wp',
'\\Alpha': 'A{}',
'\\Beta': 'B{}',
'\\Epsilon': 'E{}',
'\\Zeta': 'Z{}',
'\\Eta': 'H{}',
'\\Iota': 'I{}',
'\\Kappa' : 'K{}',
'\\Mu': 'M{}',
'\\Nu': 'N{}',
'\\Rho': 'P{}',
'\\Tau': 'T{}',
'\\Chi': 'C{}',
}
|