File tree 1 file changed +10
-6
lines changed 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 1
1
r"""
2
- *********************************
3
- Typesetting with XeLaTeX/LuaLaTeX
4
- *********************************
5
-
6
- How to typeset text with the ``pgf`` backend in Matplotlib.
2
+ *********************************************************
3
+ Typesetting with XeLaTeX/LuaLaTeX via the ``pgf`` backend
4
+ *********************************************************
7
5
8
6
Using the ``pgf`` backend, Matplotlib can export figures as pgf drawing
9
7
commands that can be processed with pdflatex, xelatex or lualatex. XeLaTeX and
53
51
54
52
Generally, these characters must be escaped correctly. For convenience,
55
53
some characters (_, ^, %) are automatically escaped outside of math
56
- environments.
54
+ environments. Other characters are not escaped as they are commonly needed
55
+ in actual TeX expressions. However, one can configure TeX to treat them as
56
+ "normal" characters (known as "catcode 12" to TeX) via a custom preamble,
57
+ such as::
58
+
59
+ plt.rcParams["pgf.preamble"] = (
60
+ r"\AtBeginDocument{\catcode`\&=12\catcode`\#=12}")
57
61
58
62
.. _pgf-rcfonts:
59
63
You can’t perform that action at this time.
0 commit comments