-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlatex.py
More file actions
21 lines (18 loc) · 738 Bytes
/
latex.py
File metadata and controls
21 lines (18 loc) · 738 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import matplotlib as mpl
import matplotlib.pyplot as plt
def latexify(context):
plt.rc('text', usetex=True)
if context == 'talk':
mpl.rcParams['text.latex.preamble'] = [
r'\renewcommand*\familydefault{\sfdefault}',
r'\usepackage{siunitx}', # you'll need...
r'\sisetup{number-mode=text}', # ...this to force siunitx to actually use your fonts
r'\usepackage{sansmath}', # load up the sansmath so that math -> helvet
r'\sansmath', # <- tricky! -- gotta actually tell tex to use!
]
else:
mpl.rcParams['text.latex.preamble'] = [
r'\usepackage{siunitx}'
]
def delatexify():
plt.rc('text', usetex=False)