[ESS] ess-swv-PDF hack(?)

Berwin A Turlach berwin at maths.uwa.edu.au
Sun Nov 16 07:52:57 CET 2008


On Sat, 15 Nov 2008 17:09:43 -0800
Kasper Daniel Hansen <khansen at stat.berkeley.edu> wrote:

> This is due to a recent change in Sweave (a rather irritating change  
> in my opinion).
> 
> You can solve it in 2 ways
> 1) add Sweave.sty to your latex path. I am not too happy with this  
> because I am sure that I will forget to do it after next release of
> R and I might miss out on updates.
> 2) Follow the advice in the NEWS file about setting  
> SWEAVE_STYLEPATH_DEFAULT. I do it in the following way: I add a line  
> to ~/.Rprofile
> Sys.setenv("SWEAVE_STYLEPATH_DEFAULT" = "TRUE")
> This will get the old behaviour back.

IIRC, I initially created in my ~/bin folder a script Sweave.sh which
is called for the Sweave process.  If you have a similar set-up, then a
third option is to change Sweave.sh from

++++++++++++++
/bin/sh
echo "library(utils); Sweave(\"$1\")" | R --no-save --no-restore
++++++++++++++

to

+++++++++++
#!/bin/sh
echo "library(utils); Sweave(\"$1\", stylepath=TRUE)" | R --no-save --no-restore
+++++++++++

By setting stylepath=TRUE in the call to Sweave, the complete
hard-coded path to sweave.sty is put into the .tex file, which makes
the .tex file somewhat less portable.

Charles: if your problem started to arise with 2.8.0, then the reason
is this entry in the NEWS file:
    o	The default for 'stylepath' in Sweave's (default)
RweaveLatex driver is now FALSE rather than TRUE if
	SWEAVE_STYLEPATH_DEFAULT is unset : see ?RweaveLatex.
	To support this, tools::texi2dvi adds the R 'texmf' directory
	to the input search path.

Kasper: I agree that this is annoying.  If I have a .tex file with a
hard-coded path to an sweave.sty file that no longer exists (since a
new version of R was installed and the old removed), then I get an
error message if I try to process again and the problem is easily
fixed.  Remembering to always copy the newest version of sweave.sty
into the latex path or changing SWEAVE_STYLEPATH_DEFAULT with each
upgrade of R is very easily forgotten and could, in my opinion, lead to
much more obscure errors that are then harder to diagnose.

Cheers,
	
	Berwin

=========================== Full address =============================
Berwin A Turlach                            Tel.: +65 6515 4416 (secr)
Dept of Statistics and Applied Probability        +65 6515 6650 (self)
Faculty of Science                          FAX : +65 6872 3919       
National University of Singapore
6 Science Drive 2, Blk S16, Level 7          e-mail: statba at nus.edu.sg
Singapore 117546                    http://www.stat.nus.edu.sg/~statba




More information about the ESS-help mailing list