Skip to content

[MNT]: Use fix-cm rather than type1cm for LaTeX #27654

Description

@jakelevi1996

Summary

When I try use LaTeX with matplotlib (see script below), I get an error containing ! LaTeX Error: File type1cm.sty not found. On the site for type1cm, it says "Note that the LATEX distribution now contains a package fix-cm, which performs the task of type1cm, 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, whereas type1cm is not, so assuming this is generally true for other users, it would make more sense for matplotlib to use fix-cm instead of type1cm, as this should achieve the same results, and avoid forcing the user to install extra LaTeX packages.

import matplotlib.pyplot as plt
import matplotlib

matplotlib.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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions