0

I tried generating the epub for the bookdown demo, and the resulting epub did not contain the graphs and charts. I was able to see the graphs and charts in the generated PDF.

https://bookdown.org/yihui/bookdown-demo/ I ran bookdown::render_book('index.Rmd', 'all') to generate the supported formats.

On expanding the epub and looking into the generated code I see that media folder is not inside the EPUB folder and the link for the image expects this. Changing <img xmlns="http://www.w3.org/1999/xhtml" alt="Here is a nice figure!" width="80%" src="media/file0.png" />

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

resolves this.

Is there a setting to control the location of the media folder?

System information OS: macOS Sierra 10.12.6 RStudio Server 1.0.153 R: 3.4.2 MacTex

Jerry Thomas
  • 305
  • 3
  • 7
  • I don't have this problem on my Windows OS. Have you tried the default template by creating a bookdown project from the RStuido menu? Or using ctrl+shift+b hotkey to build the book instead of running render_book() function? – pzhao Nov 08 '17 at 08:18
  • If you cross-post a question, please [mention it](https://yihui.name/en/2017/10/cross-posting/): https://github.com/rstudio/bookdown/issues/481 – Yihui Xie Nov 08 '17 at 15:05

2 Answers2

0

This issue has been fixed in the current development version of bookdown:

devtools::install_github('rstudio/bookdown')
Yihui Xie
  • 28,913
  • 23
  • 193
  • 419
0

Yihui indicated that the root cause could be pandoc 2 bookdown-demo issue#21, which turned out to be correct.

The problem was resolved after I uninstalled pandoc 2 and used pandoc 1.19 instead (both versions 1.19.2.1 and 1.19.2.4 worked).

Bookdown does not support pandoc 2 yet, but it looks like yihui has fixed this bookdown issue #481.

Jerry Thomas
  • 305
  • 3
  • 7