mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-25 05:55:34 +00:00
* add an extra parameter to lyxsweave.py that tells the document directory
and use it to be able to read data files in there (bug #6623). It is probably possible to use sweave hooks instead of the module preamble. Moreover, I want to investigate the use of prefix.string argument of sweave to make sure that the output files end up in the tmp dir. * be more subtle in the way to change default encoding to handle the case where a data file that is read does not use the same encoding as the .rnw file. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36850 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8c6ce63595
commit
425f46bea5
@ -17,6 +17,13 @@ ClassOptions
|
|||||||
Other "noae"
|
Other "noae"
|
||||||
End
|
End
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
<<echo=F>>=
|
||||||
|
if(exists("ls.dir")) setwd(ls.dir)
|
||||||
|
if(exists("ls.enc")) options(encoding=ls.enc)
|
||||||
|
@
|
||||||
|
EndPreamble
|
||||||
|
|
||||||
Style Chunk
|
Style Chunk
|
||||||
Category Sweave
|
Category Sweave
|
||||||
LatexType Paragraph
|
LatexType Paragraph
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Wrapper around Sweave that sets up some things for LyX
|
# Wrapper around Sweave that sets up some things for LyX
|
||||||
# argument 1 is the file name
|
# argument 1 is the file name
|
||||||
# argument 2 is the iconv name for the encoding of the file
|
# argument 2 is the iconv name for the encoding of the file
|
||||||
|
# argument 3 is the document directory
|
||||||
|
|
||||||
ls.args <- commandArgs(trailingOnly=T)
|
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.sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
|
||||||
ls.sp <- (length(ls.sweavesty) == 0)
|
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])
|
options(encoding=ls.args[2])
|
||||||
|
|
||||||
|
# pass document dir to sweave module
|
||||||
|
ls.dir <- ls.args[3]
|
||||||
|
|
||||||
#run sweave
|
#run sweave
|
||||||
Sweave(ls.args[1], stylepath=ls.sp)
|
Sweave(ls.args[1], stylepath=ls.sp)
|
||||||
|
Loading…
Reference in New Issue
Block a user