Skip to content

Sweave.sty problems under WinXP (English locale) with default settings

2 messages · Peter Ruckdeschel, Duncan Murdoch

#
Hi R-devels,

I encounter the following problem when I want to build a vignette
in the package building process under Windows

platform       i386-pc-mingw32            
arch           i386                       
os             mingw32                    
system         i386, mingw32              
status                                    
major          2                          
minor          7.0                        
year           2008                       
month          04                         
day            22                         
svn rev        45424                      
language       R                          
version.string R version 2.7.0 (2008-04-22)

TeX-Distribution: MikTeX 2.7

My R home directory is the default one:

         C:\Program Files\R\R-2.7.0,

so R.home() from package tools makes out of it
 
        "C:\\PROGRA~1\\R\\R-27~1.0"

which does not contain spaces, but instead the special
character   ~  .

So function texi2dvi() from package tools makes texi2dvi
include the directive

   \usepackage{C:\PROGRA~1\R\R-27~1.0\share\texmf\Sweave}

into the corresponding .tex file for the vignette, and, consequently,
MikTeX throws an error (due to the ~'s).

According to

   http://developer.r-project.org/blosxom.cgi/R-devel

this is due to a change on  Apr 15.

If I am right, the use of short filenames (without spaces)
as to be found in %R_HOME% for
MikTeX (and tetex) would no longer have been necessary:

http://wiki.lyx.org/LaTeX/FilesWithSpecialChars

So an easy way out would be to revert the changes made in
R-2.7.0 and instead use a quoted version of  the full path
constructed by normalizePath().

In the mean time, of course one might simply  alert  people
to have Sweave.sty on their tex filename database / search path
and to include \usepackage{Sweave} in their .Rnw files.

Best,
Peter
#
On 5/16/2008 9:22 AM, Peter Ruckdeschel wrote:
The simplest workaround for this is to put \usepackage{Sweave} into your 
Rnw source, so that R doesn't try to add it.
See also the change on Apr 23 (to R-patched, not released yet), which 
may give another workaround.
That page also says that ~ causes no problems, but it's talking about 
MikTeX 2.4, not 2.7.
That shouldn't be necessary, and may not be a good idea in the long run, 
because it means that next year if you forget to update it, you'll still 
be using the R 2.7.0 version of that file.

Duncan Murdoch