Skip to content
Prev 38730 / 63424 Next

Error in generating sweave-tex -> pdf file

Hi Carol

As you now know, this is because per default R/Sweave puts the line
  \usepackage{Sweave}
in the generated tex file.  This means the tex file is "portable", but
it also implies that Sweave.sty needs to be "installed" in your tex
installation.  Or you can put the Sweave.sty in the directory of the
Rnw file since tex usually is set up to search the same directory.

An alternative is to get R to generate a line like
  \usepackage{FULL_PATH_TO_SWEAVE.STY}
in the tex document.  This implies that the tex file can only be
tex'ed on a setup where the Sweave.sty is at the same place - hence it
kind of break portability.  Now portability of the tex file does not
matter to many users - most of us think of the tex file as an
intermediate file and only care about the Rnw file and the final PDF.
You get this behaviour by setting the environment variable
  SWEAVE_STYLEPATH_DEFAULT
to
  TRUE
An easy way to do this is to include the following line in your .Rprofile
 Sys.setenv("SWEAVE_STYLEPATH_DEFAULT" = "TRUE")

This trick also fixes running Sweave on a system where you do not have
admin rights.

Kasper
On Thu, Dec 23, 2010 at 5:14 AM, carol white <wht_crl at yahoo.com> wrote: