]> git.lyx.org Git - lyx.git/blob - lib/scripts/lyxsweave.R
Make sweave process files with the correct encoding (#6625).
[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
5 ls.args <- commandArgs(trailingOnly=T)
6
7 # check whether Sweave.sty is seen by LaTeX
8 ls.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
9 ls.sp <- (length(ls.sweavesty) == 0)
10
11 # set default encoding to the one of the file
12 options(encoding=ls.args[2])
13
14 #run sweave
15 Sweave(ls.args[1], stylepath=ls.sp)