sciapp / gr

GR framework: a graphics library for visualisation applications
Other
328 stars 55 forks source link

LaTeX exponent position #147

Closed gustaphe closed 4 months ago

gustaphe commented 2 years ago

I'm using Julia, but I think this issue comes from gr_textext (I'm copying this over from https://github.com/jheinen/GR.jl/issues/402). Tried to confirm in Python, but I couldn't figure out how.

When rendering LaTeX strings, the position of an exponent changes a lot if the symbol before it is encased in gull wings or not:

plot(rand(5); xguide=raw"$x^2 {x}^2 \mathrm{x}^2 \mathrm{x^2} \mathbf{x}^2 \mathbf{x^2}$")

grissues

the first, fourth and sixth are correct. The fourth demonstrates a workaround for the case of \mathrm (when the exponent is a number), but the sixth demonstrates why this isn't always an option.

In LaTeX, these exponents would all be the same height.