mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fix #8019 (from yihui)
* avoid creation of file Rplots.pdf in document file * find correctly Sweave.sty on old R versions git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40703 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fa44bf7961
commit
d6246362e6
@ -23,8 +23,12 @@
|
|||||||
# The advantage compared to the use of stylepath, is that the exported
|
# The advantage compared to the use of stylepath, is that the exported
|
||||||
# .tex file will be portable to another machine. (JMarc)
|
# .tex file will be portable to another machine. (JMarc)
|
||||||
if (!length(system("kpsewhich Sweave.sty", intern=TRUE, ignore.stderr=TRUE))) {
|
if (!length(system("kpsewhich Sweave.sty", intern=TRUE, ignore.stderr=TRUE))) {
|
||||||
file.copy(file.path(R.home("share"), "texmf", "tex", "latex", "Sweave.sty"),
|
.texmf.path <- file.path(R.home("share"), "texmf")
|
||||||
dirname(.cmdargs[2]), overwrite=TRUE)
|
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="/")
|
.prefix.str <- paste(dirname(.cmdargs[2]), tmpout, sep="/")
|
||||||
rm(tmpout)
|
rm(tmpout)
|
||||||
|
|
||||||
|
# avoid the default Rplots.pdf
|
||||||
|
options(device = function(...) {
|
||||||
|
pdf(file = tempfile())
|
||||||
|
})
|
||||||
|
|
||||||
# finally run sweave
|
# finally run sweave
|
||||||
|
|
||||||
# The Sweave version provided with R >= 0.13.1 has proper handling for
|
# The Sweave version provided with R >= 0.13.1 has proper handling for
|
||||||
|
Loading…
Reference in New Issue
Block a user