stefano-meschiari / latex2exp

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

Error in `stop_vctrs()` ! Input must be a vector, not an environment. #63

Open wenyuhaokikika opened 11 months ago

wenyuhaokikika commented 11 months ago

Describe the bug I run the script

TeX('$\\alpha^\\beta$')

and it raise Exception:

Error in `stop_vctrs()`:
! Input must be a vector, not an environment.
Traceback:

TeX("$\\alpha^\\beta$")
parse_latex(input)
validate_input(latex_string)
str_detect(latex_string, fixed(possible_slash_pattern))
check_lengths(string, pattern)
vctrs::vec_size_common(string = string, pattern = pattern, replacement = replacement, 
 .     .call = error_call)
stop_scalar_type(.Primitive("quote")(<environment>), "")
stop_vctrs(msg, "vctrs_error_scalar_type", actual = x)
abort(message, class = c(class, "vctrs_error"), ...)
signal_abort(cnd, .file)

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 3.5.0 (2018-04-23)
    Platform: x86_64-pc-linux-gnu (64-bit)
    Running under: CentOS Linux 7 (Core)

Matrix products: default BLAS: /home/wyh/anaconda3/lib/R/lib/libRblas.so LAPACK: /home/wyh/anaconda3/lib/R/lib/libRlapack.so

locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] latex2exp_0.9.6

loaded via a namespace (and not attached): [1] fansi_0.5.0 utf8_1.2.2 digest_0.6.15 crayon_1.3.4
[5] IRdisplay_0.5.0 repr_0.15.0 lifecycle_1.0.3 jsonlite_1.5
[9] magrittr_2.0.1 evaluate_0.15 pillar_1.6.4 stringi_1.7.12 [13] rlang_1.1.1 cli_3.6.1 uuid_0.1-2 ellipsis_0.3.2 [17] vctrs_0.3.8 IRkernel_1.1.1 tools_3.5.0 stringr_1.5.0
[21] glue_1.6.2 fastmap_1.1.0 compiler_3.5.0 base64enc_0.1-3 [25] htmltools_0.5.2 pbdZMQ_0.3-3

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

3. What environment are plotting from? (e.g. RStudio, the R Console, Visual Studio Code, etc.)
I use jupyter `jupyter_server : 1.24.0`, anaconda ,centos7.

4. 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
```r
# example
library(latex2exp)
plot(TeX(r"($\alpha + \beta$)")) # <-- this doesn't render correctly

It raise Exception

Error in parse(text = x, srcfile = src): <text>:3:11: unexpected string constant
library(latex2exp)
plot(TeX(r"($\alpha + \beta$)"
             ^
Traceback: