gadenbuie / xaringanExtra

:ferris_wheel: A playground of enhancements and extensions for xaringan slides.
https://pkg.garrickadenbuie.com/xaringanExtra
Other
448 stars 36 forks source link

use_freezeframe() ignores chunk option 'out.width' ? #137

Closed yyzeng closed 2 years ago

yyzeng commented 2 years ago

@gadenbuie Hi Garrick, Thanks for all your great work! I love scribble, tile-view, freezeframe, etc. 👍

Today I added xaringanExtra::use_freezeframe() in my xaringan slides. After knited, I found that the gif has occupied its container 100%, even though I have set chunk option out.width = '60%'. I use knitr::include_graphics("imgs/my_gif.gif") to add the gif. I also found that use_freezeframe() might ignore the chunk option fig.align when printing manually to pdf via Google Chrome. I also can't figure out why.

yyzeng commented 2 years ago

Sorry, I have just found the link https://github.com/gadenbuie/xaringanExtra/issues/103#issue-844391079. I got it and responsive = FALSE worked for me too! 👍😄

But what about the second issue? Hereafter is the reprex codes:

---
title: 'Test'
output:
  xaringan::moon_reader
---

```{r setup, echo=FALSE}
xaringanExtra::use_freezeframe(responsive = FALSE)
knitr::include_graphics("test.gif")
gadenbuie commented 2 years ago

Unfortunately, this is a limitation of the freezeframe implementation. Your best bet is to put the gif in a width-restrained and centered container, rather than constraining and centering the gif directly.

```{r setup, echo=FALSE}
xaringanExtra::use_freezeframe(responsive = FALSE)
xaringanExtra::use_tachyons()

.center.w-50[

knitr::include_graphics("https://github.com/zumbov2/votemapswitzerland/raw/main/animation1.gif")

]

yyzeng commented 2 years ago

Unfortunately, this is a limitation of the freezeframe implementation. Your best bet is to put the gif in a width-restrained and centered container, rather than constraining and centering the gif directly.

```{r setup, echo=FALSE}
xaringanExtra::use_freezeframe(responsive = FALSE)
xaringanExtra::use_tachyons()

.center.w-50[

knitr::include_graphics("https://github.com/zumbov2/votemapswitzerland/raw/main/animation1.gif")

]

Thank you. It works for me!