1

I have the following line in a rmd-file and I can see the graphics when I knit a html-page.

![](graphics.svg)

But when I try to knit a PDF-document If will get the following error message:

! LaTeX Error: Unknown graphics extension: .svg.

I have installed the following packages

texlive-latex-extra
texlive-luatex
texlive-science

And I my settings for output are

output:
  pdf_document: 
    latex_engine: lualatex
kimmolinna
  • 43
  • 3
  • Does this answer your question? [Is it possible to include svg image in pdf document rendered by rmarkdown?](https://stackoverflow.com/questions/34064292/is-it-possible-to-include-svg-image-in-pdf-document-rendered-by-rmarkdown) – bttomio Feb 13 '21 at 12:51
  • Please check this solution with the library ```cowplot```: https://stackoverflow.com/a/58705542/13249862 – bttomio Feb 13 '21 at 12:52
  • You could use the `svg` package to include .svg files in latex documents. However this will need to be compiled with `--shell-escape` enabled and inkscape has to be installed. I think it would be easier to use inkscape (or a similar tool) to manually convert the svg into something that can be included. – samcarter_is_at_topanswers.xyz Feb 13 '21 at 14:22

1 Answers1

0

Maybe It’s easiest to produce svg and pdf simultaneously and select the correct one depending on a dev setting...

kimmolinna
  • 43
  • 3
  • I don't know what other output formats you use, but for the `pdf_document`, you could just remove the file type and latex will automatically choose the format best suited for the selected engine if there are more than one file types of an image. – samcarter_is_at_topanswers.xyz Feb 15 '21 at 18:43