我在RStudio中使用带有XeLaTeX的knitr。我使用块缓存,这样我不必在每次编译文档时都重新运行某些代码。这个最小的例子表明,如果fontspec
软件包被加载,缓存似乎被破坏。通过RStudio使用XeLaTeX fontspec包时,knitr缓存失败
\documentclass{article}
\usepackage{fontspec} % Appears to somehow conflict with caching.
\begin{document}
<<pre_load, cache=TRUE>>=
library(tikzDevice)
options(tikzDefaultEngine="xetex")
@
\section{Test}
<<test_block, dev='tikz', dependson='pre_load'>>=
plot(1:10,main='Test')
@
\end{document}
本文档首次编译为PDF时,它将起作用,因为不使用缓存。但是,如果对test_block
块进行更改,并且代码再次运行,则它将失败。例如,编译成PDF一次后,改变test_block
大块:
<<test_block, dev='tikz', dependson='pre_load'>>=
plot(1:10,main='Test Modified')
@
现在,编译为PDF失败,出现以下错误:
!
********************************************
* XeTeX is required to compile this document.
* Sorry!
********************************************.
\RequireXeTeX ...********************************}
\endgroup \fi
l.18 \RequireXeTeX
此错误表示options(tikzDefaultEngine="xetex")
一直没有组。有趣的是,如果fontspec
软件包未加载,则不会发生此错误。
我的问题是:这是一个错误,还是有我的代码有问题?我正在使用tikzDevice(0.6.3)在R(R开发中(不稳定)(2012-11-10 r61101))通过RStudio(0.97.246)使用knitr(1.1)(通过RStudio Server通过浏览器访问) )本身运行在Ubuntu(12.04.2 LTS)上。我的LaTeX2e的日期是< 2009/09/24>。