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
6 ls.args <- commandArgs(trailingOnly=T)
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)
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])
17 # pass document dir to sweave module
21 Sweave(ls.args[1], stylepath=ls.sp)