knitr、tikzDevice 和 pgfplotstable 之间的冲突

knitr、tikzDevice 和 pgfplotstable 之间的冲突

我使用knitr来编写由两个 组成的文档.Rnw。请考虑以下示例这个答案

main.Rnw

% !Rnw weave = knitr
% !TeX program = pdfLaTeX

\documentclass[final,12pt]{article}

\usepackage[a4paper]{geometry}
% \usepackage{pgfplotstable}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}

<<include=FALSE>>=
  opts_chunk$set(concordance=TRUE, fig.width='8', fig.height='4', fig.pos='htb', out.width='\\textwidth')
@

\begin{document}
<<child-demo, child='include.Rnw', eval=TRUE>>=
@
\end{document}

include.Rnw

% !TeX root = main.Rnw
% !Rnw weave = knitr
% !TeX program = pdfLaTeX

Let's plot the spectrum of $Na$:

<<'na', dev='tikz', fig.cap='Spectrum of $Na$', echo=FALSE>>=
  plot(c(1:10))
@

我注意到,取消注释该行,则\usepackage{pgfplotstable}生成的 pdftikzDevice大小为 0。

R这是在加载时编织控制台的详细输出pgfplotstable,如您所见,没有错误消息,但.pdf文件(但不是.tikz)的大小为 0。

> > options(STERM='iESS', str.dendrogram.last="'", editor='emacsclient', show.error.locations=TRUE)
> .ess_weave(knit, "/my/path/main.Rnw")
Loading required package: knitr


processing file: /my/path/main.Rnw
  |.............                                                    |  20%
  ordinary text without R code

  |..........................                                       |  40%
label: unnamed-chunk-1 (with options) 
List of 1
 $ include: logi FALSE

  |.......................................                          |  60%
  ordinary text without R code

  |....................................................             |  80%
label: child-demo (with options) 
List of 2
 $ child: chr "include.Rnw"
 $ eval : logi TRUE



processing file: /my/path/include.Rnw
  |......................                                           |  33%
  ordinary text without R code

  |...........................................                      |  67%
label: na (with options) 
List of 3
 $ dev    : chr "tikz"
 $ fig.cap: chr "Spectrum of $Na$"
 $ echo   : logi FALSE

Warning: 'mode(width)' and 'mode(height)' differ between new and previous
     ==> NOT changing 'width' & 'height'
Creating new TikZ metrics dictionary in:
    include-tikzDictionary
  |.................................................................| 100%
  ordinary text without R code


  |.................................................................| 100%
  ordinary text without R code


output file: main.tex

[1] "main.tex"

这是生成图片的最后一部分(太长,无法全部发布)na.log(在文档的其余部分我找不到任何错误):

Package pgfplots Warning: running in backwards compatibility mode (unsuitable t
ick labels; missing features). Consider writing \pgfplotsset{compat=1.9} into y
our preamble.
 on input line 33.


Overfull \hbox (99.38345pt too wide) in paragraph at lines 124--125
[][] 
 []

(./na.aux) ) 
Here is how much of TeX's memory you used:
 20223 strings out of 493311
 479203 string characters out of 6137849
 631627 words of memory out of 5000000
 23277 multiletter control sequences out of 15000+600000
 4702 words of font info for 16 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 65i,7n,84p,700b,609s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.
PDF statistics:
 3 PDF objects out of 1000 (max. 8388607)
 3 compressed objects within 1 object stream
 0 named destinations out of 1000 (max. 500000)
 13 words of extra memory for PDF output out of 10000 (max. 10000000)

可以pgfplotstable和 一起使用吗tikzDevice

相关内容