@@ -39,7 +39,7 @@ def assert_equality(plot, filename):
39
39
plt .close ()
40
40
41
41
this_dir = os .path .dirname (os .path .abspath (__file__ ))
42
- with open (os .path .join (this_dir , filename ), "r" ) as f :
42
+ with open (os .path .join (this_dir , filename ), "r" , encoding = "utf-8" ) as f :
43
43
reference = f .read ()
44
44
assert reference == code , _unidiff_output (reference , code )
45
45
@@ -52,19 +52,21 @@ def _does_compile(code):
52
52
matplotlib2tikz .get_tikz_code ()
53
53
54
54
# create a latex wrapper for the tikz
55
+ # <https://tex.stackexchange.com/a/361070/13262>
55
56
wrapper = """\\ documentclass{{standalone}}
56
57
\\ usepackage[utf8]{{inputenc}}
57
58
\\ usepackage{{pgfplots}}
58
59
\\ usepgfplotslibrary{{groupplots}}
59
60
\\ usetikzlibrary{{shapes.arrows}}
60
61
\\ pgfplotsset{{compat=newest}}
62
+ \\ DeclareUnicodeCharacter{{2212}}{{-}}
61
63
\\ begin{{document}}
62
64
{}
63
65
\\ end{{document}}""" .format (
64
66
code
65
67
)
66
68
tex_file = tmp_base + ".tex"
67
- with open (tex_file , "w" ) as f :
69
+ with open (tex_file , "w" , encoding = "utf-8" ) as f :
68
70
f .write (wrapper )
69
71
70
72
# change into the directory of the TeX file
0 commit comments