[Bug]: Position and BBox of mathtext are slightly offset from the expected ones and inconsistent with normal text · Issue #29596 · matplotlib/matplotlib · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code above makes the following figure for PDF (afterwords converted into PNG using ImageMagick).
The bottom row shows normal text, and the top row shows math text.
While the normal text is at the center of the bbox, the math text is offset towards upper left.
Further, the bbox of math text is slightly wider than the bbox of normal text.
The behavior of math text seems also backend-dependent. The below is the figure in the PNG backend.
Oppositely to the PDF backend above, the bbox of math text is slightly narrower than the bbox of normal text, and the text seems to be offset towards right.
The ZIP file below contains the script and the figures made.
It would be ideal if the normal and the math text shows exactly the same positioning and the bbox for simple text, i.e., without super/subscripts and without math symbols.
It would be nice if the behavior becomes backend independent.
The behavior above is a bit inconvenient for me when making a figure for production. Particularly, when I need to write super/subscripts, I need to use the math-text mode. As demonstrated above, however, this makes the text slightly offset from the expected position.
I am looking forward to your kind feedback. Thank you so much for your help in advance.
Additional information
No response
Operating system
OS/X
Matplotlib Version
3.10.0
Matplotlib Backend
MacOSX
Python version
Python 3.11.8
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered:
Bug summary
I first thank all Matplotlib developers and contributors again for maintaining the software!
I would like to report a potential inconsistencies between normal text and math text; specifically:
Code for reproduction
Actual outcome
The code above makes the following figure for PDF (afterwords converted into PNG using ImageMagick).
The bottom row shows normal text, and the top row shows math text.
While the normal text is at the center of the bbox, the math text is offset towards upper left.
Further, the bbox of math text is slightly wider than the bbox of normal text.
The behavior of math text seems also backend-dependent. The below is the figure in the PNG backend.
Oppositely to the PDF backend above, the bbox of math text is slightly narrower than the bbox of normal text, and the text seems to be offset towards right.
The ZIP file below contains the script and the figures made.
mathtext.zip
Expected outcome
The behavior above is a bit inconvenient for me when making a figure for production. Particularly, when I need to write super/subscripts, I need to use the math-text mode. As demonstrated above, however, this makes the text slightly offset from the expected position.
I am looking forward to your kind feedback. Thank you so much for your help in advance.
Additional information
No response
Operating system
OS/X
Matplotlib Version
3.10.0
Matplotlib Backend
MacOSX
Python version
Python 3.11.8
Jupyter version
No response
Installation
conda
The text was updated successfully, but these errors were encountered: