|
28 | 28 | _log = logging.getLogger(__name__)
|
29 | 29 |
|
30 | 30 |
|
| 31 | +DOCUMENTCLASS = r"\documentclass{article}" |
| 32 | + |
31 | 33 | # Note: When formatting floating point values, it is important to use the
|
32 | 34 | # %f/{:f} format rather than %s/{} to avoid triggering scientific notation,
|
33 | 35 | # which is not recognized by TeX.
|
@@ -185,7 +187,7 @@ class LatexManager:
|
185 | 187 | @staticmethod
|
186 | 188 | def _build_latex_header():
|
187 | 189 | latex_header = [
|
188 |
| - r"\documentclass{article}", |
| 190 | + DOCUMENTCLASS, |
189 | 191 | # Include TeX program name as a comment for cache invalidation.
|
190 | 192 | # TeX does not allow this to be the first line.
|
191 | 193 | rf"% !TeX program = {mpl.rcParams['pgf.texsystem']}",
|
@@ -814,7 +816,7 @@ def print_pdf(self, fname_or_fh, *, metadata=None, **kwargs):
|
814 | 816 | self.print_pgf(tmppath / "figure.pgf", **kwargs)
|
815 | 817 | (tmppath / "figure.tex").write_text(
|
816 | 818 | "\n".join([
|
817 |
| - r"\documentclass[12pt]{article}", |
| 819 | + DOCUMENTCLASS, |
818 | 820 | r"\usepackage[pdfinfo={%s}]{hyperref}" % pdfinfo,
|
819 | 821 | r"\usepackage[papersize={%fin,%fin}, margin=0in]{geometry}"
|
820 | 822 | % (w, h),
|
@@ -924,7 +926,7 @@ def _write_header(self, width_inches, height_inches):
|
924 | 926 | pdfinfo = ','.join(
|
925 | 927 | _metadata_to_str(k, v) for k, v in self._info_dict.items())
|
926 | 928 | latex_header = "\n".join([
|
927 |
| - r"\documentclass[12pt]{article}", |
| 929 | + DOCUMENTCLASS, |
928 | 930 | r"\usepackage[pdfinfo={%s}]{hyperref}" % pdfinfo,
|
929 | 931 | r"\usepackage[papersize={%fin,%fin}, margin=0in]{geometry}"
|
930 | 932 | % (width_inches, height_inches),
|
|
0 commit comments