]> git.lyx.org Git - lyx.git/blob - lib/scripts/lyxsweave.R
* RELEASE-NOTES
[lyx.git] / lib / scripts / lyxsweave.R
1 # Wrapper around Sweave that sets up some things for LyX
2 # argument 1 is the file name
3 # argument 2 is the iconv name for the encoding of the file
4 # argument 3 is the document directory
5
6 ls.args <- commandArgs(trailingOnly=T)
7
8 # check whether Sweave.sty is seen by LaTeX
9 ls.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
10 ls.sp <- (length(ls.sweavesty) == 0)
11
12 # set default encoding to the one of the file; it will be reset to previous
13 # default by the sweave module
14 ls.enc=getOption("encoding")
15 options(encoding=ls.args[2])
16
17 # pass document dir to sweave module
18 ls.dir <- ls.args[3]
19
20 #run sweave
21 Sweave(ls.args[1], stylepath=ls.sp)