Skip to content

Commit

Permalink
Merge pull request yihui#180 from jonkeane/master
Browse files Browse the repository at this point in the history
pass ... from knit2pdf() to texi2pdf()
  • Loading branch information
yihui committed Mar 27, 2012
2 parents 355edc1 + ca44d19 commit 8e0a1d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Expand Up @@ -6,7 +6,7 @@ Version: 0.4.2
Date: 2012-03-15
Authors@R: c(person("Hadley", "Wickham", email = "hadley@rice.edu", role =
"ctb"), person("Ramnath", "Vaidyanathan", role = "ctb"), person("Joseph",
"Allaire", role = "ctb"), person("Tom", "Torsney-Weir", role = "ctb"),
"Allaire", role = "ctb"), person("Tom", "Torsney-Weir", role = "ctb"), person("Jonathan", "Keane", role = "ctb"),
person("Yihui", "Xie", email = "xie@yihui.name", role = c("aut", "cre")))
Author: Yihui Xie
Maintainer: Yihui Xie <xie@yihui.name>
Expand Down
5 changes: 3 additions & 2 deletions R/utils.R
Expand Up @@ -347,21 +347,22 @@ knit_env = function() {
#' compile the tex document to PDF (by default it uses the default setting of
#' \code{\link[tools]{texi2pdf}}, which is often PDFLaTeX); this argument will
#' be used to temporarily set the environmental variable \samp{PDFLATEX}
#' @param ... options to be passed to \code{\link[tools]{texi2pdf}}
#' @author Ramnath Vaidyanathan and Yihui Xie
#' @export
#' @importFrom tools texi2pdf
#' @seealso \code{\link{knit}}, \code{\link[tools]{texi2pdf}}
#' @examples ## compile with xelatex
#' ## knit2pdf(..., compiler = 'xelatex')
knit2pdf = function(input, output = NULL, compiler = NULL){
knit2pdf = function(input, output = NULL, compiler = NULL, ...){
out = knit(input, output)
owd = setwd(dirname(out)); on.exit(setwd(owd))
if (!is.null(compiler)) {
oc = Sys.getenv('PDFLATEX')
on.exit(Sys.setenv(PDFLATEX = oc), add = TRUE)
Sys.setenv(PDFLATEX = compiler)
}
texi2pdf(basename(out), clean = TRUE)
texi2pdf(basename(out), ...)
}

#' Run the code in a specified chunk
Expand Down

0 comments on commit 8e0a1d1

Please sign in to comment.