Error: NegativeOrZeroImageSize
Closed this issue · 11 comments
Hi! The README for equatiomatic no longer renders with the GitHub version of texPreview, and I see it's no longer on CRAN.
This is the error I'm getting when I try to knit this README file.
Error:
! R: NegativeOrZeroImageSize `' @ error/image.c/CloneImage/795
Backtrace:
- extract_eq(mod1) %>% tex_preview(usrPackages = usrPackages)
- texPreview:::tex_preview.equation(., usrPackages = usrPackages)
- texPreview:::tex_preview.character(...)
- texPreview:::tex_preview.default(...)
- texPreview:::tex_viewer(imgOut, stem)
- magick::image_write(imgOut, thispath, flatten = TRUE)
- magick:::magick_image_write(...)
Execution halted
This is what it's trying to run
usrPackages <- "\\renewcommand*\\familydefault{\\rmdefault}"
library(equatiomatic)
mod1 <- lm(mpg ~ cyl + disp, mtcars)
extract_eq(mod1) %>%
tex_preview(usrPackages = usrPackages)
I'm trying to get equatiomatic back on CRAN so I'd like to get this fixed. If it's too much work or will take a while to fix, I'll just skip it for now, but I wanted to see if it was something relating to texPreview that was easy to fix.
I'll try and resubmit the package to cran. They were having issues with a specific distribution of fedora (yes that fun one) and I didn't want to deal with chasing down why the 1 build was failing on a machine i would need to hunt down to test on.
try this on your system
# pak::pkg_install('yonicd/texPreview@yonicd-patch-1')
# pak::pkg_install('datalorax/equatiomatic')
library(texPreview)
library(equatiomatic)
usrPackages <- "\\renewcommand*\\familydefault{\\rmdefault}"
mod1 <- lm(mpg ~ cyl + disp, mtcars)
mod1 |>
extract_eq() |>
tex_preview(usrPackages = usrPackages)
not sure why though you are passing that command in usrPackages, those arent libraries, right?
@datalorax all gha tests are passing now on the PR. let me know if you can render your readme and I will merge this patch and resubmit to cran
Great, thank you! I'll check quickly and get back to you.
Hmm... still doesn't seem to be working for me.
library(texPreview)
library(equatiomatic)
usrPackages <- "\\renewcommand*\\familydefault{\\rmdefault}"
mod1 <- lm(mpg ~ cyl + disp, mtcars)
mod1 |>
extract_eq() |>
tex_preview(usrPackages = usrPackages)
#> Warning in magick::image_write(imgOut, thispath, flatten = TRUE): Writing image
#> with 0 frames
#> Error in eval(expr, envir, enclos): R: NegativeOrZeroImageSize `' @ error/image.c/CloneImage/795
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.3.1 (2023-06-16)
#> os macOS Monterey 12.6.3
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz America/Los_Angeles
#> date 2023-12-05
#> pandoc 2.18 @ /Applications/quarto/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> backports 1.4.1 2021-12-13 [1] CRAN (R 4.3.0)
#> base64enc 0.1-3 2015-07-28 [1] CRAN (R 4.3.0)
#> broom 1.0.5 2023-06-09 [1] CRAN (R 4.3.0)
#> cli 3.6.1 2023-03-23 [1] CRAN (R 4.3.0)
#> clipr 0.8.0 2022-02-22 [1] CRAN (R 4.3.0)
#> desc 1.4.2 2022-09-08 [1] CRAN (R 4.3.0)
#> details 0.3.0 2022-03-27 [1] CRAN (R 4.3.0)
#> digest 0.6.33 2023-07-07 [1] CRAN (R 4.3.0)
#> dplyr 1.1.4 2023-11-17 [1] CRAN (R 4.3.1)
#> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.3.0)
#> equatiomatic * 0.3.1 2023-12-05 [1] local
#> evaluate 0.23 2023-11-01 [1] CRAN (R 4.3.1)
#> fansi 1.0.5 2023-10-08 [1] CRAN (R 4.3.1)
#> fastmap 1.1.1 2023-02-24 [1] CRAN (R 4.3.0)
#> fs 1.6.3 2023-07-20 [1] CRAN (R 4.3.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.3.0)
#> glue 1.6.2 2022-02-24 [1] CRAN (R 4.3.0)
#> htmltools 0.5.7 2023-11-03 [1] CRAN (R 4.3.1)
#> httpuv 1.6.12 2023-10-23 [1] CRAN (R 4.3.1)
#> httr 1.4.7 2023-08-15 [1] CRAN (R 4.3.0)
#> knitr 1.45 2023-10-30 [1] CRAN (R 4.3.1)
#> later 1.3.1 2023-05-02 [1] CRAN (R 4.3.0)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.3.1)
#> magick 2.8.1 2023-10-22 [1] CRAN (R 4.3.1)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.3.0)
#> mime 0.12 2021-09-28 [1] CRAN (R 4.3.0)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.3.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.3.0)
#> png 0.1-8 2022-11-29 [1] CRAN (R 4.3.0)
#> promises 1.2.1 2023-08-10 [1] CRAN (R 4.3.0)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.3.0)
#> R.cache 0.16.0 2022-07-21 [1] CRAN (R 4.3.0)
#> R.methodsS3 1.8.2 2022-06-13 [1] CRAN (R 4.3.0)
#> R.oo 1.25.0 2022-06-12 [1] CRAN (R 4.3.0)
#> R.utils 2.12.2 2022-11-11 [1] CRAN (R 4.3.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.3.0)
#> Rcpp 1.0.11 2023-07-06 [1] CRAN (R 4.3.0)
#> rematch2 2.1.2 2020-05-01 [1] CRAN (R 4.3.0)
#> reprex 2.0.2 2022-08-17 [1] CRAN (R 4.3.0)
#> rlang 1.1.2 2023-11-04 [1] CRAN (R 4.3.1)
#> rmarkdown 2.25.2 2023-12-05 [1] Github (rstudio/rmarkdown@0951a2f)
#> rprojroot 2.0.4 2023-11-05 [1] CRAN (R 4.3.1)
#> rstudioapi 0.15.0 2023-07-07 [1] CRAN (R 4.3.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.3.0)
#> shiny 1.8.0 2023-11-17 [1] CRAN (R 4.3.1)
#> styler 1.10.2 2023-08-29 [1] CRAN (R 4.3.0)
#> svgPanZoom 0.3.4 2020-02-15 [1] CRAN (R 4.3.0)
#> texPreview * 2.0.1 2023-12-05 [1] Github (yonicd/texPreview@a2daf7f)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.3.0)
#> tidyr 1.3.0 2023-01-24 [1] CRAN (R 4.3.0)
#> tidyselect 1.2.0 2022-10-10 [1] CRAN (R 4.3.0)
#> tinytex 0.49 2023-11-22 [1] CRAN (R 4.3.1)
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.3.1)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.3.1)
#> whisker 0.4.1 2022-12-05 [1] CRAN (R 4.3.0)
#> withr 2.5.2 2023-10-30 [1] CRAN (R 4.3.1)
#> xfun 0.41 2023-11-01 [1] CRAN (R 4.3.1)
#> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.3.1)
#> xtable 1.8-4 2019-04-21 [1] CRAN (R 4.3.0)
#> yaml 2.3.7 2023-01-23 [1] CRAN (R 4.3.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library
#>
#> ──────────────────────────────────────────────────────────────────────────────
Created on 2023-12-05 with reprex v2.0.2
what version of imagemagick do you have on your machine?
> convert --version
Version: ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jpeg lcms lqr ltdl lzma openexr pangocairo png tiff webp wmf x xml zlib
Ah... that was it. I'm on a new machine and I actually hadn't even installed it yet. Thank you!
let me know if you can render the doc after installing the dependency.
It rendered!
Checking in to see if you'll be submitting to CRAN again soon? If so, I'll wait for that before resubmitting equatiomatic. If not, I'll figure something else out.