[Rd] Using Sweave in hostile environments

Duncan Murdoch murdoch.duncan at gmail.com
Fri May 14 12:53:27 CEST 2010

Just for the archives, a partial answer to my question:

I was unable to find a definition for the Sinput environment that would 
work, but relatively minor changes to some of the RweaveLatex functions 
cause Sweave to generate SaveVerbatim environments rather than Sinput 
environments, and that's enough to get things to work.  So the example 
below would be handled using

<<chunkname, eval=FALSE, saveVerbatim=TRUE>>=
x <- 1

somewhere safe, and then


in the box.  Each piece of input or output will be saved in a separate 
verbatim piece, and they each need to be used explicitly:  you'll 
probably want to look at the .tex file to figure out the names.

This is pretty rough and I won't commit it to R, but I've attached the 
patch file (against R trunk rev 51988) in case anyone else wants to use it.

Duncan Murdoch

On 13/05/2010 10:19 AM, Duncan Murdoch wrote:
> I'm trying to put together a poster using the LaTeX a0poster package and 
> including some things from pstricks to get gradient shading, etc.
> The problem is that the default environments used by Sweave don't work 
> where I need them.  A simple code chunk like
> <<eval=FALSE>>=
> x <- 1
> @
> buried in a minipage within a psshadowbox gives the error
> Runaway argument?
>  > x <- 1 \end {Sinput} \end {Schunk} and the resulting variable would\ETC.
> D:/test.tex:302: Paragraph ended before \FV@
> BeginScanning was complete
> Has anyone solved this problem?  One way I see that might work is to put 
> the code chunk outside the environment and use SaveVerbatim to save it, 
> then just put \BUseVerbatim or \LUseVerbatim in place where I need it.  
> But because I'm using Sweave, I somehow need to redefine the Sinput, 
> Soutput and maybe the Schunk environments to do that, and I don't see 
> how to do so. 
> Duncan Murdoch
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: Sweave.patch
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20100514/5bd60eac/attachment.pl>

More information about the R-devel mailing list