]> git.lyx.org Git - features.git/blobdiff - lib/scripts/lyxsweave.R
* add an extra parameter to lyxsweave.py that tells the document directory
[features.git] / lib / scripts / lyxsweave.R
index a8ab1849842204492793b5c16a79478aa3f6ac56..1723cd716606593d85cf35442b99cfaffd7e274e 100644 (file)
@@ -1,6 +1,7 @@
 # Wrapper around Sweave that sets up some things for LyX
 # argument 1 is the file name
 # argument 2 is the iconv name for the encoding of the file
+# argument 3 is the document directory
 
 ls.args <- commandArgs(trailingOnly=T)
 
@@ -8,8 +9,13 @@ ls.args <- commandArgs(trailingOnly=T)
 ls.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
 ls.sp <- (length(ls.sweavesty) == 0)
 
-# set default encoding to the one of the file
+# set default encoding to the one of the file; it will be reset to previous
+# default by the sweave module
+ls.enc=getOption("encoding")
 options(encoding=ls.args[2])
 
+# pass document dir to sweave module
+ls.dir <- ls.args[3]
+
 #run sweave
 Sweave(ls.args[1], stylepath=ls.sp)