I have some R markdown that includes the following code:
```{r huff51, fig.show='hold', fig.cap='Design decisions connecting research purpose and outcomes [@huff_2009_designingresearchpublication p. 86].', echo=FALSE}
knitr::include_graphics('images/Huff-2009-fig5.1.svg')
```
When using bookdown to produce HTML output everything works as expected.
When using bookdown to produce PDF output I get an error saying ! LaTeX Error: Unknown graphics extension: .svg.
This is understandable as knitr uses Latex's \includegraphics{images/Huff-2009-fig5.1.svg}
to include the image. So, it's not a bug per se.
Is there a better way to include the SVG image so I don't need to pre-process it into, say, a PDF or PNG?
rsvg-convert
out of the R code and into aMakefile
, which I then invoke through abash
block in the RMarkdown.Make
will only re-build if thesvg
s have changed since thepdf
s were last built, so it's a nice way to speed the knitting execution time. – Istanbul