pgfSweave: Quality speedy graphics compilation and caching for Sweave

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/pgfSweave.R

Description

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.

Usage

1
2
3
  pgfSweave(file, compile.tex = TRUE,
    graphics.only = FALSE, pdf = T,
    syntax = getOption("SweaveSyntax"), np = 2, ...)

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.

graphics.only

If TRUE Only run Sweave and then the commands to externalize graphics, don\'t call texi2dvi to do the final compilation.

pdf

Passed to texi2dvi. If TRUE (default) then generate a pdf file otherwise generate a dvi file.

syntax

An object of class SweaveSyntax or a character string with its name. The default installation provides SweaveSyntaxNoweb and SweaveSyntaxLatex (passed to Sweave).

np

The number of parallel processes to use for graphics externalization.

...

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

Note

Author(s)

Cameron Bracken [email protected] 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

 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)

cameronbracken/pgfSweave documentation built on May 11, 2017, 9:54 p.m.