Skip to content

Commit 89f6d80

Browse files
committed
doc: new pgf.documentclass rcParam and add release note
1 parent 1bf0be7 commit 89f6d80

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
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.

galleries/users_explain/text/pgf.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
pgf.preamble Lines to be included in the LaTeX preamble
4949
pgf.rcfonts Setup fonts from rc params using the fontspec package
5050
pgf.texsystem Either "xelatex" (default), "lualatex" or "pdflatex"
51+
pgf.documentclass The LaTeX document class to use (e.g., "article", "IEEEtran")
5152
================= =====================================================
5253
5354
.. note::
@@ -144,6 +145,7 @@
144145
if you want to do the font configuration yourself instead of using the fonts
145146
specified in the rc parameters, make sure to disable :rc:`pgf.rcfonts`.
146147
148+
147149
.. code-block:: python
148150
149151
import matplotlib as mpl
@@ -170,6 +172,17 @@
170172
ax.set_ylabel(r"\url{https://matplotlib.org}")
171173
ax.legend(["unicode math: $λ=∑_i^∞ μ_i^2$"])
172174
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+
173186
.. redirect-from:: /gallery/userdemo/pgf_texsystem
174187
175188
.. _pgf-texsystem:

0 commit comments

Comments
 (0)