Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a567601

Browse files
committed
Provide way to access STIX "letterlike" symbols using LaTeX font
commands. Add "stixsans" option to typeset math with sans-serif glyphs. svn path=/trunk/matplotlib/; revision=4231
1 parent ad5a637 commit a567601

9 files changed

Lines changed: 404 additions & 572 deletions

File tree

CHANGELOG

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
2007-11-12 Added support for STIX fonts. A new rcParam,
2+
mathtext.fontset, can be used to choose between:
3+
4+
'cm':
5+
The TeX/LaTeX Computer Modern fonts
6+
7+
'stix':
8+
The STIX fonts (see stixfonts.org)
9+
10+
'stixsans':
11+
The STIX fonts, using sans-serif glyphs by default
12+
13+
'custom':
14+
A generic Unicode font, in which case the mathtext font
15+
must be specified using mathtext.bf, mathtext.it,
16+
mathtext.sf etc.
17+
18+
Added a new example, stix_fonts_demo.py to show how to access
19+
different fonts and unusual symbols.
20+
21+
- MGD
22+
123
2007-11-12 Options to disable building backend extension modules moved
224
from setup.py to setup.cfg - DSD
325

examples/mathtext_examples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
r'$\widehat{abc}\widetilde{def}$',
5050
r'$\Gamma \Delta \Theta \Lambda \Xi \Pi \Sigma \Upsilon \Phi \Psi \Omega$',
5151
r'$\alpha \beta \gamma \delta \epsilon \zeta \eta \theta \iota \lambda \mu \nu \xi \pi \kappa \rho \sigma \tau \upsilon \phi \chi \psi$',
52-
#ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
52+
ur'Generic symbol: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
5353
]
5454

5555
from pylab import *
@@ -66,7 +66,7 @@ def doall():
6666
print (i, s)
6767
text(0.1, -i, s, fontsize=20)
6868

69-
#savefig('mathtext_example')
69+
savefig('mathtext_examples')
7070
#close('all')
7171
show()
7272

examples/stix_fonts_demo.py

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/env python
2+
3+
import os, sys, re
4+
5+
import gc
6+
7+
stests = [
8+
r'$\mathcircled{123} \mathrm{\mathcircled{123}} \mathbf{\mathcircled{123}}$',
9+
r'$\mathsf{Sans \Omega} \mathrm{\mathsf{Sans \Omega}} \mathbf{\mathsf{Sans \Omega}}$',
10+
r'$\mathtt{Monospace}$',
11+
r'$\mathcal{CALLIGRAPHIC}$',
12+
r'$\mathbb{Blackboard \pi}$',
13+
r'$\mathrm{\mathbb{Blackboard \pi}}$',
14+
r'$\mathbf{\mathbb{Blackboard \pi}}$',
15+
r'$\mathfrak{Fraktur} \mathbf{\mathfrak{Fraktur}}$',
16+
r'$\mathscr{Script}$',
17+
ur'Direct Unicode: $\u23ce \mathrm{\ue0f2 \U0001D538}$'
18+
]
19+
20+
from pylab import *
21+
22+
def doall():
23+
tests = stests
24+
25+
figure(figsize=(8, (len(tests) * 1) + 2))
26+
plot([0, 0], 'r')
27+
grid(False)
28+
axis([0, 3, -len(tests), 0])
29+
yticks(arange(len(tests)) * -1)
30+
for i, s in enumerate(tests):
31+
print (i, s)
32+
text(0.1, -i, s, fontsize=32)
33+
34+
savefig('stix_fonts_example')
35+
#close('all')
36+
show()
37+
38+
if '--latex' in sys.argv:
39+
fd = open("stix_fonts_examples.ltx", "w")
40+
fd.write("\\documentclass{article}\n")
41+
fd.write("\\begin{document}\n")
42+
fd.write("\\begin{enumerate}\n")
43+
44+
for i, s in enumerate(stests):
45+
s = re.sub(r"(?<!\\)\$", "$$", s)
46+
fd.write("\\item %s\n" % s)
47+
48+
fd.write("\\end{enumerate}\n")
49+
fd.write("\\end{document}\n")
50+
fd.close()
51+
52+
os.system("pdflatex stix_fonts_examples.ltx")
53+
else:
54+
doall()

0 commit comments

Comments
 (0)