Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing spaces in LaTeX expressions when plotting using latex2exp #124

Open
colinbousige opened this issue Nov 28, 2022 · 3 comments
Open
Labels
bug Something isn't working

Comments

@colinbousige
Copy link

colinbousige commented Nov 28, 2022

Hello,

See original post here where the author of latex2exp tracked the issue to arise from the httpgd plot renderer.

When plotting using httpgd and latex2exp, LaTeX expressions are missing spaces and are distorted. Doing the same plot in the normal R png renderer yields the expected result.

image

To reproduce in a vanilla R terminal:

library(httpgd)
library(latex2exp)
hgd()
plot(TeX(r'($\alpha$ and also $\beta$)'))

yields this:
image

instead of this :

library(latex2exp)
plot(TeX(r'($\alpha$ and also $\beta$)'))

image

@nx10
Copy link
Owner

nx10 commented Dec 1, 2022

Hi!

Thanks for opening the issue.
I am very busy currently due to moving, but could you try to replicate the plot with svglite ( https://github.com/r-lib/svglite )?
Most of the font rendering code in httpgd is based on it.

@colinbousige
Copy link
Author

Hi

And thanks for your answer !
It doesn't seem like I can reproduce the problem with svglite, though:

library(svglite)
library(latex2exp)

svglite("test.svg")
plot(TeX(r'($\alpha$ and also $\beta$)'), cex=4)
dev.off()

The result is OK:
test

@nx10
Copy link
Owner

nx10 commented Dec 1, 2022

Thanks! Definitely a bug in httpgd then. I will investigate as soon as I have a bit of free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants