[R] Centering graphics by default in Sweave
Marc Schwartz
marc_schwartz at me.com
Mon Jun 15 15:43:36 CEST 2009
Frank and Fritz,
In follow up to Frank's post yesterday, I am including proposed
patches for Sweave.R and RweaveLatex.Rd. The patches are against the
current SVN main trunk.
The patches include a new Sweave option called 'center.fig', which
defaults to FALSE to preserve existing behavior. When this option is
set to TRUE, the \includegraphics command will be wrapped with a
\centerline command. This will allow for space preserving centering,
whether in a 'figure' environment or not, as compared to using
\begin{center}...\end{center}.
Frank, this option can be set on a per chunk basis:
<<fig=TRUE,center.fig=TRUE>>=
or globally:
\SweaveOpts{center.fig=TRUE}
I am also attaching an example .Rnw file and the associated PDF so
that you can see the resultant behavior under differing circumstances.
Regards,
Marc
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SweavePatch.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090615/60e4f61e/attachment-0004.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RweaveLatexPatch.txt
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090615/60e4f61e/attachment-0005.txt>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.pdf
Type: application/pdf
Size: 44083 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20090615/60e4f61e/attachment-0002.pdf>
-------------- next part --------------
More information about the R-help
mailing list