Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Description
Summary
When I try use LaTeX with matplotlib (see script below), I get an error containing! LaTeX Error: File type1cm.sty not found
. Onthe site fortype1cm
, it says "Note that the LATEX distribution now contains a packagefix-cm
, which performs the task oftype1cm
, as well as doing the same job for T1- and TS1-encoded ec fonts". On my system/LaTeX installation,fix-cm
is installed by default, whereastype1cm
is not, so assuming this is generally true for other users, it would make more sense for matplotlib to usefix-cm
instead oftype1cm
, as this should achieve the same results, and avoid forcing the user to install extra LaTeX packages.
importmatplotlib.pyplotaspltimportmatplotlibmatplotlib.rc('font',**{'family':'serif','serif': ['Computer Modern']})matplotlib.rc('text',usetex=True)plt.plot([1,2],c="b")plt.savefig("output.png")
Python 3.10.12
matplotlib Version: 3.8.2
Ubuntu 22.04.1 LTS
Proposed fix
Use fix-cm rather than type1cm for LaTeX