[R] Sweave and/or beamer issue

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Sun Sep 7 00:38:29 CEST 2008


Hi Michael,

I think that beamer needs that frames that contain any verbatim text
or R output to be declared as fragile.

Try

\begin{frame}[fragile]

...

\end{frame}

On Sat, Sep 06, 2008 at 06:22:41PM -0400, Michael Kubovy wrote:
> Dear Friends,
> 
> I not sure whether this is an Sweave or a beamer problem.
> 
> The Rnw file:
> 
> \documentclass[compress,smaller]{beamer}
> %\documentclass{article}
> %\usepackage{beamerarticle}
> 
> \usepackage{Sweave}
> 
> \title{Psychophysics II}
> \date{September 9, 2008}
> 
> \begin{document}
> 
> \frame{
> \begin{Schunk}
> \begin{Sinput}
>  > ro <- 0.2
>  > c <- seq(from = -3, to = 4, by = 0.1)
>  > fn <- 1 - pnorm(c)
>  > fo <- 1 - pnorm(c, mean = 1)
>  > h <- fo + ro - ro * fo
>  > f <- fn
>  > plot(h ~ f, type = "l", asp = 1, xlim = c(0.01, 1.01), ylim =  
> c(0.01, 1.01), las = 1, xlab = "p(yes | old)",
> +     ylab = "p(yes | new)", main = "Dual-process model,  
> p(recollection) = 0.2")
> \end{Sinput}
> \end{Schunk}
> \includegraphics{20080909test-model}
> 
> }
> 
> \end{document}
> 
> The resulting LaTeX
> ***********FAILS: *****************
> 
> Runaway argument?
>  > ro <- 0.2 > c <- seq(from = -3, to = 4, by = 0.1) > fn <- 1 - pnorm 
> \ETC.
> ! Paragraph ended before \FV at BeginScanning was complete.
> <to be read again>
>                     \par
> l.27 }
> 
> ?
> 
> **********************************
> But when the Rnw file starts:
> **********************************
> %\documentclass[compress,smaller]{beamer}
> \documentclass{article}
> \usepackage{beamerarticle}
> 
> ***********IT DOES NOT FAIL: *****************
> 
> _____________________________
> Professor Michael Kubovy
> University of Virginia
> Department of Psychology
> USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
> Parcels:    Room 102        Gilmer Hall
>          McCormick Road    Charlottesville, VA 22903
> Office:    B011    +1-434-982-4729
> Lab:        B019    +1-434-982-4751
> Fax:        +1-434-982-4766
> WWW:    http://www.people.virginia.edu/~mk9y/
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at 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.

-- 
Andrew Robinson  
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia         Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/



More information about the R-help mailing list