Author: lasgouttes
Date: Wed Jun 15 17:51:02 2011
New Revision: 39070
URL: http://www.lyx.org/trac/changeset/39070
Log:
Tentative fix for bug #7545. Please test.
The problem is with sweave when the temp file path contains spaces. This patch
adds some postprocessing that removes the reference to the temp dir.
Modified:
lyx-devel/trunk/lib/scripts/lyxsweave.R
Modified: lyx-devel/trunk/lib/scripts/lyxsweave.R
==============================================================================
--- lyx-devel/trunk/lib/scripts/lyxsweave.R Wed Jun 15 17:04:42 2011
(r39069)
+++ lyx-devel/trunk/lib/scripts/lyxsweave.R Wed Jun 15 17:51:02 2011
(r39070)
@@ -37,3 +37,12 @@
# finally run sweave
Sweave(file=ls.args[1], output=ls.args[2], syntax="SweaveSyntaxNoweb",
stylepath=ls.sp, prefix.string=ls.pr)
+
+# remove absolute path from \includegraphics
+ls.doc = readLines(ls.args[2])
+ls.cmd = paste('\\includegraphics{', dirname(ls.args[2]), "/", sep = "")
+ls.idx = grep(ls.cmd, ls.doc, fixed = TRUE)
+if (length(ls.idx)) {
+ ls.doc[ls.idx] = sub(ls.cmd, "\\includegraphics{", ls.doc[ls.idx], fixed =
TRUE)
+ writeLines(ls.doc, ls.args[2])
+}