|
| 1 | +import re |
1 | 2 | from docutils.parsers.rst import Directive
|
2 | 3 |
|
3 | 4 | from matplotlib import _mathtext, _mathtext_data
|
4 | 5 |
|
| 6 | +bb_pattern = re.compile("Bbb[A-Z]") |
| 7 | +scr_pattern = re.compile("scr[a-zA-Z]") |
| 8 | +frak_pattern = re.compile("frak[A-Z]") |
5 | 9 |
|
6 | 10 | symbols = [
|
7 | 11 | ["Lower-case Greek",
|
|
17 | 21 | ["Hebrew",
|
18 | 22 | 6,
|
19 | 23 | r"""\aleph \beth \daleth \gimel""".split()],
|
| 24 | + ["Western Europe", |
| 25 | + 6, |
| 26 | + r"""\aa \AA \ae \AE \oe \OE""".split()], |
20 | 27 | ["Delimiters",
|
21 | 28 | 6,
|
22 | 29 | _mathtext.Parser._delims],
|
|
26 | 33 | ["Standard function names",
|
27 | 34 | 6,
|
28 | 35 | {fr"\{fn}" for fn in _mathtext.Parser._function_names}],
|
29 |
| - ["Binary operation and relation symbols", |
| 36 | + ["Binary operation symbols", |
| 37 | + 4, |
| 38 | + _mathtext.Parser._binary_operators], |
| 39 | + ["Relation symbols", |
30 | 40 | 4,
|
31 |
| - r"""\ast \pm \slash \cap \star \mp \cup \cdot \uplus |
32 |
| - \triangleleft \circ \odot \sqcap \triangleright \bullet \ominus |
33 |
| - \sqcup \bigcirc \oplus \wedge \diamond \oslash \vee |
34 |
| - \bigtriangledown \times \otimes \dag \bigtriangleup \div \wr |
35 |
| - \ddag \barwedge \veebar \boxplus \curlywedge \curlyvee \boxminus |
36 |
| - \Cap \Cup \boxtimes \bot \top \dotplus \boxdot \intercal |
37 |
| - \rightthreetimes \divideontimes \leftthreetimes \equiv \leq \geq |
38 |
| - \perp \cong \prec \succ \mid \neq \preceq \succeq \parallel \sim |
39 |
| - \ll \gg \bowtie \simeq \subset \supset \Join \approx \subseteq |
40 |
| - \supseteq \ltimes \asymp \sqsubset \sqsupset \rtimes \doteq |
41 |
| - \sqsubseteq \sqsupseteq \smile \propto \dashv \vdash \frown |
42 |
| - \models \in \ni \notin \approxeq \leqq \geqq \lessgtr \leqslant |
43 |
| - \geqslant \lesseqgtr \backsim \lessapprox \gtrapprox \lesseqqgtr |
44 |
| - \backsimeq \lll \ggg \gtreqqless \triangleq \lessdot \gtrdot |
45 |
| - \gtreqless \circeq \lesssim \gtrsim \gtrless \bumpeq \eqslantless |
46 |
| - \eqslantgtr \backepsilon \Bumpeq \precsim \succsim \between |
47 |
| - \doteqdot \precapprox \succapprox \pitchfork \Subset \Supset |
48 |
| - \fallingdotseq \subseteqq \supseteqq \risingdotseq \sqsubset |
49 |
| - \sqsupset \varpropto \preccurlyeq \succcurlyeq \Vdash \therefore |
50 |
| - \curlyeqprec \curlyeqsucc \vDash \because \blacktriangleleft |
51 |
| - \blacktriangleright \Vvdash \eqcirc \trianglelefteq |
52 |
| - \trianglerighteq \neq \vartriangleleft \vartriangleright \ncong |
53 |
| - \nleq \ngeq \nsubseteq \nmid \nsupseteq \nparallel \nless \ngtr |
54 |
| - \nprec \nsucc \subsetneq \nsim \supsetneq \nVDash \precnapprox |
55 |
| - \succnapprox \subsetneqq \nvDash \precnsim \succnsim \supsetneqq |
56 |
| - \nvdash \lnapprox \gnapprox \ntriangleleft \ntrianglelefteq |
57 |
| - \lneqq \gneqq \ntriangleright \lnsim \gnsim \ntrianglerighteq |
58 |
| - \coloneq \eqsim \nequiv \napprox \nsupset \doublebarwedge \nVdash |
59 |
| - \Doteq \nsubset \eqcolon \ne |
60 |
| - """.split()], |
| 41 | + _mathtext.Parser._relation_symbols], |
61 | 42 | ["Arrow symbols",
|
62 | 43 | 4,
|
63 |
| - r"""\leftarrow \longleftarrow \uparrow \Leftarrow \Longleftarrow |
64 |
| - \Uparrow \rightarrow \longrightarrow \downarrow \Rightarrow |
65 |
| - \Longrightarrow \Downarrow \leftrightarrow \updownarrow |
66 |
| - \longleftrightarrow \updownarrow \Leftrightarrow |
67 |
| - \Longleftrightarrow \Updownarrow \mapsto \longmapsto \nearrow |
68 |
| - \hookleftarrow \hookrightarrow \searrow \leftharpoonup |
69 |
| - \rightharpoonup \swarrow \leftharpoondown \rightharpoondown |
70 |
| - \nwarrow \rightleftharpoons \leadsto \dashrightarrow |
71 |
| - \dashleftarrow \leftleftarrows \leftrightarrows \Lleftarrow |
72 |
| - \Rrightarrow \twoheadleftarrow \leftarrowtail \looparrowleft |
73 |
| - \leftrightharpoons \curvearrowleft \circlearrowleft \Lsh |
74 |
| - \upuparrows \upharpoonleft \downharpoonleft \multimap |
75 |
| - \leftrightsquigarrow \rightrightarrows \rightleftarrows |
76 |
| - \rightrightarrows \rightleftarrows \twoheadrightarrow |
77 |
| - \rightarrowtail \looparrowright \rightleftharpoons |
78 |
| - \curvearrowright \circlearrowright \Rsh \downdownarrows |
79 |
| - \upharpoonright \downharpoonright \rightsquigarrow \nleftarrow |
80 |
| - \nrightarrow \nLeftarrow \nRightarrow \nleftrightarrow |
81 |
| - \nLeftrightarrow \to \Swarrow \Searrow \Nwarrow \Nearrow |
82 |
| - \leftsquigarrow |
83 |
| - """.split()], |
| 44 | + _mathtext.Parser._arrow_symbols], |
| 45 | + ["Dot symbols", |
| 46 | + 4, |
| 47 | + r"""\cdots \vdots \ldots \ddots \adots \Colon \therefore \because""".split()], |
| 48 | + ["Black-board characters", |
| 49 | + 6, |
| 50 | + [fr"\{symbol}" for symbol in _mathtext_data.tex2uni |
| 51 | + if re.match(bb_pattern, symbol)]], |
| 52 | + ["Script characters", |
| 53 | + 6, |
| 54 | + [fr"\{symbol}" for symbol in _mathtext_data.tex2uni |
| 55 | + if re.match(scr_pattern, symbol)]], |
| 56 | + ["Fraktur characters", |
| 57 | + 6, |
| 58 | + [fr"\{symbol}" for symbol in _mathtext_data.tex2uni |
| 59 | + if re.match(frak_pattern, symbol)]], |
| 60 | + |
84 | 61 | ["Miscellaneous symbols",
|
85 | 62 | 4,
|
86 | 63 | r"""\neg \infty \forall \wp \exists \bigstar \angle \partial
|
87 | 64 | \nexists \measuredangle \eth \emptyset \sphericalangle \clubsuit
|
88 | 65 | \varnothing \complement \diamondsuit \imath \Finv \triangledown
|
89 |
| - \heartsuit \jmath \Game \spadesuit \ell \hbar \vartriangle \cdots |
90 |
| - \hslash \vdots \blacksquare \ldots \blacktriangle \ddots \sharp |
| 66 | + \heartsuit \jmath \Game \spadesuit \ell \hbar \vartriangle |
| 67 | + \hslash \blacksquare \blacktriangle \sharp \increment |
91 | 68 | \prime \blacktriangledown \Im \flat \backprime \Re \natural
|
92 |
| - \circledS \P \copyright \ss \circledR \S \yen \AA \checkmark \$ |
93 |
| - \cent \triangle \QED \sinewave""".split()] |
| 69 | + \circledS \P \copyright \ss \circledR \S \yen \checkmark \$ |
| 70 | + \cent \triangle \QED \sinewave \dag \ddag \perthousand |
| 71 | + \lambdabar \L \l \O \o \Thorn \thorn \degree \danger \maltese |
| 72 | + \i \hermitmatrix \sterling""".split()] |
94 | 73 | ]
|
95 | 74 |
|
96 | 75 |
|
@@ -156,7 +135,9 @@ def setup(app):
|
156 | 135 | if sym[1:] not in _mathtext_data.tex2uni:
|
157 | 136 | print(sym)
|
158 | 137 |
|
| 138 | + # Add accents |
| 139 | + all_symbols.update({v[1:]: k for k, v in _mathtext.Parser._accent_map.items()}) |
159 | 140 | print("SYMBOLS NOT IN TABLE:")
|
160 |
| - for sym in _mathtext_data.tex2uni: |
| 141 | + for sym, val in _mathtext_data.tex2uni.items(): |
161 | 142 | if sym not in all_symbols:
|
162 |
| - print(sym) |
| 143 | + print(f"{sym} = {chr(val)}") |
0 commit comments