1 # Wrapper around Sweave that sets up some things for LyX
2 # argument 1 is the absolute name of the input file
3 # argument 2 is the absolute name of the output file
4 # argument 3 is the iconv name for the encoding of the file
5 # argument 4 is the original document directory
7 ls.args <- commandArgs(trailingOnly=T)
9 # check whether Sweave.sty is seen by LaTeX
10 ls.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
11 ls.sp <- (length(ls.sweavesty) == 0)
13 # set default encoding to the one of the file; it will be reset to previous
14 # default by the sweave module
15 ls.enc <- getOption("encoding")
16 options(encoding=ls.args[3])
18 # pass document dir to sweave module
21 # this is used to tell where temporary files should go
22 ls.pr <- sub("\\.tex$", "", ls.args[2])
26 Sweave(file=ls.args[1], output=ls.args[2], syntax="SweaveSyntaxNoweb", stylepath=ls.sp, prefix.string=ls.pr)