pgfSweave {pgfSweave} | R Documentation |
The pgfSweave package provides capabilities for 'caching' graphics generated with Sweave. Using pgfSweave, figure labels are converted to LaTeX strings so not only do they match the style of the document but math can be put in labels. pgfSweave provides a new driver for Sweave (pgfSweaveDriver) and new chunk options tikz, pgf and external on top of the cache option provided by cacheSweave. This package is built upon cacheSweave and therefore also Sweave.
pgfSweave(file, compile.tex = TRUE, syntax = getOption("SweaveSyntax"), ...)
file |
A connection or a character string giving the name of the file to load. |
compile.tex |
If TRUE run LaTeX /pdfLaTeX on the resulting tex file. If FALSE only run Sweave . |
syntax |
An object of class SweaveSyntax or a character string with its name. The default installation provides SweaveSyntaxNoweb and SweaveSyntaxLatex (passed to Sweave). |
... |
Other options to be passed to texi2dvi |
This package provides new features beyond cacheSweave
:
The process carried out by pgfSweave
involves:
Sweave
on the .Rnw file using pgfSweaveDriver
function.
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.
compile.tex=TRUE
the 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.
pgfrealjobname{myfile}
MUST in the header of your LaTeX
file for the external graphics capablities.
Cameron Bracken cameron.bracken@gmail.com 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/
pgfSweaveDriver
,
Sweave
,
tikzDevice
cacheSweave
## 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",pdf=T) # or # R CMD pgfsweave pgfSweave-example.Rnw ## which calls texi2dvi ## WINDOWS USERS: This has only been tested with MiKTeX ## End(Not run) ## Use pgfSweave outside of R with the script provided in the pgfSweave exec/ directory