I think I have isolated a problem with integration between Sweave and beamer. Could you please see the file: http://www.mayin.org/ajayshah/tmp/bugdemo.Rnw Unfortunately, it uses some of my internal libraries, so you can't run it. When I put it through Sweave, I get: http://www.mayin.org/ajayshah/tmp/bugdemo.tex which is, of course, a generic latex file which you can read and run. When I try to use pdflatex, I get the error: ... ... ... (/sw/share/texmf-dist/tex/latex/ae/t1aett.fd) Runaway argument?> prices <- cbind(mydb("macro", "nifty", freq = "w"),mydb("firm.pric\ETC. ! Paragraph ended before \FV at BeginScanning was complete. <to be read again> \par l.60 \end{frame} ? I transplanted the R code from bugdemo.Rnw into an ordinary latex article context, and everything works fine. Hence, I'm sure it's something to do with the integration between Sweave and beamer. Are there some catches that I ought to know about? -- Ajay Shah http://www.mayin.org/ajayshah ajayshah at mayin.org http://ajayshahblog.blogspot.com <*(:-? - wizard who doesn't know the answer.
Duncan Murdoch
2007-Aug-31 10:43 UTC
[R] Bugreport on integration of Sweave and latex beamer
Ajay Shah wrote:> I think I have isolated a problem with integration between Sweave and beamer. >Sweave makes a lot of use of verbatim environments, and beamer doesn't like those. You need to declare that a slide contains verbatim or you get errors like that. I'm sure there are other ways to do this, but one that works is to use \begin{frame}[containsverbatim] at the start of each slide. This makes some other beamer features stop working, but I forget which. Duncan Murdoch> Could you please see the file: > http://www.mayin.org/ajayshah/tmp/bugdemo.Rnw > > Unfortunately, it uses some of my internal libraries, so you can't run > it. When I put it through Sweave, I get: > > http://www.mayin.org/ajayshah/tmp/bugdemo.tex > > which is, of course, a generic latex file which you can read and run. > > When I try to use pdflatex, I get the error: > > ... > ... > ... > (/sw/share/texmf-dist/tex/latex/ae/t1aett.fd) > Runaway argument? > >> prices <- cbind(mydb("macro", "nifty", freq = "w"), >> > mydb("firm.pric\ETC. > ! Paragraph ended before \FV at BeginScanning was complete. > <to be read again> > \par > l.60 \end{frame} > > ? > > I transplanted the R code from bugdemo.Rnw into an ordinary latex > article context, and everything works fine. Hence, I'm sure it's > something to do with the integration between Sweave and beamer. Are > there some catches that I ought to know about? > >
Friedrich Schuster
2007-Aug-31 16:11 UTC
[R] Bugreport on integration of Sweave and latex beamer
Hi, I used the following Sweave code for text output (worked for me): --- code ---- \documentclass{beamer} \usepackage{beamerthemesplit} \usepackage[latin1]{inputenc} \usepackage{ngerman} \usepackage{psfrag} \usepackage{graphicx} \setbeamercovered{transparent} \SweaveOpts{echo=true} \title{ The R Project ... } \author{ Me } \date{\today} \begin{document} \pgfdeclareimage[height=1cm]{logo}{./img/Rlogo} \logo{\pgfuseimage{logo}} \frame{\titlepage} \section[?bersicht]{} ... snip ... \begin{frame}[containsverbatim] \frametitle{\texttt{search()}} Zeigt geladene Packages an. @ <<sample-fn>> search(); library(MASS); search(); @ %def \end{frame} ... snap ... \end{document} --- /code ---- Embedding images should be something like this: --- /code ---- \begin{center} <<fig=TRUE,echo=FALSE>> # Aus Beispiel f?r lm ## Annette Dobson (1990) "An Introduction to Generalized Linear Models". ## Page 9: Plant Weight Data. ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group <- gl(2,10,20, labels=c("Ctl","Trt")) weight <- c(ctl, trt) anova(lm.D9 <- lm(weight ~ group)) # summary(lm.D90 <- lm(weight ~ group - 1))# omitting intercept # summary(resid(lm.D9) - resid(lm.D90)) #- residuals almost identical opar <- par(mfrow = c(2,2), oma = c(0, 0, 1.1, 0)) plot(lm.D9, las = 1) # Residuals, Fitted, ... @ \end{center} --- code ---- Hope it helps, Friedrich Schuster mail at friedrich-schuster.de Tel.: +49 6221 737474 Tel.: +49 163 7374744