stefano-meschiari / latex2exp

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

Cannot handle \alpha_{02} #58

Closed arnabkrmaity closed 1 year ago

arnabkrmaity commented 1 year ago

Describe the bug Please briefly describe your problem and what output you expect.

I tried to print $ \alpha_{02} $ but it only can print $ \alpha_2 $ and omits 0. To Reproduce

  1. Paste the output of sessionInfo() (this should show, at minimum, the version of R, the platform, and the architecture you are running on)

R version 4.1.1 (2021-08-10) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19044)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] latex2exp_0.9.6 ggplot2_3.3.6

loaded via a namespace (and not attached): [1] rstudioapi_0.13 magrittr_2.0.1 tidyselect_1.1.1 munsell_0.5.0 colorspace_2.0-2 R6_2.5.1 rlang_1.0.6
[8] fansi_0.5.0 stringr_1.4.0 dplyr_1.0.10 tools_4.1.1 grid_4.1.1 gtable_0.3.0 utf8_1.2.2
[15] cli_3.4.1 DBI_1.1.2 withr_2.4.3 digest_0.6.28 assertthat_0.2.1 tibble_3.1.8 lifecycle_1.0.3
[22] farver_2.1.0 purrr_0.3.4 vctrs_0.5.1 glue_1.6.2 labeling_0.4.2 stringi_1.7.5 compiler_4.1.1
[29] pillar_1.8.1 generics_0.1.1 scales_1.1.1 OncoPh1BLRM_1.4.5 pkgconfig_2.0.3

  1. Include a short snippet of code I can use to reproduce the problem. You can use reprex::reprex() to quickly prepare a reproducible example.

a <- 1:100 plot(a, a^2, xlab=TeX("$\alpha$"), ylab=TeX("$\alpha^{02}$"))

  1. What environment are plotting from? (e.g. RStudio, the R Console, Visual Studio Code, etc.)

R Studio

  1. If the bug comprises unexpected visual output from TeX(), please paste a screenshot of what you see on your system. You can plot a single TeX expression by running
    # example
    library(latex2exp)
    plot(TeX(r"($\alpha + \beta$)")) # <-- this doesn't render correctly

Expected behavior A clear and concise description of what you expected to happen.

Additional context Add any other context about the problem here.

stefano-meschiari commented 1 year ago

Fixed in 0.9.7. The new release is available on the releases page and will be uploaded to CRAN after 01/05.