pgfSweave provides a number of improvements to the speed and quality of Sweave output including: (1) capabilities for 'caching' graphics generated with Sweave on top of the caching mechanisms provided by cacheSweave, (2) an interface to the tikzDevice package which provides graphics with consistent font style, sizing and quality as the main document and (3) highlighting of echo'd source code via the highlight package. pgfSweave provides a new driver for Sweave (pgfSweaveDriver) with new chunk options tikz, external, sanitize, highlight and tidy on top of the cache option provided by cacheSweave.
1 2 3
A connection or a character string giving the name of the file to load.
An object of class SweaveSyntax or a character string with its name. The default installation provides SweaveSyntaxNoweb and SweaveSyntaxLatex (passed to Sweave).
The number of parallel processes to use for graphics externalization.
Other options to be passed to
This package provides new features beyond
better recognition of code chunk changes
the 'caching' of code chunks which generate graphics and
an interface to the tikzDevice package for the generation of graphics in which the font matches that of the main document.
The process carried out by
Sweave on the .Rnw file
Generating a graphics file from each newly created or changed graphic.
Running the pgf externalization commands for each newly generated graphic (via a makefile).
LaTeX with on the .tex file using
the real job name.
For more details see the pgfSweave package vignette.
A pdf file is generated if
compile.tex=TRUE and a
tex file only is generated otherwise.
The pgfSweave package must be installed from source to gain access to the R CMD pgfsweave interface.
function will issue any system commands needed to
“externalize” the pgf graphics. To take advantage of
the speedup, set
external=TRUE on every code chunk
that creates a plot.
\codepgfrealjobnamemyfile MUST in the header of your
LaTeX file for the external graphics capablities.
Cameron Bracken [email protected] and Charlie Sharpsteen
Sweave manual: http://www.statistik.lmu.de/~leisch/Sweave/Sweave-manual.pdf
cacheSweave vignette: http://cran.r-project.org/web/packages/cacheSweave/vignettes/cacheSweave.pdf
pgf manual externalization section: http://sourceforge.net/projects/pgf/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
## Not run: vignette("pgfSweave") ## Not run: library(pgfSweave) oldcwd <- getwd() dir <- tempdir() setwd(dir) file.copy(system.file("example","pgfSweave-example.Rnw", package = "pgfSweave"),dir) file <- file.path(dir,"pgfSweave-example.Rnw") pgfSweave(file,compile.tex=FALSE) setwd(oldcwd) ## End(Not run) ## Not run: ## Normally to compile to PDF by # pgfSweave("pgfSweave-example.Rnw") # Default as of version 1.2 is pdf=T # # or use # # R CMD pgfsweave pgfSweave-example.Rnw ## From the command line which calls texi2dvi (default uses pdflatex) # ## NOTE: LaTeX may not be included in your path by default when using the R ## GUI, please see the FAQ in the pgfSweave vignette if your latex or pdflatex ## are not found. ## Use pgfSweave outside of R with the script provided in the pgfSweave exec/ directory ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.