8000 Unexpected replacement of \right) with exlamation point in MathTextParser output · Issue #5210 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content
Unexpected replacement of \right) with exlamation point in MathTextParser output #5210
Open
@rsnape

Description

@rsnape

This bug report originates from my attempts to answer this question on Stack Overflow. Minimal example thanks to the other answer there by Baptiste.


With certain LaTeX strings, the right paranthesis indicates by \right) is replaced with an exclamation point when passed to MathTextParser and rendered as a bitmap or png. This behaviour appears to occur when the parantheses are around an expression comprising multiple layered fractions. It does not occur if \right] or \right\} are used

The minimal code to reproduce this is as follows:

import matplotlib.mathtext as mt

s = r'$\left(\frac{\frac{\frac{M}{I}}{N}}' \
     r'{\frac{\frac{B}{U}}{G}}\right)$'
parser = mt.MathTextParser("Bitmap")
for size in range(1, 30):
    filename = "figure{0}.png".format(size)
    parser.to_png(filename, s, fontsize=size)

This gives output like

Image with exclamation in

Investigations indicate that this occurs only for certain combinations of expression and font size, but the example given above seems to give the most consistent failure conditions. It may be related to dpi in the rendering, however this has not yet been conclusively proven or disproven.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0