[TxMt] Re: Sweave bundle feature request

T. Zakharko zakharko at uni-leipzig.de
Wed Jan 5 08:51:21 UTC 2011



T. Zakharko wrote:
> 
> Dear all,
> 
>  I post this here because I am unsure of who is the current maintainer of
> the Sweave bundle. The help files list Alan Schussman as author, but as
> the bundle has last been updated in 2006 I have no idea if he is still
> responsible for it. 
> 
>  To make the story short: it is sometimes desirable to run Sweave with a
> custom driver. I need it for literate programming documentation style
> where I want Sweave to skip the code parsing to allow for chunks
> containing incomplete R expressions (and I also developed a very simple
> driver that does just that). A probably more common usage would be
> invoking the pgfSweave driver instead of the vanilla one. 
> 
> An option like
> 
> %!TEX SWeave= my_driver
> 
> would be very nice. I can hack something like this together on my own, but
> this is a feature which should probably be added to the official
> distribution. 
> 
> Thank you,
> 
>  -- Taras
> 

P.S. I have patched the Sweave bundle's 'Sweave,Typeset and View' command
with following:

# get the Sweave driver option
DRIVER=`grep -e '^%!TEX Sweave' "$TM_FILEPATH" | sed 's/.*=//g'`

SW=${TM_SWEAVE_WD:=${TM_DIRECTORY}}
if [ -n "$DRIVER" ]; then
	echo -e "setwd('$SW')\nSweave('$TM_FILEPATH', driver=$DRIVER)" | R
--no-restore --no-save --quiet | pre
else
	echo -e "setwd('$SW')\nSweave('$TM_FILEPATH')" | R --no-restore --no-save
--quiet | pre
fi

This replaces the previous R invocation and works reasonably well. Usage is:

%!TEX Sweave= my_driver

Maybe someone could patch it to the official repo...
-- 
View this message in context: http://old.nabble.com/Sweave-bundle-feature-request-tp30588762p30594043.html
Sent from the textmate users mailing list archive at Nabble.com.



More information about the textmate mailing list