[R] Sweave and LaTeX beamer class

Charles C. Berry cberry at tajo.ucsd.edu
Fri Oct 1 01:24:43 CEST 2010


On Thu, 30 Sep 2010, Johannes Huesing wrote:

> I am failing to uncover Sweave chunks step by step using the LaTeX beamer
> class.
>
> The following minimal example:
>
> \documentclass{beamer}
> \usepackage{Sweave}
> \begin{document}
> \begin{frame}[fragile]
>  In the year \uncover<2->{25}\uncover<3->{\Sexpr{5*5}}
> \uncover<4->{
> <<echo=TRUE, print=TRUE>>=
> 5*5*101
> @
> }
> \end{frame}
> \end{document}
>
> leads to an error message when running pdflatex over the *.tex file:
>
> [...]
> ! FancyVerb Error:
>  Extraneous input ` 2525 \end {Soutput} \end {Schunk} \beamer at endcovered ' bet
> ween \begin{Soutput}[<key=value>] and line end
> .
> \FV at Error ... {FancyVerb Error:
> \space \space #1
> }
>

I do not have  enough of an understanding of LaTeX to explain this, but it 
seems \uncover can be tricky.

This works for me:

\documentclass{beamer}
\usepackage{Sweave}
\begin{document}
\begin{frame}[fragile]
   In the year \uncover<2->{25}\uncover<3->{\Sexpr{5*5}}
\begin{uncoverenv}<4->
<<echo=TRUE, print=TRUE>>=
5*5*101
@ %def
\end{uncoverenv}
\end{frame}
\end{document}


> -- 
> Johannes Hüsing               There is something fascinating about science.
>                              One gets such wholesale returns of conjecture
> mailto:johannes at huesing.name  from such a trifling investment of fact.
> http://derwisch.wikidot.com         (Mark Twain, "Life on the Mississippi")
>
> ______________________________________________
> 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.
>

Charles C. Berry                            (858) 534-2098
                                             Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	            UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901


More information about the R-help mailing list