stefano-meschiari / latex2exp

Use LaTeX in R graphics.
Other
185 stars 10 forks source link

Add ceil and floor symbols #33

Closed AntoineSoetewey closed 2 years ago

AntoineSoetewey commented 2 years ago

Hello,

Unless I'm mistaken, \lceil, \rceil, \lfloor and \rfloor symbols are not supported (see section "Supported LaTeX" in this vignette).

I would like to use the \rceil symbol in the axis label of my plot, would you mind adding these symbols?

Thanks in advance for your help and for building this package.

Regards, Antoine

stefano-meschiari commented 2 years ago

Hi Antoine,

Sorry for taking so long to address this FR. Would you be able to try this pre-release version (0.9.0) and test \lceil / \lfloor?

https://github.com/stefano-meschiari/latex2exp/tree/0.9.0

stefano-meschiari commented 2 years ago

As an example,

TeX(r"($\lceil a+b \rceil$)")

currently renders as image in the new version.

AntoineSoetewey commented 2 years ago

Thanks for your reply.

I have tried but without success.

Here is a reprex:

devtools::install_github('stefano-meschiari/latex2exp', ref = 'v0.9.0')
library(latex2exp)
plot(x = rnorm(10),
     y = rnorm(10),
     ylab = TeX(r"($\lceil a+b \rceil$)"))

Screenshot 2022-01-21 at 16 46 39

Am I missing something?

stefano-meschiari commented 2 years ago

Interesting, the same reprex on my system appears to work correctly:

image

(note that with default margins, the leftmost few pixels y-axis label gets cut off a bit -- that's an issue with base graphics, not latex2exp; increasing margins fixes it).

Could you double-check the version of latex2exp loaded is indeed 0.9.0, and paste the output of sessionInfo() here?

AntoineSoetewey commented 2 years ago

I updated everything and now it works fine.

Thanks again !