[R] Passing a LaTeX length to Sweave

Sharpie chuck at sharpsteen.net
Sat Jul 10 23:13:02 CEST 2010



Thomas Levine wrote:
> 
> I'd really love to do this
> 
> \setkeys{Gin}{width=\columnwidth}
> <<label=something,fig=TRUE,echo=FALSE,width=\columnwidth,height=0.3\columnwidth>>=
> plot(y~x)
> @
> 
> The \columnwidth macro does not work, of course, in the second line.
> What can I do instead?
> 

This may be difficult as there is no two-way communication between R and
LaTeX in the current implementation of Sweave.  In fact, there is hardly any
communication at all- Sweave is just a preprocessor that turns .Rnw files
into .tex files.

Basically, there is no way to "fetch" the current value of \columnwidth
because LaTeX is not even running during the time that Sweave is processing
the file.

Two-way communication is certainly possible, Cameron and I implemented an R
<-> LaTeX callback to provide accurate font metrics to the R tikzDevice, but
as far as I can tell this feature would need to be implemented as an
extension to the current Sweave system.

-Charlie

-----
Charlie Sharpsteen
Undergraduate-- Environmental Resources Engineering
Humboldt State University
-- 
View this message in context: http://r.789695.n4.nabble.com/Passing-a-LaTeX-length-to-Sweave-tp2284576p2284795.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list