The R Project SVN R

Rev

Rev 57261 | Rev 80718 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 57261 Rev 61191
Line 16... Line 16...
16
 
16
 
17
## Testing Sweave
17
## Testing Sweave
18
 
18
 
19
.proctime00 <- proc.time()
19
.proctime00 <- proc.time()
20
library(utils)
20
library(utils)
21
options(digits=5) # to avoid trivial printed differences
21
options(digits = 5) # to avoid trivial printed differences
22
options(show.signif.stars=FALSE) # avoid fancy quotes in o/p
22
options(show.signif.stars = FALSE) # avoid fancy quotes in o/p
23
 
23
 
24
SweaveTeX <- function(file, ...) {
24
SweaveTeX <- function(file, ...) {
25
    if(!file.exists(file))
25
    if(!file.exists(file))
26
        stop("File", file, "does not exist in", getwd())
26
        stop("File", file, "does not exist in", getwd())
27
    texF <- sub("\\.[RSrs]nw$", ".tex", file)
27
    texF <- sub("\\.[RSrs]nw$", ".tex", file)
Line 29... Line 29...
29
    if(!file.exists(texF))
29
    if(!file.exists(texF))
30
        stop("File", texF, "does not exist in", getwd())
30
        stop("File", texF, "does not exist in", getwd())
31
    readLines(texF)
31
    readLines(texF)
32
}
32
}
33
 
33
 
34
p0 <- function(...) paste(..., sep="")
34
p0 <- paste0
35
latexEnv <- function(lines, name) {
35
latexEnv <- function(lines, name) {
36
    stopifnot(is.character(lines), is.character(name),
36
    stopifnot(is.character(lines), is.character(name),
37
	      length(lines) >= 2, length(name) == 1)
37
	      length(lines) >= 2, length(name) == 1)
38
    beg <- p0("\\begin{",name,"}")
38
    beg <- p0("\\begin{",name,"}")
39
    end <- p0("\\end{",name,"}")
39
    end <- p0("\\end{",name,"}")