Actually, I spoke too soon. The files process without obvious error, but keep.source=TRUE is ignored. I have posted small files test1.Rnw and test2.Rnw that can be used to demonstrate the problems at: http://wwwmaths.anu.edu.au/~johnm/r/issues/
Sweave("test1") ## includes SweaveOpts settings Sweave("test2", keep.source=TRUE) ## SweaveOpts settings have been removed. Comments do not appear in the LaTeX file that results, the code is reformatted and the graph from test1 goes into the working directory. Notice also the NA that mysteriously appears in the second line of code in output .tex file test2.tex John. John Maindonald email: john.maindon...@anu.edu.au phone : +61 2 (6125)3473 fax : +61 2(6125)5549 Centre for Mathematics & Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200. http://www.maths.anu.edu.au/~johnm On 26/11/2010, at 4:26 PM, John Maindonald wrote: > Yes, that has fixed the problem. (2010-11-24 r53659) > > Thanks. > > John Maindonald email: john.maindon...@anu.edu.au > phone : +61 2 (6125)3473 fax : +61 2(6125)5549 > Centre for Mathematics & Its Applications, Room 1194, > John Dedman Mathematical Sciences Building (Building 27) > Australian National University, Canberra ACT 0200. > http://www.maths.anu.edu.au/~johnm > > On 25/11/2010, at 10:56 PM, Duncan Murdoch wrote: > >> On 25/11/2010 6:34 AM, John Maindonald wrote: >>> I have a file 4lmetc.Rnw, intended for inclusion in a LaTeX document, >>> that starts: >> >> I think this may have been fixed in the patched version. Could you give it >> a try to confirm? If not, please send me a simplified version of the file, >> and I'll see what's going wrong. >> >> Duncan Murdoch >> >> >>> >>> \SweaveOpts{engine=R, keep.source=TRUE} >>> \SweaveOpts{eps=FALSE, prefix.string=snArt/4lmetc} >>> >>> The attempt to process the file through Sweave generates the error: >>> >>>> Sweave("4lmetc") >>> Writing to file 4lmetc.tex >>> Processing code chunks ... >>> 1 : keep.source term verbatim >>> Error in file(srcfile$filename, open = "rt", encoding = encoding) : >>> cannot open the connection >>> In addition: Warning message: >>> In file(srcfile$filename, open = "rt", encoding = encoding) : >>> cannot open file '4lmetc': No such file or directory >>> >>> The same file processes through Stangle() without problems. >>> If I comment out the \Sweaveopts lines, there is no problem, >>> except that I do not get the options that I want. >>> >>> This processed fine in R-2.11.1 >>> >>>> sessionInfo() >>> R version 2.12.0 (2010-10-15) >>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) >>> >>> locale: >>> [1] C >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets grid methods >>> [8] base >>> >>> other attached packages: >>> [1] lattice_0.19-13 DAAG_1.02 randomForest_4.5-36 >>> [4] rpart_3.1-46 MASS_7.3-8 reshape_0.8.3 >>> [7] plyr_1.2.1 proto_0.3-8 >>> >>> loaded via a namespace (and not attached): >>> [1] ggplot2_0.8.8 latticeExtra_0.6-14 >>> >>> Is there a workaround? >>> >>> John Maindonald email: john.maindon...@anu.edu.au >>> phone : +61 2 (6125)3473 fax : +61 2(6125)5549 >>> Centre for Mathematics& Its Applications, Room 1194, >>> John Dedman Mathematical Sciences Building (Building 27) >>> Australian National University, Canberra ACT 0200. >>> http://www.maths.anu.edu.au/~johnm >>> >>> ______________________________________________ >>> R-help@r-project.org mailing list >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. >> > ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.