[R] Sweave and LaTeX beamer class

David Whiting david.whiting at ncl.ac.uk
Mon Dec 20 08:35:23 CET 2004


Hi Bernd,

I think it is because you are trying to place a chunk of R code within
a LaTeX command. I'm not sure that Sweave will be able to handle
that. In situations analogous to this I process the R chunk earlier in
my document and create an object that I then access in the LaTeX chunk
using \Sexpr{}.  Re-working your example might be something like this
(untested):

#################################
\documentclass{beamer}

\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{ngerman}

\begin{document}

<<>>=
x <- 1+1
@ 

\frame{
  \frametitle{test}
test \Sexpr{x}}
\end{document}
#################################


Dave

"Bernd Weiss" <bernd.weiss at uni-koeln.de> writes:

> Hi,
> 
> has anyonne experienced problems between the LaTeX beamer class and 
> Sweave? The following code does not work properly:
> #################################
> \documentclass{beamer}
> 
> \usepackage[latin1]{inputenc}
> \usepackage[T1]{fontenc}
> \usepackage{ngerman}
> 
> \begin{document}
> \frame{
>   \frametitle{test}
> test
> <<>>=
>  1+1
> @ 
> }
> \end{document}
> #################################
> 
> Below is the error code:
> #################################
> loading : Context Support Macros / PDF (2004.10.26)
> ) (d:\programme\texmf\tex\latex\hyperref\nameref.sty) (testset.out)
> (testset.out) (testset.nav) 
> (d:\programme\texmf\tex\latex\ae\t1aett.fd)
> Runaway argument?
> > 1 + 1 \end {Sinput} \begin {Soutput} [1] 2 \end {Soutput} \end 
> {Sch\ETC.
> ! Paragraph ended before \FV at BeginScanning was complete.
> <to be read again>
>                    \par
> l.26 }
> 
> ? x
> No pages of output.
> Transcript written on testset.log.
> #################################
> 
> Thanks in advance,
> 
> Bernd
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
> 

-- 
David Whiting
University of Newcastle upon Tyne, UK




More information about the R-help mailing list