【问题标题】:knitr does not accept opts_chunk set options for devknitr 不接受用于 dev 的 opts_chunk 设置选项
【发布时间】:2014-09-03 01:32:27
【问题描述】:

以下最小示例在使用 knit('%.Rnw') 时无法编译

\documentclass[]{article}

%opening
\title{STAT 520 Homework No. 1}
\author{Cheng Jia}

<<setup, include=FALSE, cache=FALSE>>=
library(knitr)
opts_chunk$set(dev='cairo_pdf', dev.args=list(family='Lekton'))
options(show.signif.stars=F)
@

\begin{document}

\maketitle
<<test,cache=TRUE,eval=TRUE,echo=FALSE>>=
a<-1
@
This is testing a=\Sexpr{a}.
\end{document}

错误信息如下:

Quitting from lines 18-19 (try.Rnw) 
Error in pdf(NULL, width, height, ...) : unknown family 'Lekton'
Calls: knit ... chunk_device -> dev_new -> do.call -> <Anonymous> -> pdf

看来 knitr 似乎不再接受设备选项,因此它不使用 cairo_pdf 设备,而是使用默认的 pdf 设备。

知道发生了什么吗??

System:
Mac Os 10.9.4
R version: R version 3.1.1 (2014-07-10)
Knitr version: 1.6

The problem is solved by using the following setup:
System: Windows 7 SP1
R version: 3.1.0
Knitr version: 1.5

当我更新到最新的 Knitr 和 R 时,似乎引入了一些不兼容。

【问题讨论】:

    标签: r knitr cairo


    【解决方案1】:

    这个问题是一个已知问题,在development version of knitr 中一直是fixed,未来几周将在 CRAN 上发布 v1.7(如果需要,可以从 Github 安装)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-07-26
      • 2021-10-04
      • 1970-01-01
      • 2013-04-09
      • 1970-01-01
      • 2019-07-08
      • 2018-05-02
      • 1970-01-01
      相关资源
      最近更新 更多