]> git.lyx.org Git - features.git/commitdiff
Introduce helper script for Sweave. The first benefit is that
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 21 Oct 2010 17:02:05 +0000 (17:02 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 21 Oct 2010 17:02:05 +0000 (17:02 +0000)
Sweave.sty path is hardcoded if LaTeX cannot find it.

More to come.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@35750 a592a061-630c-0410-9148-cb99ea01b6c8

lib/configure.py
lib/scripts/lyxsweave.R [new file with mode: 0644]

index a4fbb9d88b304216bd56bd55a81fc578f4e503a0..1ea4c680f4d300f4703cf00f87b0ce0c180f0e37 100644 (file)
@@ -612,7 +612,7 @@ def checkConverterEntries():
         rc_entry = [r'''\converter literate   latex      "%%"  ""
 \converter literate   pdflatex      "%%"       ""'''])
     #
-    checkProg('a Sweave -> LaTeX converter', ['R CMD Sweave $$i'],
+    checkProg('a Sweave -> LaTeX converter', ['Rscript --vanilla $$s/scripts/lyxsweave.R $$i'],
         rc_entry = [r'''\converter sweave   latex      "%%"    ""
 \converter sweave   pdflatex      "%%" ""'''])
     #
diff --git a/lib/scripts/lyxsweave.R b/lib/scripts/lyxsweave.R
new file mode 100644 (file)
index 0000000..8ab0ea9
--- /dev/null
@@ -0,0 +1,10 @@
+# Wrapper around Sweave that sets up some things for LyX
+# argument 1 is the file name
+
+args <- commandArgs(trailingOnly=T)
+
+# check whether Sweave.sty is seen by LaTeX
+sweavesty <- system("kpsewhich Sweave.sty", intern=T, ignore.stderr=T)
+sp <- (length(sweavesty) == 0)
+
+Sweave(args[1], stylepath=sp)