Closed
Description
Bug report
Bug summary
When I use a very minimal example with the PGF backend I get an LaTeX error.
Code for reproduction
import matplotlib.pyplot as plt
import numpy as np
plt.rcParams.update({"pgf.texsystem": "pdflatex"})
x = np.linspace(-0.5, 0.5, 200)
fig, ax = plt.subplots()
ax.plot(x, x)
plt.savefig('out.pgf')
Actual outcome
ValueError: Error processing '−0.4'
LaTeX Output:
! Package inputenc Error: Unicode character − (U+2212)
(inputenc) not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
<*> ...ze{10.000000}{12.000000}\selectfont −0.4}
! ==> Fatal error occurred, no output PDF file produced!
Expected outcome
Matplotlib version
- Operating system: Linux 5.4.0-52-generic Wx image #57-Ubuntu SMP Thu Oct 15 10:57:00 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
- Matplotlib version: 3.3.2
- Matplotlib backend (
print(matplotlib.get_backend())
): GTK3Agg - Python version: Python 3.8.5
- Other libraries: Numpy ('1.18.4')
pdflatex --version
:
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian)
kpathsea version 6.3.1
Copyright 2019 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.37; using libpng 1.6.37
Compiled with zlib 1.2.11; using zlib 1.2.11
Compiled with xpdf version 4.01