Skip to content

Problem Sweaving vignettes: MiKTeX's texi2dvi reports errors

8 messages · Peter G. Warren, Brian Ripley, Friedrich Leisch +1 more

#
I get
This is pdfeTeX, Version 3.141592-1.20a-rc7.2-2.2 (MiKTeX 2.4)
output format initialized to PDF
entering extended mode
(Sweave-test-1.tex
LaTeX2e <2003/12/01>
Babel <v3.8a> and hyphenation patterns for english, french, german, 
ngerman, dumylang, nohyphenation, loaded.
(C:\packages\MikTeX\tex\latex\base\article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(C:\packages\MikTeX\tex\latex\base\size10.clo))
(C:\packages\MikTeX\tex\latex\ltxmisc\a4wide.sty
(C:\packages\MikTeX\tex\latex\ntgclass\a4.sty))
(d:/R/svn/trunk/share/texmf/Sweave.sty

LaTeX Warning: You have requested package 
`d:/R/svn/trunk/share/texmf/Sweave',
                but the package provides `Sweave'.

so my guess is that this a path problem with your MiKTeX and it is not 
finding Sweave.sty.

Simple questions: where did you install R?  Is there a space in the path?
On Sun, 2 Oct 2005, Peter G. Warren wrote:

            

  
    
#
Hi, Prof. Ripley,

Yes, indeed, that was my problem - thank you! I made the mistake of
installing in the default path of C:\Program Files\R. I just now reinstalled
in C:\R, and everything worked fine. However, if anyone else runs into this,
you cannot just go off and run texi2dvi on an existing .tex file after
installing in a non-space path: you should rerun the whole Sweave example,
which forces a number of additional required items to be downloaded. Let
that process complete, then rerun again. It works fine! The finished pdf
file sure looks sweet.

Thank you again!

Regards,
= Peter

-----Original Message-----
From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] 
Sent: Sunday, October 02, 2005 3:01 PM
To: Peter G. Warren
Cc: r-devel at r-project.org
Subject: Re: [Rd] Problem Sweaving vignettes: MiKTeX's texi2dvi reports
errors

I get
This is pdfeTeX, Version 3.141592-1.20a-rc7.2-2.2 (MiKTeX 2.4) output format
initialized to PDF entering extended mode (Sweave-test-1.tex LaTeX2e
<2003/12/01> Babel <v3.8a> and hyphenation patterns for english, french,
german, ngerman, dumylang, nohyphenation, loaded.
(C:\packages\MikTeX\tex\latex\base\article.cls
Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
(C:\packages\MikTeX\tex\latex\base\size10.clo))
(C:\packages\MikTeX\tex\latex\ltxmisc\a4wide.sty
(C:\packages\MikTeX\tex\latex\ntgclass\a4.sty))
(d:/R/svn/trunk/share/texmf/Sweave.sty

LaTeX Warning: You have requested package
`d:/R/svn/trunk/share/texmf/Sweave',
                but the package provides `Sweave'.

so my guess is that this a path problem with your MiKTeX and it is not
finding Sweave.sty.

Simple questions: where did you install R?  Is there a space in the path?
On Sun, 2 Oct 2005, Peter G. Warren wrote:

            
it needed, so now it at least executes.

  
    
#
On Mon, 3 Oct 2005, Peter G. Warren wrote:

            
Indeed as the path is hardcoded in the .tex file generated by Sweave.  In 
my case

% -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
\documentclass[a4paper]{article}

\title{A Test File}
\author{Friedrich Leisch}


\usepackage{a4wide}

\usepackage{d:/R/svn/trunk/share/texmf/Sweave}
Good.  We should try to fix this at R level if we can.  To Fritz Leisch: I 
presume this is coming from RweaveLatexSetup's

     if(stylepath){
         styfile <- file.path(R.home("share"), "texmf", "Sweave")
         if(.Platform$OS.type == "windows")
             styfile <- gsub("\\\\", "/", styfile)
         if(any(grep(" ", styfile)))
             warning(gettextf("path to '%s' contains spaces,\n", styfile),
                     gettext("this may cause problems when running LaTeX"),
                     domain = NA)
     }
     else
         styfile <- "Sweave"

So, there should have been a warning that seems not to have been seen. 
However, if we added the opposite of normalizePath() to form the short 
path, would that fix this?

  
    
#
I have R installed in c:\Program Files\R and I use MiKTeX and texi2dvi
to process my vignettes.  I do keep my package sources elsewhere;
e.g. I would keep the source for mypkg in c:\Rpkgs\mypkg .
and I would install it into c:\Rpkg\library or once I am ready to use it
in production into e.g. c:\Program Files\R\rw2011pat\library
thus I don't think its necessary to relocate R itself.
On 10/3/05, Peter G. Warren <peter.warren at verizon.net> wrote:
#
> I have R installed in c:\Program Files\R and I use MiKTeX and texi2dvi
  > to process my vignettes.  I do keep my package sources elsewhere;
  > e.g. I would keep the source for mypkg in c:\Rpkgs\mypkg .
  > and I would install it into c:\Rpkg\library or once I am ready to use it
  > in production into e.g. c:\Program Files\R\rw2011pat\library
  > thus I don't think its necessary to relocate R itself.

The problem is the path to the *style file* sitting in
$RHOME/share/texmf, so having the packages in a different place has
nothing to do with it. It is also not really necessary to relocate R
itself, you just have to move the style file to some place where latex
finds it (e.g., by including $RHOME/share/texmf in your TEXINPUTS path
... but that will make troubles when the path contains spaces and we
are back at the beginning).

.f
#

        
> On Mon, 3 Oct 2005, Peter G. Warren wrote:
>> Hi, Prof. Ripley,
  >> 
  >> Yes, indeed, that was my problem - thank you! I made the mistake of
  >> installing in the default path of C:\Program Files\R. I just now reinstalled
  >> in C:\R, and everything worked fine. However, if anyone else runs into this,
  >> you cannot just go off and run texi2dvi on an existing .tex file after
  >> installing in a non-space path: you should rerun the whole Sweave example,
  >> which forces a number of additional required items to be downloaded.

  > Indeed as the path is hardcoded in the .tex file generated by Sweave.  In 
  > my case

  > % -*- mode: noweb; noweb-default-code-mode: R-mode; -*-
  > \documentclass[a4paper]{article}

  > \title{A Test File}
  > \author{Friedrich Leisch}


  > \usepackage{a4wide}

  > \usepackage{d:/R/svn/trunk/share/texmf/Sweave}

  >> Let that process complete, then rerun again. It works fine! The finished 
  >> pdf file sure looks sweet.

  > Good.  We should try to fix this at R level if we can.  To Fritz Leisch: I 
  > presume this is coming from RweaveLatexSetup's

  >      if(stylepath){
  >          styfile <- file.path(R.home("share"), "texmf", "Sweave")
  >          if(.Platform$OS.type == "windows")
  >              styfile <- gsub("\\\\", "/", styfile)
  >          if(any(grep(" ", styfile)))
  >              warning(gettextf("path to '%s' contains spaces,\n", styfile),
  >                      gettext("this may cause problems when running LaTeX"),
  >                      domain = NA)
  >      }
  >      else
  >          styfile <- "Sweave"


Yes.


  > So, there should have been a warning that seems not to have been seen. 
  > However, if we added the opposite of normalizePath() to form the short 
  > path, would that fix this?

Actually, thinking about it again makes me wonder if the best solution
isn't to simply copy the few lines I need to the .tex file if no
\usepackage[...]{Sweave} is found.

Too late for 2.2.0 but I would consider the problem a bug, so could
try to fix it for 2.2.1.

Best,
Fritz
#
There is a batch file in batchfiles at
http://cran.r-project.org/contrib/extra/batchfiles/
that copies the .sty files to miktex's directory.  This is also discussed on
Duncan's rtools MiKTeX site.  My understanding is that this will not be
necessary from R 2.2.0 onwards but was needed previously.
On 10/3/05, Friedrich.Leisch at tuwien.ac.at <Friedrich.Leisch at tuwien.ac.at> wrote: