X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fscripts%2Flyxsweave.R;h=7573d315c1fd5d7b668edd23236757355ef6ae7a;hb=a8853743c5676a142a62f8a790a7c1c66aa89b09;hp=fd41a4422ed82df146428b0f46112f51ac0b183f;hpb=4f176ef89b7302068821a5055b1ad93bb6795707;p=lyx.git diff --git a/lib/scripts/lyxsweave.R b/lib/scripts/lyxsweave.R index fd41a4422e..7573d315c1 100644 --- a/lib/scripts/lyxsweave.R +++ b/lib/scripts/lyxsweave.R @@ -23,8 +23,12 @@ # The advantage compared to the use of stylepath, is that the exported # .tex file will be portable to another machine. (JMarc) if (!length(system("kpsewhich Sweave.sty", intern=TRUE, ignore.stderr=TRUE))) { - file.copy(file.path(R.home("share"), "texmf", "tex", "latex", "Sweave.sty"), - dirname(.cmdargs[2]), overwrite=TRUE) + .texmf.path <- file.path(R.home("share"), "texmf") + if (!file.exists(.sweave.sty <- file.path(.texmf.path, "Sweave.sty"))) { + .sweave.sty <- file.path(.texmf.path, "tex", "latex", "Sweave.sty") + } + file.copy(.sweave.sty, dirname(.cmdargs[2]), overwrite=TRUE) + rm(list = c('.sweave.sty', '.texmf.path')) } @@ -39,6 +43,11 @@ tmpout <- gsub(".", "-", sub("\\.tex$", "", basename(.cmdargs[2])), fixed = TRUE .prefix.str <- paste(dirname(.cmdargs[2]), tmpout, sep="/") rm(tmpout) +# avoid the default Rplots.pdf +options(device = function(...) { + pdf(file = tempfile()) +}) + # finally run sweave # The Sweave version provided with R >= 0.13.1 has proper handling for