Skip to content

[Bug]: minus signs not rendered in PDF export with TeX #31925

@Wrzlprmft

Description

@Wrzlprmft

Bug summary

When I use TeX to render, minus signs do not appear in exported PDFs anymore.

  • They show fine in Jupyter and exported PNGs or SVGs.
  • Other mathematical symbols are unaffected (also see the example). So far, I only found minus signs to be affected.
  • Activating axes.unicode_minus doesn’t help.
  • If I downgrade Matplotlib to 3.10.9 (and leave everything the same), the minuses are rendered. I therefore would exclude a straightforward problem with my TeX installation etc. Perhaps, this is related to Rasterize dvi files without dvipng. #30039.

Code for reproduction

from matplotlib.pyplot import subplots
from matplotlib import rcParams

rcParams["text.usetex"] = True
# rcParams["axes.unicode_minus"] = False

fig,axes = subplots(figsize=(3,2))
axes.plot([-1, 1], [-1, 1])
axes.text(-0.5,0.5,r"$\sum_{\alpha=-1}^{\Psi} \pm \pi$")

fig.savefig("test.pdf")

Actual outcome

Image

Expected outcome

Image

Operating system

Arch

Matplotlib Version

3.11.0

Matplotlib Backend

qtagg

Python version

3.14.5

Installation

Linux package manager

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions