On Feb 23, 2012, at 5:22 PM, Michael Kubovy wrote: > An Sweave file, 'test.Rnw': > > \documentclass{article} > \title{Sweave minimal} > \author{MK} > \begin{document} > \maketitle > We try Sweave: > <<1>>= > data(airquality) > summary(airquality) > x <- airquality[1, 1] > @ > > I try Sexpr: \Sexpr{x} > > We plot: > \begin{center} > <<2, fig=TRUE, echo=FALSE >>= > boxplot(Ozone ~ Month, data = airquality) > @ > \end{center} > \end{document} > > I check the sessionInfo: > >> sessionInfo() > R version 2.14.1 (2011-12-22) > Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) > > locale: > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 > > attached base packages: > [1] datasets splines utils stats graphics grDevices methods > base > > other attached packages: > [1] cacheSweave_0.6 stashR_0.3-4 filehash_2.2 concord_1.4-9 > irr_0.83 lpSolve_5.6.6 ca_0.33 > rgl_0.92.798 > [9] vegan_2.0-2 permute_0.6-3 reshape_0.8.4 plyr_1.7.1 > ggplot2_0.9.0 doBy_4.5.2 snow_0.3-8 > lme4_0.999375-42 > [17] Matrix_1.0-3 lattice_0.20-0 multcomp_1.2-10 > mvtnorm_0.9-9992 R2HTML_2.2 BiocInstaller_1.2.1 ctv_0.7-4 > sos_1.3-1 > [25] brew_1.0-6 Hmisc_3.9-2 survival_2.36-12 MASS_7.3-17 > > > loaded via a namespace (and not attached): > [1] car_2.0-12 cluster_1.14.2 colorspace_1.1-1 dichromat_1.2-4 > digest_0.5.1 grid_2.14.1 memoise_0.1 munsell_0.3 > nlme_3.1-103 > [10] proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.1.0 > stats4_2.14.1 stringr_0.6 tools_2.14.1 > > and run Sweave: > >> Sweave(file = 'test.Rnw') > Writing to file test.tex > Processing code chunks with options ... > 1 : echo keep.source term verbatim (label = 1) > 2 : keep.source term verbatim pdf (label = 2) > > You can now run (pdf)latex on Œtest.tex‚ > > It works as it should except for \Sexpr > > \documentclass{article} > \title{Sweave minimmal} > \author{MK} > \usepackage{Sweave} > \begin{document} > \maketitle > We try Sweave: > \begin{Schunk} > \begin{Sinput} >> data(airquality) >> summary(airquality) > \end{Sinput} > \begin{Soutput} > Ozone Solar.R Wind Temp Month > Day > Min. : 1.0 Min. : 7 Min. : 1.70 Min. :56.0 Min. :5.00 > Min. : 1.0 > 1st Qu.: 18.0 1st Qu.:116 1st Qu.: 7.40 1st Qu.:72.0 1st Qu.:6.00 > 1st Qu.: 8.0 > Median : 31.5 Median :205 Median : 9.70 Median :79.0 Median :7.00 > Median :16.0 > Mean : 42.1 Mean :186 Mean : 9.96 Mean :77.9 Mean :6.99 > Mean :15.8 > 3rd Qu.: 63.2 3rd Qu.:259 3rd Qu.:11.50 3rd Qu.:85.0 3rd Qu.:8.00 > 3rd Qu.:23.0 > Max. :168.0 Max. :334 Max. :20.70 Max. :97.0 Max. :9.00 > Max. :31.0 > NA's : 37.0 NA's : 7 > > \end{Soutput} > \begin{Sinput} >> x <- airquality[1, 1] > \end{Sinput} > \end{Schunk} > > We try Sexpr: \Sexpr{x} > > We plot: > \begin{center} > \includegraphics{test-2} > \end{center} > \end{document} > > The beginning of the .log file: > This is pdfTeX, Version 3.1415926-2.3-1.40.12 (TeX Live 2011) > (format=pdflatex 2012.2.4) 23 FEB 2012 18:19 > entering extended mode > \write18 enabled. > %&-line parsing enabled. > **test.tex > (./test.tex > LaTeX2e <2011/06/27> > > Any thought? Please CC me when replying. > > Michael Kubovy
There have been problems reported over the years on this due to a conflict with the R2HTML package, which you have loaded as indicated above. If you can run your session without that package, try that. Otherwise use: options(SweaveSyntax = "SweaveSyntaxNoweb") Sweave("test.Rnw") or Sweave("test.Rnw", syntax = "SweaveSyntaxNoweb") This is in the Sweave FAQ and Manual. HTH, Marc Schwartz ______________________________________________ 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.