I'm not sure if that is a "bug" -- the problem occurs when the path to
Sweave.sty contains spaces, and the Sweave authors have no way to
prevent users from installing R to a directory that contains spaces
(think that software packages under Windows are often installed to
"C:\Program Files\").

Or do you mean LaTeX can deal with spaces in paths under Windows? like
\usepackage{C:\Program
Files\R\R-2.13.0\share\texmf\tex\latex\Sweave.sty}

Your last point is also my concern. We will have problems when
exporting the tex document (Sweave.sty will not go with it).

Regards,
Yihui
--
Yihui Xie <xieyi...@gmail.com>
Phone: 515-294-2465 Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA



On Wed, May 11, 2011 at 3:45 PM, Jean-Marc Lasgouttes
<lasgout...@lyx.org> wrote:
> Le 11/05/2011 06:55, Yihui Xie a écrit :
>>
>> Recently I've been working on the sweave module in LyX and discussing
>> with Jean-Marc and Gregor, and I was suggested to send emails to this
>> mailing list to get more people involved in the discussion.
>
> Thanks for doing that.
>
>> 1. tell the user that they can add this package in the texmf tree,
>> which is actually extremely easy with MikTeX under Windows; it is not
>> hard for other operating systems either.
>>
>> 2. if the user does not want to do anything for this Sweave package,
>> we can of course call
>>
>> Sweave(..., stylepath = TRUE)
>
>>
>> to ask Sweave to insert the hard-coded path of Sweave.sty in the LaTeX
>> output, which is not an ideal solution, since it is known that the
>> path to Sweave.sty often contains spaces under Windows and LaTeX will
>> fail.
>
> Currently we use stylepath automatically. What about having Sweave authors
> fix their code if it does not work in windows? It is not that had to do.
>
> Once they have done that, we can of course have our own workaround for old
> Sweave versions, but each code owner should be responsible for his bugs IMO.
>
>> ## copy Sweave.sty and friends to $$p if kpsewhich cannot find it
>> if (length(system("kpsewhich Sweave.sty", intern = TRUE, ignore.stderr
>> = TRUE)) == 0) {
>>     file.copy(list.files(file.path(R.home('share'), 'texmf', 'tex',
>> 'latex'),
>>                          full.names = TRUE), .cmdargs[1])
>> }
>>
>> here .cmdargs is a character vector to receive options from Rscript
>> (it begins with a dot so that the user will not see it by default,
>> e.g. ls() will not show it).
>
> This is not a bad solution in the tmp directory, but Iwonder about plain
> exports.
>
> JMarc
>

Reply via email to