Skip to content

[Bug]: \right) is replaced with exclamation mark when using fontset='cm' #29886

Closed as duplicate of#5210
@Mackemania

Description

@Mackemania

Bug summary

This is similar to 5210. The right big parenthesis is replaced with an exclamation mark for certain latex code.

Multiple queries were tested as follows.

Code for reproduction

import matplotlib.pyplot as plt

plt.rc('mathtext', fontset='cm')
working_texts = ['\\left(\\int_x \\right)', '\\left(\\int^x \\right)']
bugged_texts = ['\\left(\\int_x^x \\right)', '\\left(\\int_{x}^{x} \\right)']
plt.text(0.5, 0.5, fr'${bugged_texts[0]}$', parse_math=True)
plt.show()

Actual outcome

Actual:
Image

Expected outcome

Expected:
Image
(But with the upper bound of the integral present)

Additional information

I have only tested with mathtext fontset 'cm' and without setting it. The default font does display it correctly.
As far as I've tested it only happens when both upper and lower bound of the integral is set. Using \sum or \iint instead of \int also works correctly with both bounds. \oint however causes the same issue.

Operating system

Windows

Matplotlib Version

3.10.0

Matplotlib Backend

module://backend_interagg

Python version

3.12.5, 3.13

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions