如何在 bookdown 生成的 epub 中包含 Graphs/Plots/Charts?

How do I include Graphs/Plots/Charts in epub generated by bookdown?

我尝试为 bookdown 演示生成 epub,生成的 epub 不包含图形和图表。我能够在生成的 PDF 中看到图形和图表。

https://bookdown.org/yihui/bookdown-demo/ 我 运行 bookdown::render_book('index.Rmd', 'all') 生成支持的格式。

在展开 epub 并查看生成的代码时,我发现媒体文件夹不在 EPUB 文件夹内,而图像的 link 期待这一点。改变 <img xmlns="http://www.w3.org/1999/xhtml" alt="Here is a nice figure!" width="80%" src="media/file0.png" />

<img xmlns="http://www.w3.org/1999/xhtml" alt="Here is a nice figure!" width="80%" src="../media/file0.png" />

解决这个问题。

是否有控制媒体文件夹位置的设置?

系统信息 OS: macOS 塞拉利昂 10.12.6 RStudio 服务器 1.0.153 回复:3.4.2 MacTex

这个问题has been fixedbookdown的当前开发版本中:

devtools::install_github('rstudio/bookdown')

Yihui indicated that the root cause could be pandoc 2 bookdown-demo issue#21,事实证明是正确的。

我卸载pandoc 2并改用pandoc 1.19后问题得到解决(1.19.2.1和1.19.2.4版本均有效)。

Bookdown 还不支持 pandoc 2,但看来易慧已经解决了这个问题 bookdown issue #481