pgfSweave {pgfSweave}R Documentation

Quality speedy graphics compilation with Sweave

Description

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.

Usage

pgfSweave(file, compile.tex = TRUE, syntax = getOption("SweaveSyntax"), ...)

Arguments

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

Details

This package provides new features beyond cacheSweave:

  1. better recognition of code chunk changes
  2. the 'caching' of code chunks which generate graphics and
  3. an interface to the tikzDevice package and the eps2pgf utility for the generation of graphics in which the font matches that of the main document.

The process carried out by pgfSweave involves:

For more details see the pgfSweave package vignette.

Value

A pdf file is generated if compile.tex=TRUE and a tex file only is generated otherwise.

Known issues

  1. Sometimes caching is overzealous and caches and figures need to be manually removed.
  2. changing the width and height of a figure only does not register as a change
  3. A stray Rplots.pdf gets generated when using caching.

Note

Author(s)

Cameron Bracken cameron.bracken@gmail.com and Charlie Sharpsteen

References

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/

See Also

pgfSweaveDriver, Sweave, tikzDevice cacheSweave

Examples

## 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

[Package pgfSweave version 1.0.3 Index]