Skip to content

Commit

Permalink
replace outdated LaTeX package in installed Rnw file and test rendering
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@87698 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
smeyer committed Feb 6, 2025
1 parent 999378a commit bceb5e2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/library/utils/inst/Sweave/Sweave-test-1.Rnw
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
\documentclass[a4paper]{article}
\documentclass{article}

\title{A Test File}
\author{Friedrich Leisch}

\SweaveOpts{echo=FALSE}
\usepackage{a4wide}
\usepackage[a4paper,margin=1in]{geometry}

\begin{document}

Expand Down
14 changes: 9 additions & 5 deletions src/library/utils/tests/Sweave-tst.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,17 @@

## Testing Sweave

.proctime00 <- proc.time()
library(utils)
options(digits = 5) # to avoid trivial printed differences
options(show.signif.stars = FALSE) # avoid fancy quotes in o/p

SweaveTeX <- function(file, ...) {
if(!file.exists(file))
stop("File", file, "does not exist in", getwd())
stop("File ", sQuote(file), " does not exist in ", getwd())
texF <- sub("\\.[RSrs]nw$", ".tex", file)
Sweave(file, ...)
if(!file.exists(texF))
stop("File", texF, "does not exist in", getwd())
stop("File ", sQuote(texF), " does not exist in ", getwd())
readLines(texF)
}

Expand Down Expand Up @@ -80,5 +79,10 @@ Sweave("customgraphics.Rnw")
Sweave(f <- "Sexpr-verb-ex.Rnw")
tools::texi2pdf(sub("Rnw$","tex", f))# used to fail


cat('Time elapsed: ', proc.time() - .proctime00,'\n')
### ------------------------------------ 5 ----------------------------------
## render the installed Rnw file from example(Sweave), using R CMD Sweave
testfile <- system.file("Sweave", "Sweave-test-1.Rnw", package = "utils")
stopifnot(exprs = {
tools::Rcmd(c("Sweave", "--help")) == 0L
tools::Rcmd(c("Sweave", "--pdf", testfile)) == 0L
})

0 comments on commit bceb5e2

Please sign in to comment.