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
| import matplotlib as mpl mpl.use("pgf") import matplotlib.pyplot as plt plt.rcParams.update({ "font.family": "serif", "text.usetex": True, "pgf.rcfonts": False, "pgf.preamble": [ "\\usepackage{units}", "\\usepackage{metalogo}", "\\usepackage{unicode-math}", r"\setmathfont{xits-math.otf}", r"\setmainfont{DejaVu Serif}", ] })
plt.figure(figsize=(4.5, 2.5)) plt.plot(range(5)) plt.xlabel("unicode text: я, ψ, €, ü, \\unitfrac[10]{°}{µm}") plt.ylabel("\\XeLaTeX") plt.legend(["unicode math: $λ=∑_i^∞ μ_i^2$"]) plt.tight_layout(.5)
plt.savefig("pgf_preamble.pdf") plt.savefig("pgf_preamble.png")
|