I use knitr to compile a document composed of two .Rnw. Please considered the following examples from this answer
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}
and 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))
@
I have noticed that uncommenting the line \usepackage{pgfplotstable} the pdf produced by the tikzDevice is of size 0.
This is the verbose output of the R console while knitting when loading the pgfplotstable, as you can see there's no error message, still the .pdf file (but not the .tikz) produce is of size 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"
And here the last part (too long to post all) of na.log from generating the picture (in the rest of the document I couldn't find any error):
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)
Is it possible to use pgfplotstable along with the tikzDevice?
pgfplotstableafter thepreviewpackage inna.tikzinfigurefolder. But, currently, I have no idea how to fix this. – m0nhawk Nov 08 '13 at 07:16pgfplotstablea such should be harmless... but it includespgfplots, which, in turn, includestikz. Does it make a difference if you include one oftikzorpgfplotsinstead ofpgfplotstable? And: what is the error message? Typically, a result of size 0 means "error" and errors are always indicated by error messages. – Christian Feuersänger Nov 09 '13 at 16:05tikzandpgfplotsinstead ofpgfplotstable: withtikzthe pdf of the figure is correctly produced but withpgfplotsthe figure pdf has still size 0. – Francesco Nov 09 '13 at 21:40Rlog, I meant the log produced bypdflatex. It is probably available asmain.logor something like that – Christian Feuersänger Nov 10 '13 at 11:45figure/na.logfile, which you can open and see what is wrong there. – Yihui Xie Nov 10 '13 at 22:48Error in replayPlot(x) (from #91) : invalid graphics state– Francesco Nov 10 '13 at 23:16include.Rnw: you used the chunk optiondev.args=list(pointsize = 90)there, which is probably way too big for an R graphics device (the default point size is 12). Is there a reason for such a big point size? – Yihui Xie Nov 11 '13 at 06:02Rlog. – Francesco Nov 11 '13 at 06:18