Skip to content

[Bug]: hyphen renders different length depending on presence of MathText #23268

@dstansby

Description

@dstansby

Bug summary

On current main branch a - character renders differently depending on whether there is maths in the string:

import matplotlib.pyplot as plt

fig, ax = plt.subplots()
ax.set_title('$1$-')
plt.show()

Screenshot 2022-06-14 at 10 18 10

ax.set_title('1-')

Screenshot 2022-06-14 at 10 18 49

Code for reproduction

-

Actual outcome

Expected outcome

Additional information

No response

Operating system

No response

Matplotlib Version

3.6.0.dev2449+g806d40721c

Matplotlib Backend

No response

Python version

No response

Jupyter version

No response

Installation

git checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    Release criticalFor bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.topic: text/mathtext

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions