Closed
Description
Bug report
Bug summary
Use of \textrm latex in Cairo backend raises an exception
Code for reproduction
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.use('Cairo')
mpl.rc('text', usetex=True)
fig, ax = plt.subplots()
ax.set_xlabel(r'$x [\textrm{cm}]$')
ax.scatter([1, 2], [1, 2], marker='o')
fig.savefig('test-cairo.png')
Raises an exception
ValueError:
x [\textrm{cm}]
^
Unknown symbol: \textrm, found '\' (at char 3), (line:1, col:4)
Expected outcome
The textrm should work to produce rm text. For reference, this works fine in the Agg
backend.
Matplotlib version
- Operating system: linux ubuntu
- Matplotlib version: 3.2.2
- Matplotlib backend: Cairo
- Python version: 3.7.6
Installed with conda