[Rd] Windows problem related to using shortPathName for Sweave style file

Prof Brian Ripley ripley at stats.ox.ac.uk
Thu Apr 10 20:10:41 CEST 2008

I suggest that we try to program a solution in Sweave.  It only inserts 
the path to the file is stylepath=TRUE in RweaveLatexSetup, so it seems 
to be that


is all that is needed.  That seems to work, although of course obliges 
people to make sure Sweave.sty is in their latex input path (and using 
texi2dvi makes that rather hard).

Sweave is only used by R in three places, in 
tools:::.install_package_vignettes which is only used to build the grid 
vignettes, and tools::checkVignettes (used by R CMD check) and 
buildVignettes (used by R CMD build), and none of which pass any arguments 
to Sweave.

Here's a proposal.  Instead of making stylepath=TRUE the default, set its 
default from the environment variable _SWEAVE_STYLEPATH_DEFAULT_ . Then 
all Patrick needs to do is to set this to FALSE and ensure that his MiKTeX 
setup has Sweave.sty in a texmf tree.

That leaves the question of what the default should be if the environment 
variable is not set -- I suggest TRUE unless the path contains a space 
(since it doesn't currently work if it does and so is backwards 

That seems well below the limits of what is acceptable at this point for 
2.7.0, so if reaction is favourable we should go ahead.

Brian Ripley

On Thu, 10 Apr 2008, Patrick Aboyoun wrote:

> Thanks Duncan,
> I just did a survey of the BioConductor repository and only 4 of the 354
> .Rnw vignette files contain the \usepackage{Sweave} specification.
> Adding this is tedious, but not impossible. If the \usepackage{Sweave}
> specification does become recommended, could you add a WARNING to the R
> CMD build/check process if a vignette file lacks it? That would help
> steer developers in the right direction for cross-platform compatibility
> since most R package developers don't use Windows as their primary platform.
> Cheers,
> Patrick
> Duncan Murdoch wrote:
>> On 4/9/2008 9:50 PM, Patrick Aboyoun wrote:
>>> I forgot to mention the BioConductor Windows build machine is running
>>> Microsoft Windows Server 2003 R2
>>> Enterprise Edition, SP2
>>> I just checked and this same problem exists if I place R in the
>>> standard "C:\Program Files\R" location on this machine.
>> We're going to roll back that change, so you should be okay with your
>> original setup.  As far as I know there is no way to get MikTeX to
>> work if you have a space in your pathname, so putting R in the
>> standard location will fail, unless you follow the advice I give below.
>>> For now the backup plan is to move to using short path names for
>>> BioConductor builds (modifying 100+ vignettes is impractical as well
>>> as configuring MiKTeX to handle multiple installs of R that the build
>>> machine uses). If there is an alternate configuration that I should
>>> be using, just let me know.
>> I would recommend biting the bullet and adding \usepackage{Sweave} to
>> every vignette.  It's just a one line addition to them, and it will
>> mean that their .tex output will work if you move it to a different
>> machine, where the full path to Sweave.sty is different.
>> Duncan Murdoch
>>> Cheers,
>>> Patrick
>>> Duncan Murdoch wrote:
>>>> On 09/04/2008 5:23 PM, Patrick Aboyoun wrote:
>>>>> Something funky happened to my e-mail. I was trying to paste
>>>>> information related to MiKTeX and R into my message and it appears
>>>>> to have corrupted the text somehow. Anyway, the message I was
>>>>> trying to get across is that the tex file contains the path
>>>>> \usepackage{E:/paboyoun/BBS-2~1.2-B/R/share/texmf/Sweave}
>>>>> and MiKTeX 2.7 doesn't know how to resolve it. (The
>>>>> Bioconductor.tex file is (hopefully) attached to this e-mail.)
>>>> You should be able to get things to work by explicitly putting
>>>> \usepackage{Sweave}
>>>> somewhere early in your .Rnw file.  You may have trouble with MikTeX
>>>> finding Sweave.sty, depending how you invoke it:  if invoked from R
>>>> CMD it should work, but maybe not from your command line unless you
>>>> tell it where to look for include files.  How you do that changes
>>>> all the time; R tries a couple, which is why R CMD probably works.
>>>> Duncan Murdoch
>>>>> === BEGIN OS BLOCK ===
>>>>> E:\paboyoun>pdflatex --version
>>>>> MiKTeX-pdfTeX 2.7.2987 (1.40.7) (MiKTeX 2.7)
>>>>> Copyright (C) 1982 D. E. Knuth, (C) 1996-2006 Han The Thanh
>>>>> TeX is a trademark of the American Mathematical Society.
>>>>> E:\paboyoun>pdflatex Bioconductor.tex
>>>>> This is pdfTeX, Version 3.141592-1.40.7 (MiKTeX 2.7)
>>>>> entering extended mode
>>>>> (Bioconductor.tex
>>>>> LaTeX2e <2005/12/01>
>>>>> Babel <v3.8h> and hyphenation patterns for english, dumylang,
>>>>> nohyphenation, ge
>>>>> rman, ngerman, french, loaded.
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\article.cls"
>>>>> Document Class: article 2005/09/16 v1.4f Standard LaTeX document class
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\base\size12.clo"))
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\psnfss\times.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hyperref.sty"
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\graphics\keyval.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\hycolor.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\pd1enc.def")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\etexcmds.sty"
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\infwarerr.sty"))
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\00miktex\hyperref.cfg")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\oberdiek\kvoptions.sty")
>>>>> Implicit mode ON; LaTeX internals redefined
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\ltxmisc\url.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bitset.sty"
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\intcalc.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\bigintcalc.sty"
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\pdftexcmds.sty")))
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\kvsetkeys.sty")
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\atbegshi.sty"
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\generic\oberdiek\ifpdf.sty")))
>>>>> *hyperref using default driver hpdftex*
>>>>> ("C:\Program Files\MiKTeX 2.7\tex\latex\hyperref\hpdftex.def")
>>>>> ! Missing \endcsname inserted.
>>>>> <to be read again>
>>>>>                    \protect
>>>>> l.28 \begin
>>>>>            {document}
>>>>> ?
>>>>> ------------------------------------------------------------------------
>>>>> ______________________________________________
>>>>> R-devel at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

More information about the R-devel mailing list