8000 Add support for pgf.documentclass rcParam · matplotlib/matplotlib@23e0b0c · GitHub
[go: up one dir, main page]

Skip to content

Commit 23e0b0c

Browse files
committed
Add support for pgf.documentclass rcParam
1 parent a7c08c8 commit 23e0b0c

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,7 @@ def rc_params_from_file(fname, fail_on_error=False, use_default_template=True):
958958
# Strip leading comment.
959959
transform=lambda line: line[1:] if line.startswith("#") else line,
960960
fail_on_error=True)
961+
rcParamsDefault["pgf.documentclass"] = "article"
961962
rcParamsDefault._update_raw(rcsetup._hardcoded_defaults)
962963
rcParamsDefault._ensure_has_backend()
963964

lib/matplotlib/backends/backend_pgf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
_log = logging.getLogger(__name__)
3030

3131

32-
_DOCUMENTCLASS = r"\documentclass{article}"
32+
_DOCUMENTCLASS = (
33+
rf"\documentclass{{{mpl.rcParams.get('pgf.documentclass', 'article')}}}"
34+
)
3335

3436

3537
# Note: When formatting floating point values, it is important to use the

lib/matplotlib/rcsetup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1336,6 +1336,7 @@ def _convert_validator_spec(key, conv):
13361336
"pgf.texsystem": ["xelatex", "lualatex", "pdflatex"], # latex variant used
13371337
"pgf.rcfonts": validate_bool, # use mpl's rc settings for font config
13381338
"pgf.preamble": validate_string, # custom LaTeX preamble
1339+
"pgf.documentclass": validate_string, # LaTeX document class used by PGF backend
13391340

13401341
# write raster image data into the svg file
13411342
"svg.image_inline": validate_bool,

0 commit comments

Comments
 (0)
0