2010-10-21 17:02:05 +00:00
|
|
|
# Wrapper around Sweave that sets up some things for LyX
|
|
|
|
# argument 1 is the file name
|
2010-10-22 07:51:39 +00:00
|
|
|
# argument 2 is the iconv name for the encoding of the file
|
2010-12-12 21:25:57 +00:00
|
|
|
# argument 3 is the document directory
|
2010-10-21 17:02:05 +00:00
|
|
|
|
2010-10-22 07:51:39 +00:00
|
|
|
ls.args <- commandArgs(trailingOnly=T)
|
2010-10-21 17:02:05 +00:00
|
|
|
|
|
|
|
# check whether Sweave.sty is seen by LaTeX
|
2010-10-22 07:51:39 +00:00
|
|
|
ls.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
|
|
|
|
ls.sp <- (length(ls.sweavesty) == 0)
|
2010-10-21 17:02:05 +00:00
|
|
|
|
2010-12-12 21:25:57 +00:00
|
|
|
# set default encoding to the one of the file; it will be reset to previous
|
|
|
|
# default by the sweave module
|
|
|
|
ls.enc=getOption("encoding")
|
2010-10-22 07:51:39 +00:00
|
|
|
options(encoding=ls.args[2])
|
|
|
|
|
2010-12-12 21:25:57 +00:00
|
|
|
# pass document dir to sweave module
|
|
|
|
ls.dir <- ls.args[3]
|
|
|
|
|
2010-10-22 07:51:39 +00:00
|
|
|
#run sweave
|
|
|
|
Sweave(ls.args[1], stylepath=ls.sp)
|