From e6b9604f1115696137893a8e895a4a919b557822 Mon Sep 17 00:00:00 2001 From: Grillard Date: Wed, 27 Jan 2016 18:33:28 +0000 Subject: [PATCH] Fix for latex call on PS backend on windows Sometimes, the filename for "latexfile" ends up in the short 8.3 format on windows, but latex does not like the `~ ` in the filename. --- lib/matplotlib/backends/backend_ps.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index a332eb4e72da..911c839a28a1 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -1452,6 +1452,10 @@ def convert_psfrags(tmpfile, psfrags, font_preamble, custom_preamble, # multiple if sys.platform == 'win32': precmd = '%s &&'% os.path.splitdrive(tmpdir)[0] else: precmd = '' + #Replace \\ for / so latex does not think there is a function call + latexfile = latexfile.replace("\\", "/") + # Replace ~ so Latex does not think it is line break + latexfile = latexfile.replace("~", "\\string~") command = '%s cd "%s" && latex -interaction=nonstopmode "%s" > "%s"'\ %(precmd, tmpdir, latexfile, outfile) verbose.report(command, 'debug')