gadenbuie / xaringanthemer

😎 Give your xaringan slides some style

Home Page:https://pkg.garrickadenbuie.com/xaringanthemer/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to knit the template 'Ninja Themed Presentation'

beatrizmilz opened this issue Β· comments

Hi Garrick!

This happened sometimes and I'm not sure if is reproducible.

When I create a .Rmd with the template 'Ninja Themed Presentation' and just knit right away (without changing it, which is good to be 'renderable' for people that are being introduced to the package), RMarkdown returns an error:

Error in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : polygon edge not found

image

It says that the 'problem' is with line 308. So if I comment the code for xaringanthemer::theme_xaringan() in this chunk, the file renders fine:

```{r plot-example-themed, eval=requireNamespace("ggplot2", quietly=TRUE)}
 g + #xaringanthemer::theme_xaringan(text_font_size = 16, title_font_size = 18) +
 ggtitle("A Plot About Cars")
```

I tested and seems like I can't use xaringanthemer::theme_xaringan() and that's why the template does not work on the fly.

Do you know if this is happening to more people? I'm not sure if I should install something different in order for it to work.

These are my system information, I'm using an m1:

> Sys.info()
                                                                                                sysname 
                                                                                               "Darwin" 
                                                                                                release 
                                                                                               "20.5.0" 
                                                                                                version 
"Darwin Kernel Version 20.5.0: Sat May  8 05:10:31 PDT 2021; root:xnu-7195.121.3~9/RELEASE_ARM64_T8101" 
                                                                                               nodename 
                                                                         "MacBook-Air-de-Beatriz.local" 
                                                                                                machine 
                                                                                               "x86_64" 
                                                                                                  login 
                                                                                                 "root" 
                                                                                                   user 
                                                                                          "beatrizmilz" 
                                                                                         effective_user 
                                                                                          "beatrizmilz" 

Thank you :)

Thanks for reporting the issue @beatrizmilz! Can you share the results of devtools::session_info("xaringanthemer")?

Hi Garrick! There it goes, i'm using the CRAN version of xaringanthemer. Do you want me to test if this happens with the GitHub version aswell?

> devtools::session_info("xaringanthemer")
─ Session info ────────────────────────────────────────────────
 setting  value                       
 version  R version 4.1.0 (2021-05-18)
 os       macOS Big Sur 11.4          
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Sao_Paulo           
 date     2021-08-29                  

─ Packages ────────────────────────────────────────────────────
 package        * version date       lib source        
 colorspace       2.0-2   2021-06-24 [1] CRAN (R 4.1.0)
 glue             1.4.2   2020-08-27 [1] CRAN (R 4.1.0)
 magrittr         2.0.1   2020-11-17 [1] CRAN (R 4.1.0)
 purrr            0.3.4   2020-04-17 [1] CRAN (R 4.1.0)
 rlang            0.4.11  2021-04-30 [1] CRAN (R 4.1.0)
 whisker          0.4     2019-08-28 [1] CRAN (R 4.1.0)
 xaringanthemer   0.4.0   2021-06-24 [1] CRAN (R 4.1.0)

[1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library

My guess is that maybe the showtext package isn't installed, in which case ggplot won't find the fonts used by that slide theme. Can you try installing xaringanthemer with all its dependencies?

install.packages("xaringanthemer", dependencies = TRUE)

Garrick, that was it!
Now the template is rendering fine without errors.

Sorry for bothering for something this simple :(

I have a workshop about xaringan soon and I wanted to introduce xaringanextra. So I'll give the tip to install it with dependencies = TRUE. Thank you so much for your help (and soooorry for posting on Sunday).

No worries! I had intended for the template to work even if showtext isn't installed, so I'll open this as a reminder to fix it. In fact, I should probably add a slide that shows up if showtext is missing with some extra guidance.