|
29 | 29 | _log = logging.getLogger(__name__)
|
30 | 30 |
|
31 | 31 |
|
32 |
| -_DOCUMENTCLASS = ( |
33 |
| - rf"\documentclass{{{mpl.rcParams.get('pgf.documentclass', 'article')}}}" |
34 |
| -) |
35 |
| - |
36 |
| - |
37 | 32 | # Note: When formatting floating point values, it is important to use the
|
38 | 33 | # %f/{:f} format rather than %s/{} to avoid triggering scientific notation,
|
39 | 34 | # which is not recognized by TeX.
|
@@ -207,7 +202,7 @@ class LatexManager:
|
207 | 202 | @staticmethod
|
208 | 203 | def _build_latex_header():
|
209 | 204 | latex_header = [
|
210 |
| - _DOCUMENTCLASS, |
| 205 | + rf"\documentclass{{{mpl.rcParams.get('pgf.documentclass', 'article')}}}", |
211 | 206 | # Include TeX program name as a comment for cache invalidation.
|
212 | 207 | # TeX does not allow this to be the first line.
|
213 | 208 | rf"% !TeX program = {mpl.rcParams['pgf.texsystem']}",
|
@@ -836,7 +831,8 @@ def print_pdf(self, fname_or_fh, *, metadata=None, **kwargs):
|
836 | 831 | self.print_pgf(tmppath / "figure.pgf", **kwargs)
|
837 | 832 | (tmppath / "figure.tex").write_text(
|
838 | 833 | "\n".join([
|
839 |
| - _DOCUMENTCLASS, |
| 834 | + rf"\documentclass{{{mpl.rcParams.get( |
| 835 | + 'pgf.documentclass', 'article')}}}", |
840 | 836 | r"\usepackage[pdfinfo={%s}]{hyperref}" % pdfinfo,
|
841 | 837 | r"\usepackage[papersize={%fin,%fin}, margin=0in]{geometry}"
|
842 | 838 | % (w, h),
|
@@ -933,7 +929,7 @@ def _write_header(self, width_inches, height_inches):
|
933 | 929 | pdfinfo = ','.join(
|
934 | 930 | _metadata_to_str(k, v) for k, v in self._info_dict.items())
|
935 | 931 | latex_header = "\n".join([
|
936 |
| - _DOCUMENTCLASS, |
| 932 | + rf"\documentclass{{{mpl.rcParams.get('pgf.documentclass', 'article')}}}", |
937 | 933 | r"\usepackage[pdfinfo={%s}]{hyperref}" % pdfinfo,
|
938 | 934 | r"\usepackage[papersize={%fin,%fin}, margin=0in]{geometry}"
|
939 | 935 | % (width_inches, height_inches),
|
|
0 commit comments