From ripley at stats.ox.ac.uk  Mon Oct  3 17:30:24 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 3 Oct 2005 16:30:24 +0100 (BST)
Subject: [Rd] Problem Sweaving vignettes: MiKTeX's texi2dvi reports
	errors
In-Reply-To: <0INS00H0BI982YZ1@vms040.mailsrvcs.net>
References: <0INS00H0BI982YZ1@vms040.mailsrvcs.net>
Message-ID: <Pine.LNX.4.61.0510031616370.5366@gannet.stats>

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"

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?


>
> 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
>
>> texi2dvi("Sweave-test-1.tex", pdf=TRUE, quiet=FALSE)
> 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,
>>
>> I am trying to create a Bioconductor package. Everything installs and
>> checks fine. Now I'm on my last step, which is to create a vignette.
>> I'm trying to test the Sweave process, to make sure I can build a
>> vignette. I am stuck at the texi2dvi stage, which fails when I try to
>> process the example Sweave-test-1.tex file.
>>
>> I am using Windows binary R distributions, and have the same problem
>> on both the latest developer version (2.2.0 Beta) and the latest
>> patched version
>> (2.1.1) . For the Tex processing, I first tried downloading and
>> installing fpTex, but found that it doesn't have texi2dvi. Some
>> Googling informed me that recent MiKTeX versions now have that
>> function, so I just downloaded that (the small installation). Indeed
>> there is a texi2dvi. The first time I ran it, it downloaded a class file
> it needed, so now it at least executes.
>> However, when I try to run it on the test Sweave tex file, I get an error.
>> Here's the sequence in R:
>>
>>> library(tools)
>>> example(Sweave)
>> [...output suppressed]
>>> texi2dvi("Sweave-test-1.tex", pdf=TRUE, quiet=FALSE)
>> Error in texi2dvi("Sweave-test-1.tex", pdf=TRUE, quiet = FALSE) :
>>        running texi2dvi on 'Sweave-test-1.tex' failed
>>
>> [A command window pops up, and the following is from that window: ]
>>
>> 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, du mylang, nohyphenation, loaded.
>> (C:\MiKTex\texmf\tex\latex\base\article.cls
>> Document Class: article 2004/02/16 v1.4f Standard LaTeX document class
>> (C:\MiKTex\texmf\tex\latex\base\size10.clo))
>> (C:\MiKTex\texmf\tex\latex\ltxmisc\a4wide.sty
>> (C:\MiKTex\texmf\tex\latex\ntgclass\a4.sty))
>> ! Missing \endcsname inserted.
>> <to be read again>
>>                   \protect
>> l.11 \begin
>>           {document}
>> ?
>>
>> [ Here, I hit a <CR>, and get the following:]
>>
>> ! LaTeX Error: Missing \begin{document}.
>>
>> See the LaTeX manual or LaTeX Companion for explanation.
>> Type  H <return>  for immedi ate help.
>> ...
>>
>> l.11 \begin
>>           {document}
>> ?
>>
>> -----------------
>> I have also tried running texi2dvi directly on the command line, and
>> get the same result. I've looked at the manual on the MiKTeX site, but
>> find nothing that tells me what may be wrong. The Sweave test file
>> looks fine to me. I have also tried running texify --pdf on the same
>> file on the command line, but get the same results exactly.
>>
>> I also went to the R-tools site, and went through their page on MiKTeX
>> issues. Using their second suggestion (since I'm using the recent
>> MiKTeX version, which defaults to e-TeX mode), I tried changing the
>> mode for texinfo from e-TeX Extended to e-TeX Compatibility mode: no
>> change in results. (I'm assuming that texi2dvi is part of texinfo
>> package - please correct me if I'm wrong.) [I also tried changing
>> texinfo from e-TeX to TeX mode, and rebuilt/reloade/refreshed, but
>> this did not seem to take: texi2dvi still reports that it's in e-TeX
>> mode.]
>>
>> Finally, I did try posting this to the bioc-devel list, and got some
>> good suggestions (which I've tried, results above). They then
>> suggested I move the question over here.
>>
>> Regards, and thanks,
>> - Peter Warren
>>
>>
>>
>>
>>
>> 	[[alternative HTML version deleted]]
>>
>> ______________________________________________
>> 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
>
>
>

-- 
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



[Rd] Problem Sweaving vignettes: MiKTeX's texi2dvi reports errors
Prof Brian Ripley