From 34cb5cd9004b173c194e452194a9ee22f6c8c53f Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Fri, 24 Jul 2020 11:16:29 +0200 Subject: [PATCH] Fewer "soft" dependencies on LaTeX packages. In pgf_preamble_sgskip, replace examples of using `units` and `metalogo` package by `url`, which is in TeXLive latex-base (unlike the others) and thus most likely to be present (also, the url works in the pdf, which is nice). Remove dependency on xits-math.otf font. Sync the description of text.latex.preamble in classic.mplstyle with the current template description. This removes the substrings "\usepackage{bm},\usepackage{euler}", which caused some linux packagers in adding dependencies on these packages; moreover, the comma is now wrong. --- examples/userdemo/pgf_preamble_sgskip.py | 10 ++++---- .../mpl-data/stylelib/classic.mplstyle | 24 +++++++++++-------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/userdemo/pgf_preamble_sgskip.py b/examples/userdemo/pgf_preamble_sgskip.py index ad0ca6a4d508..99dcb3fa8da3 100644 --- a/examples/userdemo/pgf_preamble_sgskip.py +++ b/examples/userdemo/pgf_preamble_sgskip.py @@ -13,18 +13,16 @@ "text.usetex": True, # use inline math for ticks "pgf.rcfonts": False, # don't setup fonts from rc parameters "pgf.preamble": "\n".join([ - "\\usepackage{units}", # load additional packages - "\\usepackage{metalogo}", - "\\usepackage{unicode-math}", # unicode math setup - r"\setmathfont{xits-math.otf}", + r"\usepackage{url}", # load additional packages + r"\usepackage{unicode-math}", # unicode math setup r"\setmainfont{DejaVu Serif}", # serif font via preamble ]) }) plt.figure(figsize=(4.5, 2.5)) plt.plot(range(5)) -plt.xlabel("unicode text: я, ψ, €, ü, \\unitfrac[10]{°}{µm}") -plt.ylabel("\\XeLaTeX") +plt.xlabel("unicode text: я, ψ, €, ü") +plt.ylabel(r"\url{https://matplotlib.org}") plt.legend(["unicode math: $λ=∑_i^∞ μ_i^2$"]) plt.tight_layout(.5) diff --git a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle index b5430e554353..4f8cab109070 100644 --- a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle @@ -112,16 +112,20 @@ text.usetex : False # use latex for all text handling. The following fo # LaTeX \usepackage command, please inquire at the # matplotlib mailing list text.latex.preamble : # IMPROPER USE OF THIS FEATURE WILL LEAD TO LATEX FAILURES - # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP - # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO. - # preamble is a comma separated list of LaTeX statements - # that are included in the LaTeX document preamble. - # An example: - # text.latex.preamble : \usepackage{bm},\usepackage{euler} - # The following packages are always loaded with usetex, so - # beware of package collisions: color, geometry, graphicx, - # type1cm, textcomp. Adobe Postscript (PSSNFS) font packages - # may also be loaded, depending on your font settings + # AND IS THEREFORE UNSUPPORTED. PLEASE DO NOT ASK FOR HELP + # IF THIS FEATURE DOES NOT DO WHAT YOU EXPECT IT TO. + # text.latex.preamble is a single line of LaTeX code that + # will be passed on to the LaTeX system. It may contain + # any code that is valid for the LaTeX "preamble", i.e. + # between the "\documentclass" and "\begin{document}" + # statements. + # Note that it has to be put on a single line, which may + # become quite long. + # The following packages are always loaded with usetex, so + # beware of package collisions: color, geometry, graphicx, + # type1cm, textcomp. + # Adobe Postscript (PSSNFS) font packages may also be + # loaded, depending on your font settings. text.hinting : auto # May be one of the following: # 'none': Perform no hinting