From 07856d833672d925d712043fe9f8cc718377ea04 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Wed, 8 May 2019 02:38:16 +0200 Subject: [PATCH] Fix backend_pgf header. At least in some cases (i.e. locally...), tex appears to treat a first line of `% TeX program = ...` passed to its stdin as an empty filename followed by a comment, leading to a crash ("I can't find file ''"). Fix that by moving the comment to the second line. --- lib/matplotlib/backends/backend_pgf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/backends/backend_pgf.py b/lib/matplotlib/backends/backend_pgf.py index f44975690c84..7250f39b89dd 100644 --- a/lib/matplotlib/backends/backend_pgf.py +++ b/lib/matplotlib/backends/backend_pgf.py @@ -212,9 +212,10 @@ def _build_latex_header(): # fonts later when we don't expect the additional output on stdout. # TODO: is this sufficient? latex_header = [ + r"\documentclass{minimal}", # Include TeX program name as a comment for cache invalidation. + # TeX does not allow this to be the first line. r"% !TeX program = {}".format(rcParams["pgf.texsystem"]), - r"\documentclass{minimal}", latex_preamble, latex_fontspec, r"\begin{document}",