[Pgfsweave-commits] r25 - in pkg: . R inst inst/doc inst/doc/figs inst/example inst/misc inst/misc/vignette-src inst/tests man
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Jan 17 00:59:42 CET 2011
Author: cameronbracken
Date: 2011-01-17 00:59:41 +0100 (Mon, 17 Jan 2011)
New Revision: 25
Added:
pkg/inst/doc/pgfSweave_hans.Rnw
pkg/inst/doc/pgfSweave_hans.pdf
pkg/inst/example/caching.Rnw
pkg/inst/tests/
pkg/inst/tests/Makefile
pkg/inst/tests/tidy.Rnw
pkg/inst/tests/tidy2.Rnw
Modified:
pkg/ChangeLog
pkg/DESCRIPTION
pkg/NEWS
pkg/R/pgfSweaveDriver.R
pkg/R/utilities.R
pkg/R/zzz.R
pkg/README.md
pkg/inst/doc/figs/fig-normalSweave.pdf
pkg/inst/doc/figs/fig-pgfSweave-hist.pdf
pkg/inst/doc/figs/fig-pgfSweave-tikz-hist.pdf
pkg/inst/doc/pgfSweave-example-Rnw.in
pkg/inst/doc/pgfSweave-example-tex.in
pkg/inst/doc/pgfSweave-example.pdf
pkg/inst/doc/pgfSweave.Rnw
pkg/inst/doc/pgfSweave.pdf
pkg/inst/example/Makefile
pkg/inst/example/pgfSweave-example.Rnw
pkg/inst/misc/test-for-pgf.tex
pkg/inst/misc/vignette-src/Makefile
pkg/inst/misc/vignette-src/pgfSweave-vignette-source.Rnw
pkg/man/pgfSweaveDriver.Rd
Log:
Version 1.1.3 RC1
Modified: pkg/ChangeLog
===================================================================
--- pkg/ChangeLog 2010-12-18 00:12:34 UTC (rev 24)
+++ pkg/ChangeLog 2011-01-16 23:59:41 UTC (rev 25)
@@ -1,3 +1,366 @@
+commit 199bb28ffa62532c8df42500519ef4516c04e5fc
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Sun Jan 16 14:58:51 2011 -0700
+
+ Update links to tidy.source in docs
+
+ man/pgfSweaveDriver.Rd | 4 ++--
+ 1 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 12ecc4ea27bd259885ab9fc647bd34d2bc7df0eb
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Sun Jan 16 14:40:42 2011 -0700
+
+ Minor cleanup and tweak to example
+
+ R/pgfSweaveDriver.R | 4 ++--
+ inst/example/pgfSweave-example.Rnw | 8 ++++----
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+commit 8e42d428bc76b86a49685f2c3f631bb37e743c2e
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Tue Jan 11 15:50:11 2011 -0700
+
+ Copy cacheSweave functions and use cacheSweaveEvalWithOpt since the old changes to that function are no longer in use.
+
+ R/pgfSweaveDriver.R | 4 +-
+ R/utilities.R | 178 ++++++++++++++++++++++++++++++++++++++++---------
+ inst/example/Makefile | 2 +-
+ 3 files changed, 150 insertions(+), 34 deletions(-)
+
+commit d241291787a386c78b3c6554204065e171aa1472
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 15:47:25 2011 -0700
+
+ Cleaning up some more code
+
+ R/pgfSweaveDriver.R | 2 +-
+ R/zzz.R | 86 ++++++++++++++++++------------------
+ inst/example/pgfSweave-example.Rnw | 1 +
+ inst/tests/tidy2.Rnw | 4 +-
+ 4 files changed, 47 insertions(+), 46 deletions(-)
+
+commit 8c4283c98516de16df5883f59ba055291645245e
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 00:33:31 2011 -0700
+
+ Add repo info to README.md
+
+ README.md | 2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+commit 7465ff4f212ac021778dbca77ba7babbfa80668a
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 00:30:25 2011 -0700
+
+ Remove duplicate entry in NEWS
+
+ NEWS | 1 -
+ 1 files changed, 0 insertions(+), 1 deletions(-)
+
+commit 2368a38952e52fae58ca2fef1ab19631c9d0aafa
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 00:28:39 2011 -0700
+
+ Remove dead code, comment and format some of driver code
+
+ R/pgfSweaveDriver.R | 81 +++++++++++++++++++++++++--------------------------
+ R/utilities.R | 8 ++---
+ 2 files changed, 43 insertions(+), 46 deletions(-)
+
+commit 172dcba3146c14f1ce27ffd94dbd17e167a1d343
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 00:28:29 2011 -0700
+
+ Update NEWS
+
+ NEWS | 19 ++++++++++---------
+ 1 files changed, 10 insertions(+), 9 deletions(-)
+
+commit d5ccf25b0712a3776d94d6c5891b696c87a1c0ff
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 10 00:27:18 2011 -0700
+
+ Move all new features to github issue tracker, old items to OREADME.md
+
+ OREADME.md | 52 ++++++++++++++++++++++++++++++++++
+ README.md | 90 ++---------------------------------------------------------
+ 2 files changed, 56 insertions(+), 86 deletions(-)
+
+commit 2bc528c6a21a6e19bd68ff9de70fdbdf004c0d44
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Sun Jan 9 17:42:43 2011 -0700
+
+ Fix CRLF (just in case)
+
+ inst/tests/tidy.Rnw | 7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+commit 06ee9f05dfc68fe5ded9703c2d163b029c1c7351
+Author: Yihui Xie <xie at yihui.name>
+Date: Sun Jan 9 16:59:00 2011 -0600
+
+ use 0.75 is OK now; deparse.tidy() can deal with the case in which inline comments are pushed to the next line
+
+ R/pgfSweaveDriver.R | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit 4a4652bf4fd978c6c80af42abfaf88e7f714e6b7
+Author: Yihui Xie <xie at yihui.name>
+Date: Sun Jan 9 16:57:24 2011 -0600
+
+ parse.tidy and deparse.tidy are in formatR now
+
+ R/utilities.R | 40 ----------------------------------------
+ 1 files changed, 0 insertions(+), 40 deletions(-)
+
+commit 2760c5a76dddeaf97cb2f415e2524e942734ff82
+Author: Yihui Xie <xie at yihui.name>
+Date: Sun Jan 9 16:55:43 2011 -0600
+
+ trim white spaces, as my first step to touch other people's code
+
+ R/pgfSweaveDriver.R | 230 +++++++++++++++++++++++++-------------------------
+ R/utilities.R | 56 ++++++------
+ 2 files changed, 143 insertions(+), 143 deletions(-)
+
+commit 98db46a6e251fdc1c01b9546a79bd19f4352dc5d
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Sun Jan 9 05:45:01 2011 -0700
+
+ Incorporate new features from formatR 0.1-7, saves alot of grief, but still a small bug in printing long lines with inline comments.
+
+ Rebuild Vignette
+
+ ChangeLog | 211 ++++++++++++++++++++
+ DESCRIPTION | 2 +-
+ NEWS | 3 +-
+ R/pgfSweaveDriver.R | 55 +++---
+ R/utilities.R | 31 ++-
+ inst/doc/figs/fig-normalSweave.pdf | Bin 3139 -> 2937 bytes
+ inst/doc/figs/fig-pgfSweave-hist.pdf | Bin 16297 -> 16299 bytes
+ inst/doc/figs/fig-pgfSweave-tikz-hist.pdf | Bin 26936 -> 26907 bytes
+ inst/doc/pgfSweave-example-Rnw.in | 7 +-
+ inst/doc/pgfSweave-example-tex.in | 8 +-
+ inst/doc/pgfSweave-example.pdf | Bin 27626 -> 76150 bytes
+ inst/doc/pgfSweave.Rnw | 106 +++++++----
+ inst/doc/pgfSweave.pdf | Bin 258657 -> 276681 bytes
+ inst/misc/vignette-src/Makefile | 4 +-
+ .../vignette-src/pgfSweave-vignette-source.Rnw | 14 +-
+ inst/tests/tidy2.Rnw | 14 +-
+ 16 files changed, 359 insertions(+), 96 deletions(-)
+
+commit 05087396230a7436dbb38354324592be9e23031b
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Jan 7 13:39:40 2011 -0700
+
+ Remove debugging code
+
+ R/pgfSweaveDriver.R | 3 ---
+ inst/example/pgfSweave-example.Rnw | 1 +
+ 2 files changed, 1 insertions(+), 3 deletions(-)
+
+commit c542d07aa53eea2e50c9eb6acf42993cfeaabb0c
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Jan 7 13:32:35 2011 -0700
+
+ New example from Yihui Xie, updated existing example
+
+ inst/example/Makefile | 3 +
+ inst/example/caching.Rnw | 148 ++++++++++++++++++++++++++++++++++++
+ inst/example/pgfSweave-example.Rnw | 4 +-
+ 3 files changed, 153 insertions(+), 2 deletions(-)
+
+commit 9c507a65e552cba1d9ae593e25fd8031c615a166
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Jan 7 13:31:57 2011 -0700
+
+ Inline comments actually work now with tidy=T
+
+ R/pgfSweaveDriver.R | 141 ++++++++++++++++++++++++++------------------------
+ 1 files changed, 73 insertions(+), 68 deletions(-)
+
+commit 94dc4f68ac69ebdf18d5eadb4e848f72a0cf6b4d
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Jan 7 12:18:24 2011 -0700
+
+ Inline comments actually working now
+
+ R/pgfSweaveDriver.R | 24 ++++++------------------
+ R/utilities.R | 11 +++++++++++
+ 2 files changed, 17 insertions(+), 18 deletions(-)
+
+commit 97855e0a2831109b6b8bf05559271329444d7341
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Jan 7 12:16:40 2011 -0700
+
+ Tests using tidy and inline comments, from Yihui Xie and Alan Arnholt
+
+ inst/tests/Makefile | 11 +++++
+ inst/tests/tidy.Rnw | 21 +++++++++
+ inst/tests/tidy2.Rnw | 110 ++++++++++++++++++++++++++++++++++++++++++++++++++
+ 3 files changed, 142 insertions(+), 0 deletions(-)
+
+commit 606352f7b7b804f853079f8973cad55d045cf437
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Thu Jan 6 17:23:42 2011 -0700
+
+ Inline comments are now preserved when tidy=T
+
+ DESCRIPTION | 4 +-
+ NEWS | 8 ++++-
+ R/pgfSweaveDriver.R | 30 ++++++++++++++++++---
+ R/utilities.R | 70 +--------------------------------------------------
+ 4 files changed, 34 insertions(+), 78 deletions(-)
+
+commit db16ab329d5ec5a2576c4fd89209c6d79c4de434
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Thu Jan 6 15:47:05 2011 -0700
+
+ Rebuild pdf version of Hans' Vignette
+
+ inst/doc/pgfSweave_hans.pdf | Bin 236774 -> 236103 bytes
+ 1 files changed, 0 insertions(+), 0 deletions(-)
+
+commit d1bd42a8443ea9708315f22da429c0f532f2a163
+Merge: 785d963 99d5bdd
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Thu Jan 6 15:42:34 2011 -0700
+
+ Merge branch 'master' of https://github.com/hans-ekbrand/pgfSweave into hans-ekbrand-master
+
+commit 99d5bddc0dfe65a7a5f19993151857cd01f79af5
+Author: Hans Ekbrand <hans.ekbrand at gmail.com>
+Date: Thu Jan 6 23:33:52 2011 +0100
+
+ removed the reference to the mysterious error message when the cache dir did not exist
+
+ inst/doc/pgfSweave_hans.Rnw | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+commit 4b22d8cc3603ce668abe32387f8737fe9e7a315c
+Author: Hans Ekbrand <hans.ekbrand at gmail.com>
+Date: Thu Jan 6 23:33:21 2011 +0100
+
+ Enhancement: no dots in chunk-name when fig=T and pdf=T
+
+ inst/doc/pgfSweave_hans.Rnw | 4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+commit 31c020ef40a703b1786f7ce85b9ecf74e5eda7ac
+Author: Hans Ekbrand <hans.ekbrand at gmail.com>
+Date: Thu Jan 6 23:32:22 2011 +0100
+
+ Correction: dvi-files, not encapsulated postscript files
+
+ inst/doc/pgfSweave_hans.Rnw | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+commit c457b004ff17e448bfabb201daf1573871019482
+Author: Hans Ekbrand <hans.ekbrand at gmail.com>
+Date: Thu Jan 6 23:31:04 2011 +0100
+
+ Removing any references to \pgfrealjobname since these are not necessary with pgfSweave 1.1 and above
+
+ inst/doc/pgfSweave_hans.Rnw | 4 +---
+ 1 files changed, 1 insertions(+), 3 deletions(-)
+
+commit 785d96375024ba9ad762ae1a9542e659f7d007a1
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Thu Jan 6 13:59:19 2011 -0700
+
+ Updates to the vignette, prepping for next release
+
+ DESCRIPTION | 4 +-
+ NEWS | 2 +
+ README.md | 2 +
+ inst/example/pgfSweave-example.Rnw | 4 +--
+ inst/misc/test-for-pgf.tex | 2 +-
+ .../vignette-src/pgfSweave-vignette-source.Rnw | 22 +++++++++++++++----
+ 6 files changed, 25 insertions(+), 11 deletions(-)
+
+commit 4fb9b4eef7f466cecb261052a74d80548b907d4a
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Thu Jan 6 13:57:10 2011 -0700
+
+ Fix for reusing code chunks with keep.source=T, fixes Issue 9
+
+ R/pgfSweaveDriver.R | 21 +++++++++++++++++----
+ 1 files changed, 17 insertions(+), 4 deletions(-)
+
+commit 716f33dd47c205c39fc78265ddefa1ffa98aa661
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Wed Jan 5 15:30:35 2011 -0700
+
+ New Vignette! Courtesy of Hans Ekbrand.
+
+ inst/doc/pgfSweave_hans.Rnw | 380 +++++++++++++++++++++++++++++++++++++++++++
+ inst/doc/pgfSweave_hans.pdf | Bin 0 -> 236774 bytes
+ 2 files changed, 380 insertions(+), 0 deletions(-)
+
+commit e338a7313ca7b5bc0e7be415bd4263d9bee7888a
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Mon Jan 3 12:46:35 2011 -0700
+
+ Don't produce extra Rplots.pdf file
+
+ DESCRIPTION | 2 +-
+ NEWS | 7 +-
+ R/pgfSweaveDriver.R | 5 +
+ README.md | 28 +--
+ inst/doc/pgfSweave.pdf | Bin 258644 -> 258657 bytes
+ inst/example/pgfSweave-example.Rnw | 8 +-
+ inst/example/pgfSweave-example.tex | 424 ------------------------------------
+ 7 files changed, 21 insertions(+), 453 deletions(-)
+
+commit 93accdf3f78829c601e0a35ee111086c71562646
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Dec 17 17:11:05 2010 -0700
+
+ Update NEWS and version number
+
+ DESCRIPTION | 4 ++--
+ NEWS | 13 +++++++++++++
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+commit d79d82577d58f2af5c367081ef4d6675c3435982
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Dec 17 16:50:53 2010 -0700
+
+ Don't fail on installation when the user has a hardcoded working directory
+
+ exec/install-script.R | 36 ++++++++++++++++++++++--------------
+ 1 files changed, 22 insertions(+), 14 deletions(-)
+
+commit e3543663ab267471d29b80c8dd47143fd4e8b290
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Dec 17 16:29:39 2010 -0700
+
+ Remove excess browser() call, correctly find arch dependent Rscript
+
+ R/pgfSweaveDriver.R | 1 -
+ inst/doc/pgfSweave.pdf | Bin 258644 -> 258644 bytes
+ inst/example/pgfSweave-example.Rnw | 2 +-
+ inst/example/pgfSweave-example.tex | 1 +
+ src/Makevars | 2 +-
+ 5 files changed, 3 insertions(+), 3 deletions(-)
+
+commit dc89b16767daf9fa5eba9bc16635b96a0704e4e8
+Author: cameronbracken <cameron.bracken at gmail.com>
+Date: Fri Dec 3 11:52:40 2010 -0700
+
+ Version 1.1.1
+
+ ChangeLog | 18 ++
+ DESCRIPTION | 4 +-
+ inst/doc/figs/fig-normalSweave.pdf | Bin 2937 -> 3139 bytes
+ inst/doc/figs/fig-pgfSweave-hist.pdf | Bin 16182 -> 16297 bytes
+ inst/doc/figs/fig-pgfSweave-tikz-hist.pdf | Bin 26895 -> 26936 bytes
+ inst/doc/pgfSweave-example.pdf | Bin 82901 -> 27626 bytes
+ inst/doc/pgfSweave.Rnw | 458 +++++++++++++++++++++++++++--
+ inst/doc/pgfSweave.pdf | Bin 271887 -> 258644 bytes
+ 8 files changed, 448 insertions(+), 32 deletions(-)
+
commit 6aefd96107e78e2dbec3cd2e05d12e8a04bb44a2
Author: cameronbracken <cameron.bracken at gmail.com>
Date: Fri Dec 3 11:42:37 2010 -0700
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2010-12-18 00:12:34 UTC (rev 24)
+++ pkg/DESCRIPTION 2011-01-16 23:59:41 UTC (rev 25)
@@ -1,16 +1,16 @@
Package: pgfSweave
Type: Package
Title: Quality speedy graphics compilation with Sweave
-Version: 1.1.2
-Date: 2010-12-17
+Version: 1.1.3
+Date: 2011-01-16
Author: Cameron Bracken <cameron.bracken at gmail.com> and Charlie Sharpsteen <source at sharpsteen.net>
Maintainer: Cameron Bracken <cameron.bracken at gmail.com>
-Depends: stashR, filehash, tikzDevice, cacheSweave, getopt, highlight
+Depends: stashR, filehash, tikzDevice, cacheSweave, getopt, highlight, formatR
Imports: digest, tools, utils
SystemRequirement: pgf (>=2.00) (http://sourceforge.net/projects/pgf/) for the
vignette and for externalization.
Description: pgfSweave provides a number of improvements to the improve
- speed and quality of the Sweave output including: (1) capabilities for
+ 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
@@ -19,6 +19,6 @@
Sweave (pgfSweaveDriver) with new chunk options tikz, pgf, external,
sanitize, highlight and tidy on top of the cache option provided by
cacheSweave.
-License: GPL
+License: GPL (>= 3)
LazyLoad: yes
URL: https://r-forge.r-project.org/projects/pgfsweave/
Modified: pkg/NEWS
===================================================================
--- pkg/NEWS 2010-12-18 00:12:34 UTC (rev 24)
+++ pkg/NEWS 2011-01-16 23:59:41 UTC (rev 25)
@@ -1,6 +1,20 @@
Please see the README.md file for development info
--------------------------
+Version 1.1.3 - 2011-01-07
+--------------------------
+* [NEW] Use the "null device" to avoid generation of Rplots.pdf, as suggested
+ by yihui, fixes Issue 8
+* [NEW] New Vignette, courtesy of Hans Ekbrand! Focuses on the use of
+ pgfSweave with large data sets
+* [NEW] Example using caching by Yihui, inst/example/caching.Rnw
+* [NEW] Inline comments are now preserved thanks to changes in the
+ tidy.source() function from the formatR package
+* [NEW] The formatR package is now a dependency of pgfSweave
+* [FIXED] Reusing code chunks now works as expected, fixes Issue 9
+* [FIXED] Links to tidy.source now correctly point to formatR
+
+--------------------------
Version 1.1.2 - 2010-12-17
--------------------------
* Remove extraneous browser() call
@@ -12,7 +26,6 @@
--------------------------
* Actually make Highlight TRUE by default, as advertised
-
--------------------------
Version 1.1 - 2010-11-29
--------------------------
Modified: pkg/R/pgfSweaveDriver.R
===================================================================
--- pkg/R/pgfSweaveDriver.R 2010-12-18 00:12:34 UTC (rev 24)
+++ pkg/R/pgfSweaveDriver.R 2011-01-16 23:59:41 UTC (rev 25)
@@ -1,5 +1,5 @@
######################################################################
-## Copyright (C) 2008, Cameron Bracken <cameron.bracken at gmail.com>
+## Copyright (C) 2011, Cameron Bracken <cameron.bracken at gmail.com>
## Charlie Sharpsteen <source at shaprpsteen.net>
##
## This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,7 @@
#####################################################################
######################################################################
-## Heavily relies on functions of cacheSweave but reimplements the
+## Heavily relies on functions of cacheSweave but reimplements the
## Sweave driver function.
pgfSweaveDriver <- function() {
@@ -28,20 +28,20 @@
runcode = pgfSweaveRuncode,
writedoc = pgfSweaveWritedoc,
finish = utils::RweaveLatexFinish,
- checkopts = pgfSweaveOptions
+ checkopts = pgfSweaveOptions
)
}
-
+
source('R/cacheSweaveUnexportedFunctions.R')
source('R/utilities.R')
## Add the 'pgf' and 'external', 'pdflatex', 'sanitize' option to the list
pgfSweaveSetup <- function(file, syntax,
output=NULL, quiet=FALSE, debug=FALSE, echo=TRUE,
- eval=TRUE, split=FALSE, stylepath=TRUE,
- pdf=FALSE, eps=FALSE, cache=FALSE, pgf=FALSE,
- tikz=TRUE, external=FALSE, sanitize = FALSE,
+ eval=TRUE, split=FALSE, stylepath=TRUE,
+ pdf=FALSE, eps=FALSE, cache=FALSE, pgf=FALSE,
+ tikz=TRUE, external=FALSE, sanitize = FALSE,
highlight = TRUE, tidy = FALSE, tex.driver="pdflatex")
{
out <- utils::RweaveLatexSetup(file, syntax, output=output, quiet=quiet,
@@ -70,19 +70,23 @@
out[["mapFile"]] <- makeMapFileName(file)
file.create(out[["mapFile"]]) ## Overwrite an existing file
## End additions [RDP]
-
- ## [CWB] create a shell script with a command for each modified
- ## graphic
+
+ ## [CWB] create a shell script with a command for each modified graphic
out[["shellFile"]] <- makeExternalShellScriptName(file)
- out[["srcfileName"]] <- sub("\\.Rnw$", "\\.tex", file)
+ out[["srcfileName"]] <- sub("\\.[Rr]nw$", "\\.tex", file)
out[["jobname"]] <- basename(removeExt(file))
file.create(out[["shellFile"]]) ## Overwrite an existing file
######################################################################
+ # Avoids creation of Rplots.pdf
+ options(device = function(...) {
+ .Call("R_GD_nullDevice", PACKAGE = "grDevices")
+ })
+
out
}
- # changes in Sweave in 2.12 make it necessary to copy this function here
+ # changes in Sweave in 2.12 make it necessary to copy this function here
# to register the tex.driver option, I wish there was an easier way....
pgfSweaveOptions <- function(options)
{
@@ -129,7 +133,7 @@
# Copied from Sweave in R version 2.12, internal chages make it necessary
# to register the tex.driver option as a "NOLOGOPT"
- # This function checks for the \usepackage{Sweave} line and the
+ # This function checks for the \usepackage{Sweave} line and the
# \pgfrealjobname line
pgfSweaveWritedoc <- function(object, chunk)
{
@@ -137,62 +141,72 @@
if(length(grep("\\usepackage[^\\}]*Sweave.*\\}", chunk)))
object$havesty <- TRUE
-
+
haverealjobname <- FALSE
if(length(grep("\\pgfrealjobname\\{.*\\}", chunk)))
haverealjobname <- TRUE
-
-
+
+
if(!object$havesty){
- begindoc <- "^[[:space:]]*\\\\begin\\{document\\}"
- which <- grep(begindoc, chunk)
- if (length(which)) {
- print(object$srcfile)
+ begindoc <- "^[[:space:]]*\\\\begin\\{document\\}"
+ which <- grep(begindoc, chunk)
+ if (length(which)) {
+ if(length(which) > 1) cat('havesty',which,'\n')
chunk[which] <- paste("\\usepackage{", object$styfile, "}\n",
chunk[which], sep="")
linesout <- linesout[c(1L:which, which, seq(from=which+1L, length.out=length(linesout)-which))]
object$havesty <- TRUE
}
}
-
+
# add pgfrealjobname if it doesnt exist
if(!haverealjobname){
begindoc <- "^[[:space:]]*\\\\begin\\{document\\}"
which <- grep(begindoc, chunk)
# if Sweave line also does not exist
- otherwhich <- grep("\\usepackage[^\\}]*Sweave.*\\}", chunk)
- if(length(which) == 0) which <- otherwhich
+ #otherwhich <- grep("\\usepackage[^\\}]*Sweave.*\\}", chunk)
+ otherwhich <- grep("^[[:space:]]*\\\\usepackage\\{.*tikz.*\\}", chunk)
+ other <- FALSE
+ if(length(which) == 0){which <- otherwhich;other <- T}
if (length(which)) {
- chunk[which] <- paste("\\pgfrealjobname{",object$jobname,"}\n",
- chunk[which], sep="")
- linesout <- linesout[c(1L:which, which, seq(from=which+1L, length.out=length(linesout)-which))]
- object$haverealjobname <- TRUE
- }
- }
+ if(length(which) > 1) {cat('haverealjobname',which,'\n');browser()}
+ chunk[which] <-
+ if(other)
+ paste(chunk[which],"\n\\pgfrealjobname{",object$jobname,"}\n", sep="")
+ else
+ paste("\\pgfrealjobname{",object$jobname,"}\n",chunk[which], sep="")
+ linesout <- linesout[c(1L:which, which, seq(from=which+1L, length.out=length(linesout)-which))]
+ object$haverealjobname <- TRUE
+ }
+ }
- # always add the syntax definitions because there is no real way to
- # check if a single code chunk as the option before hand.
+ # always add the syntax definitions because there is no real way to
+ # check if a single code chunk as the option before hand.
if (!object$haveHighlightSyntaxDef){
- # get the latex style definitions from the highlight package
- tf <- tempfile()
- cat(styler('default', 'sty', styler_assistant_latex),sep='\n',file=tf)
- cat(boxes_latex(),sep='\n',file=tf,append=T)
- hstyle <- readLines(tf)
- # find where to put the style definitions
+ # get the latex style definitions from the highlight package
+ tf <- tempfile()
+ cat(styler('default', 'sty', styler_assistant_latex),sep='\n',file=tf)
+ cat(boxes_latex(),sep='\n',file=tf,append=T)
+ hstyle <- readLines(tf)
+ # find where to put the style definitions
begindoc <- "^[[:space:]]*\\\\begin\\{document\\}"
- which <- grep(begindoc, chunk)
- otherwhich <- grep("\\usepackage[^\\}]*Sweave.*\\}", chunk)
- if(!length(which)) which <- otherwhich
- # put in the style definitions before the \begin{document}
+ # first try to put it before the begin{document} command
+ # this may not work if there is a code chunk before it
+ which <- grep(begindoc, chunk)
+ # also try to put it by the Sweave style file,
+ otherwhich <- grep("\\usepackage[^\\}]*Sweave.*\\}", chunk)
+ if(!length(which)) which <- otherwhich
+
+ # put in the style definitions before the \begin{document}
+ # or \usepackage{Sweave}
if(length(which)) {
- chunk <- c(chunk[1:(which-1)],hstyle,chunk[which:length(chunk)])
-
- linesout <- linesout[c(1L:which, which, seq(from = which +
- 1L, length.out = length(linesout) - which))]
+ if(length(which) > 1) cat('havehighlight',which,'\n')
+ chunk <- c(chunk[1:(which-1)],hstyle,chunk[which:length(chunk)])
+ linesout <- linesout[c(1L:which, which, seq(from = which +
+ 1L, length.out = length(linesout) - which))]
object$haveHighlightSyntaxDef <- TRUE
}
}
-
while(length(pos <- grep(object$syntax$docexpr, chunk)))
{
cmdloc <- regexpr(object$syntax$docexpr, chunk[pos[1L]])
@@ -238,14 +252,16 @@
-## This function is essentially unchanged from the original Sweave
+## [RDP] This function is essentially unchanged from the original Sweave
## version, except I compute the digest of the entire chunk, write out
## information to the map file, and use 'cacheSweaveEvalWithOpt'
## instead. Note that everything in this function operates at the
## chunk level. The code has been copied from R 2.5.0.
+## [CWB] Here are the main changes that allow for tikz graphic output and
+## highlighting and such
pgfSweaveRuncode <- function(object, chunk, options) {
-
+
if(!(options$engine %in% c("R", "S"))){
return(object)
}
@@ -294,30 +310,37 @@
on.exit(options(saveopts))
SweaveHooks(options, run=TRUE)
- # remove unwanted "#line" comments added by R 2.12
- if(substring(chunk[1], 1, 5) == "#line") chunk <- chunk[-1]
-
+
+ # remove unwanted "#line" directives added by R 2.12
+ removeLineJunk <- function(chunk){
+ lines <- grep("#line", chunk)
+ srclines <- attr(chunk, "srclines")
+ chunk <- chunk[-lines]
+ attr(chunk, "srclines") <- srclines[-lines]
+ chunk
+ }
+ chunk <- removeLineJunk(chunk)
+
## parse entire chunk block
- chunkexps <-
+ chunkexps <-
if(options$tidy){
- try(parse2(text=chunk), silent=TRUE)
+ try(parse.tidy(text=chunk), silent=TRUE)
}else{
try(parse(text=chunk), silent=TRUE)
}
+
RweaveTryStop(chunkexps, options)
- ## [CWB] Create a DB entry which is simply the digest of the text of
- ## the chunk so that if anything has changed the chunk will be
- ## recognised as having a change if ANYTHING gets changed, even white
- ## space. this still doesnt fix the problem of actually caching the
- ## plotting commands and others which do not create objects in the
- ## global environment when they are evaluated but at least the figures
+ ## [CWB] Create a DB entry which is simply the digest of the text of
+ ## the chunk so that if anything has changed the chunk will be
+ ## recognised as having a change if ANYTHING gets changed, even white
+ ## space. this still doesnt fix the problem of actually caching the
+ ## plotting commands and others which do not create objects in the
+ ## global environment when they are evaluated but at least the figures
## will get regenerated.
- chunkTextEvalString <- paste("chunkText <- '",
+ chunkTextEvalString <- paste("chunkText <- '",
digest(paste(chunk,collapse='')), "'", sep='')
attr(chunk, "digest") <- digest(paste(chunk,collapse=''))
- #if(substr(chunk[1],1,9)!='chunkText')
- # chunk <- c(chunkTextEvalString, chunk)
## end [CWB]
## Adding my own stuff here [RDP]
@@ -341,11 +364,13 @@
else
lastshown <- srcline - 1
thisline <- 0
-
+
for(nce in 1:length(chunkexps)){
ce <- chunkexps[[nce]]
+
if (nce <= length(srcrefs) && !is.null(srcref <- srcrefs[[nce]])) {
if (options$expand) {
+ # expand references to other chunks
srcfile <- attr(srcref, "srcfile")
showfrom <- srcref[1]
showto <- srcref[3]
@@ -355,32 +380,35 @@
showto <- srclines[srcref[3]]
}
dce <- getSrcLines(srcfile, lastshown+1, showto)
- # replace the comment identifiers
- if(options$tidy){
- dce <- gsub(sprintf("%s = \"|%s\"", getOption("begin.comment"),
- getOption("end.comment")), "", dce)
- # replace tabs with spaces for better looking output
- dce <- gsub("\\\\t", " ", dce)
- }
- # replace leading lines with #line from 2.12.0
+
+ if(options$tidy) dce <- unmask.source(dce)
+
leading <- showfrom-lastshown
lastshown <- showto
srcline <- srclines[srcref[3]]
- while (length(dce) && length(grep("^[ \\t]*$", dce[1]))) {
+
+ # Remove blank lines at head of chunk
+ while (length(dce) && length(grep("^[[:blank:]]*$", dce[1]))) {
dce <- dce[-1]
leading <- leading - 1
}
+
} else {
+
dce <-
if(options$tidy){
- deparse2(ce, width.cutoff = 0.75*getOption("width"))
+ deparse.tidy(ce, width.cutoff = 0.75 * getOption("width"))
}else{
- deparse(ce, width.cutoff = 0.75*getOption("width"))
+ deparse(ce, width.cutoff = 0.75 * getOption("width"))
}
+
leading <- 1
+
}
+
if(object$debug)
cat("\nRnw> ", paste(dce, collapse="\n+ "),"\n")
+
if(options$echo && length(dce)){
if(!openSinput & !options$highlight){
if(!openSchunk){
@@ -393,15 +421,19 @@
openSinput <- TRUE
}
- # Code highlighting stuff
+ # Actual printing of chunk code
if(options$highlight){
-
- if(length(grep("^[[:space:]]*$",dce)) >= 1){
- # for blank lines for which parser throws an error
- cat(translator_latex(paste(getOption("prompt"),'\n', sep="")),
+
+ # print highlighted output, treat blank lines specially
+ if(length(grep("^[[:space:]]*$",dce)) >= 1 & length(dce) == 1){
+
+ # for blank lines for which parser throws an error
+ cat(translator_latex(paste(getOption("prompt"),'\n', sep="")),
file=chunkout, append=TRUE, sep="")
cat(newline_latex(),file=chunkout, append=TRUE)
+
}else{
+
if(nce == 1)
cat(newline_latex(),file=chunkout, append=TRUE)
highlight(parser.output=parser(text=dce),
@@ -409,97 +441,97 @@
output = chunkout, showPrompts=TRUE,final.newline = TRUE)
# highlight doesnt put in an ending newline for some reason
cat(newline_latex(),file=chunkout, append=TRUE)
+
}
}else{
- cat("\n",paste(getOption("prompt"), dce[1:leading], sep="",
+ # regular output, may be tidy'd or not
+ cat("\n",paste(getOption("prompt"), dce[1:leading], sep="",
collapse="\n"), file=chunkout, append=TRUE, sep="")
if (length(dce) > leading)
- cat("\n", paste(getOption("continue"), dce[-(1:leading)], sep="",
+ cat("\n", paste(getOption("continue"), dce[-(1:leading)], sep="",
collapse="\n"), file=chunkout, append=TRUE, sep="")
+
}
+
linesout[thisline + 1:length(dce)] <- srcline
thisline <- thisline + length(dce)
}
-
- ## tmpcon <- textConnection("output", "w")
- ## avoid the limitations (and overhead) of output text
- ## connections
- tmpcon <- file()
- sink(file=tmpcon)
- err <- NULL
-
- ## [RDP] change this line to use my EvalWithOpt function
- if(options$eval) err <- pgfSweaveEvalWithOpt(ce, options)
- ## [CWB] added another output specifying if the code chunk
- ## was changed or not. This was an ititial attempt to
- ## improve cacheSweave''s recognition of chages in a
- ## code chunk though it is defunct now.
- chunkChanged <- FALSE#err$chunkChanged
- err <- err$err
- ## [CWB] end
- ## [RDP] end change
-
- cat("\n") # make sure final line is complete
- sink()
- output <- readLines(tmpcon)
- close(tmpcon)
- ## delete empty output
- if(length(output)==1 & output[1]=="") output <- NULL
-
- RweaveTryStop(err, options)
-
- if(object$debug)
- cat(paste(output, collapse="\n"))
-
- if(length(output)>0 & (options$results != "hide")){
- if(openSinput){
- cat("\n\\end{Sinput}\n", file=chunkout,append=TRUE)
- linesout[thisline + 1:2] <- srcline
- thisline <- thisline + 2
- openSinput <- FALSE
- }
-
- if(options$results=="verbatim"){
- if(!openSchunk){
- cat("\\begin{Schunk}\n",file=chunkout, append=TRUE)
+
+ # do not evaluate empty expressions, these may occur when tidy=T
+ if(length(ce) > 0){
+
+ ## tmpcon <- textConnection("output", "w")
+ ## avoid the limitations (and overhead) of output text connections
+ tmpcon <- file()
+ sink(file=tmpcon)
+ err <- NULL
+
+ if(options$eval) err <- cacheSweaveEvalWithOpt(ce, options)
+ ## [RDP] end change
+
+ cat("\n") # make sure final line is complete
+ sink()
+ output <- readLines(tmpcon)
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/pgfsweave -r 25
More information about the Pgfsweave-commits
mailing list