[R] Sweave: option keep.source=TRUE and package cacheSweave

Duncan Murdoch murdoch.duncan at gmail.com
Sun Nov 7 15:15:00 CET 2010


Renaud Lancelot wrote:
> Dear all,
> 
> When I use the cacheSweave package together with the Sweave option
> keep.source = TRUE, all the LaTeX code before the Sweave code chunk is
> included in the TeX file to be compiled. For example, with the
> following Sweave file

The author of cacheSweave is aware of this, and I think he's working on it.

Duncan Murdoch

> 
> \documentclass[12pt]{article}
> \usepackage[nogin]{Sweave}
> 
> % Sweave options
> \SweaveOpts{keep.source=TRUE, strip.white=TRUE, eps=FALSE, pdf=TRUE}
> 
> \begin{document}
> 
> Blabla.
> 
> <<optionsR, results=hide>>=
> setCacheDir("./cache")
> library(MASS)          ## just an example
> @
> 
> \end{document}
> 
> I get the following TeX file:
> 
> \documentclass[12pt]{article}
> \usepackage[nogin]{Sweave}
> 
> % Sweave options
> 
> 
> \begin{document}
> 
> Blabla.
> 
> \begin{Schunk}
> \begin{Sinput}
>> \documentclass[12pt]{article}
>> \usepackage[nogin]{Sweave}
>>
>> % Sweave options
>> \SweaveOpts{keep.source=TRUE, strip.white=TRUE, eps=FALSE, pdf=TRUE}
>>
>> \begin{document}
>>
>> Blabla.
>>
>> <<optionsR, results=hide>>=
>> setCacheDir("./cache")
>> library(MASS)          ## just an example
> \end{Sinput}
> \end{Schunk}
> 
> \end{document}
> 
> When I set option keep.source = FALSE, the result is as expected. Is
> there any possibility to use keep.source = TRUE with cacheSweave?
> 
> 
>> sessionInfo()
> R version 2.12.0 Patched (2010-10-28 r53459)
> Platform: i386-pc-mingw32/i386 (32-bit)
> 
> locale:
> [1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252
> [3] LC_MONETARY=French_France.1252 LC_NUMERIC=C
> [5] LC_TIME=French_France.1252
> 
> attached base packages:
> [1] tools     stats     graphics  grDevices utils     datasets  methods
> [8] base
> 
> other attached packages:
> [1] MASS_7.3-8        cacheSweave_0.4-4 stashR_0.3-3      filehash_2.1-1
> [5] fortunes_1.4-0
> 
> loaded via a namespace (and not attached):
> [1] digest_0.4.2
> 
>



More information about the R-help mailing list