1

It seems like there is a conflict with new versions of knitr and/or tikzDevice and/or R. In any case I can't make it work any more.

Here is a MWE:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage{tikz}

<<setup, include=FALSE, cache=FALSE>>=
  library(knitr)

  opts_chunk$set(fig.path='figure/graphics-', 
                 cache.path='cache/graphics-', 
                 fig.align='center',
                 dev='tikz'
                )
@

\begin{document}
blop

<<>>=
plot(1:10)  
@

\end{document}

This returns the error:

Quitting from lines 21-22 (testTikz.Rnw)  Error in
tikzDevice::tikz(..., packages = c("\n\\nonstopmode\n", packages,  :  
unused argument (verbose = FALSE) Calls: knit ... chunk_device ->
dev_new -> do.call -> <Anonymous> -> <Anonymous>

Execution halted

I am using R version 3.3.1, knitr_1.14 and tikzDevice_0.8.1

EDIT

I did a hack by forking the knitr repo on github to modify the tikz_dev function to remove the verbose argument. I now get the following error:

Error in (function (file = ifelse(onefile, "./Rplots.tex", "./Rplot%03d.tex"),  :
Graphics API version mismatch
Calls: knit ... do.call -> <Anonymous> -> do.call -> <Anonymous> -> .External
ClementWalter
  • 4,814
  • 1
  • 32
  • 54

1 Answers1

0

I got this fix by adding into the .Rprofile few lines and updating tikzDevice to version tikzDevice_0.10-1

options(tikzMetricPackages = c("\\usepackage[utf8]{inputenc}",
                               "\\usepackage[T1]{fontenc}",
                               "\\usetikzlibrary{calc}",                   
                               "\\usepackage{amssymb}"
                              )
       )
ClementWalter
  • 4,814
  • 1
  • 32
  • 54