[R] Trouble with Sweave and Beamer

Duncan Murdoch murdoch.duncan at gmail.com
Sat Apr 9 14:41:03 CEST 2011


On 11-04-09 8:25 AM, Lorenzo Isella wrote:
> Dear All,
> I am running Debian testing on my box and I installed latex and R from
> the standard repositories.
> I am trying my hands at sweave, but somehow I am experiencing problems
> (I am trying to use beamer and Sweave). Please see the snippet at the
> end of the email and saved as report.Rnw.

Beamer needs to be told that a frame contains verbatim content, which is 
what Sweave uses for R input and output.  There are a few ways to do 
this; the one I use is to put this at the start of the frame:

\begin{frame}[containsverbatim]

You had the [t] option on the frame; I don't know beamer well enough to 
know if this is compatible with containsverbatim.

Duncan Murdoch

> When I run the command
>
> $ R CMD Sweave report.Rnw
> Writing to file report.tex
> Processing code chunks ...
>    1 : echo term verbatim
>
> You can now run LaTeX on 'report.tex'
>
> It looks like everything is ok, but when I pdflatex it, I get an error
> (I am pasting only the end of the console output)
>
>
> no file report.nav.
> (/usr/share/texmf-texlive/tex/latex/ae/t1aett.fd)
> Runaway argument?
>   >  x<- rnorm(100)>  xm<- mean(x)>  xm \end {Sinput} \begin {Soutput}\ETC.
> ! Paragraph ended before \FV at BeginScanning was complete.
> <to be read again>
>                      \par
> l.42 \end{frame}
>
> ?
>
>
> Can anyone tell me what is going wrong?
> Many thanks
>
> Lorenzo
>
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \documentclass{beamer}
>
> \usetheme{Darmstadt}
> \usefonttheme[onlylarge]{structurebold}
> \setbeamerfont*{frametitle}{size=\normalsize,series=\bfseries}
> \setbeamertemplate{navigation symbols}{}
>
>
> % Standard packages
>
> \usepackage[english]{babel}
> \usepackage[latin1]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage{Sweave}
>
>
> % The main document
>
> \begin{document}
>
>
> \setlength{\unitlength}{\textwidth}  % measure in textwidths
>
>
> \begin{frame}[t]{Data Representation and Analysis}
>
>
>
> <<echo=TRUE>>=
> x<- rnorm(100)
> xm<- mean(x)
> xm
> @
>
>
>
> \end{frame}
>
> ______________________________________________
> 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.



More information about the R-help mailing list