|
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? ______________________________________________ [hidden email] 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. |
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 |
|
In reply to this post by Thomas Levine
On 10/07/2010 10:35 AM, 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? > Pass a number. As long as it's reasonably close to the truth the graphs will be resized and things will be fine. Duncan Murdoch > ______________________________________________ > [hidden email] 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. > ______________________________________________ [hidden email] 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. |
|
Darn. Well here's what I'll do
%Preamble <<lengths>>= columnwidth=whatever the \columnwidth is @ %Figures \setkeys{Gin}{width=\columnwidth} <<label=something,fig=TRUE,echo=FALSE,width=columnwidth,height=0.3*columnwidth>>= plot(y~x) @ It needs to be exact so that the line weight and point size are consistent across figures and with the text. 2010/7/10 Duncan Murdoch <[hidden email]>: > On 10/07/2010 10:35 AM, 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? >> > > Pass a number. As long as it's reasonably close to the truth the graphs > will be resized and things will be fine. > > Duncan Murdoch >> >> ______________________________________________ >> [hidden email] 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. >> > > ______________________________________________ [hidden email] 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. |
| Powered by Nabble | Edit this page |
