File tree 2 files changed +21
-0
lines changed
galleries/users_explain/text 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ PGF backend: new rcParam :rc: `pgf.documentclass `
2
+ ------------------------------------------------
3
+
4
+ A new rcParam :rc: `pgf.documentclass ` has been added to allow users to override
5
+ the default LaTeX document class (``article ``) used by the PGF backend.
6
+ This enables better compatibility when including PGF figures in documents that
7
+ use custom LaTeX classes like ``IEEEtran `` or others, avoiding layout
8
+ issues like incorrect font sizes or spacing mismatches.
Original file line number Diff line number Diff line change 48
48
pgf.preamble Lines to be included in the LaTeX preamble
49
49
pgf.rcfonts Setup fonts from rc params using the fontspec package
50
50
pgf.texsystem Either "xelatex" (default), "lualatex" or "pdflatex"
51
+ pgf.documentclass The LaTeX document class to use (e.g., "article", "IEEEtran")
51
52
================= =====================================================
52
53
53
54
.. note::
144
145
if you want to do the font configuration yourself instead of using the fonts
145
146
specified in the rc parameters, make sure to disable :rc:`pgf.rcfonts`.
146
147
148
+
147
149
.. code-block:: python
148
150
149
151
import matplotlib as mpl
170
172
ax.set_ylabel(r"\url{https://matplotlib.org}")
171
173
ax.legend(["unicode math: $λ=∑_i^∞ μ_i^2$"])
172
174
175
+ You can also change the LaTeX document class used when generating PGF figures.
176
+ By default, Matplotlib uses ``article``, but you can override this using
177
+ the ``pgf.documentclass`` rcParam::
178
+
179
+ import matplotlib.pyplot as plt
180
+ plt.rcParams["pgf.documentclass"] = "IEEEtran"
181
+
182
+ This is useful when including PGF figures into LaTeX documents using
183
+ custom classes such as ``IEEEtran``, to avoid layout
184
+ mismatches in font size or spacing.
185
+
173
186
.. redirect-from:: /gallery/userdemo/pgf_texsystem
174
187
175
188
.. _pgf-texsystem:
You can’t perform that action at this time.
0 commit comments