Re: [R] Trouble with Sweave and Beamer

From: Duncan Murdoch <murdoch.duncan_at_gmail.com>
Date: Sat, 09 Apr 2011 08:41:03 -0400

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.



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. Received on Sat 09 Apr 2011 - 12:44:41 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 09 Apr 2011 - 13:30:28 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive