3

i have been trying to implement a tikz chunk in bookdown first by myself, then by following this thread.

unfornutately, i keep running into various errors and incompatibilities, such as this one:

Error in tools::texi2dvi(texf, pdf = !to_svg, clean = TRUE) : unable to run 'pdflatex' on '.\tikzf702b605920.tex'

(even though by itself tinytex::pdflatex('test.tex') works fine)

on his blog and github Yihui Xie mentioned that it's definitely possible, but i wasn't able to find any working example, so i was hoping if perhaps anyone here could share one, please (or point out what am i doing wrong)

alinart
  • 31
  • 2
  • have you been able to figure out this one? I'm running into a similar problem where it says unable to run `latex` (not pdflatex). – Paul Lemmens Feb 07 '19 at 08:05

1 Answers1

0

@PaulLemmens, i found what was the problem for me. disclaimer here, i use windows and none of my colleagues who use r on linux/macos have this problem.

issue was arising with knitr when engine=tikz is used in one of the chunks. For it to work installation of imagemagick (https://www.imagemagick.org/script/index.php) and GhostScript (https://www.ghostscript.com/) is needed. as well as that, i had to rewrite knitr (https://github.com/darthaline/knitr) slightly. it's a quick and dirty solution, but it worked for me. on line 281 of R/engine.R the path to imagemagick's convert is hardcoded cause otherwise it seems that windows interprets it as 'convert.exe' from System32 directory (ImageMagick PATH not being recognized with engine = "tikz" in knitr)

alinart
  • 31
  • 2