似乎与knitr
和/或tikzDevice
和/或R
的新版本存在冲突。在任何情况下,我都无法继续工作。
这是一个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}
这将返回错误:
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
我正在使用R版本3.3.1,knitr_1.14和tikzDevice_0.8.1
修改
我通过在github上分配knitr
repo来修改tikz_dev
函数来删除verbose
参数。我现在收到以下错误:
Error in (function (file = ifelse(onefile, "./Rplots.tex", "./Rplot%03d.tex"), :
Graphics API version mismatch
Calls: knit ... do.call -> <Anonymous> -> do.call -> <Anonymous> -> .External
答案 0 :(得分:0)
我通过添加.Rprofile
几行并将tikzDevice
更新为版本tikzDevice_0.10-1
options(tikzMetricPackages = c("\\usepackage[utf8]{inputenc}",
"\\usepackage[T1]{fontenc}",
"\\usetikzlibrary{calc}",
"\\usepackage{amssymb}"
)
)