[R] Adding an Sweave Vignette to a package

Uwe Ligges ligges at statistik.tu-dortmund.de
Tue Jan 22 10:14:59 CET 2008


In R, type
  Sys.getenv("PATH")
and you will probably find that the PATH does not include the path of 
the pdflatex executable of the mikTeX distribution.

Uwe


Doran, Harold wrote:
> Jim 
> 
> First thanks for your patience. I use MikTex as well. I do have both
> (texti2dvi and pdflatex) on my local machine. I copied and pasted the
> code below and stepped through it. I think this break down with the
> following error. Indeed, I think there is a path problem. 
> 
> However, I don't see a resolution in either Writing R Extensions or the
> Leisch paper. So, I'm not quite sure what path to modify and/or how.
> 
> Error in texi2dvi("TheVignette.tex", pdf = TRUE) : 
>   unable to run pdflatex on 'TheVignette.tex'
> In addition: Warning message:
> In system(paste(shQuote(latex), "-interaction=nonstopmode", texfile)) :
>   "pdflatex" not found 
> 
>> -----Original Message-----
>> From: James W. MacDonald [mailto:jmacdon at med.umich.edu] 
>> Sent: Monday, January 21, 2008 4:53 PM
>> To: Doran, Harold
>> Cc: R Help
>> Subject: Re: [R] Adding an Sweave Vignette to a package
>>
>> What TeX variant are you using? If texi2dvi() can't find 
>> texi2dvi, it tries to fall back on pdflatex which has to be 
>> in the path.
>>
>> I have always had good luck with MikTeX, which does have texi2dvi.
>>
>> You could always try
>>
>> library(tools)
>> Sweave("TheVignette.Rnw")
>> debug(texi2dvi)
>> texi2dvi("TheVignette.tex", pdf=TRUE)
>>
>> and step through to see where it fails, although on the 
>> surface it looks like a path problem.
>>
>> Best,
>>
>> Jim
>>
>>
>>
>> Doran, Harold wrote:
>>> There is now and it looks like I got through the first 
>> phase. But, now 
>>> I get the error below.
>>>
>>> * DONE (MiscPsycho)
>>> * creating vignettes ... ERROR
>>> Loading required package: statmod
>>> Below is what alpha *would be* if the item were removed
>>>
>>> Error in texi2dvi(file = bft, pdf = TRUE, clean = FALSE, quiet = 
>>> quiet)
>>> :
>>>   unable to run pdflatex on 'MP.tex'
>>> Calls: buildVignettes -> texi2dvi
>>> In addition: Warning messages:
>>> 1: In readLines(f[1]) : incomplete final line found on 'MP.Rnw'
>>> 2: In system(paste(shQuote(latex), "-interaction=nonstopmode", 
>>> texfile))
>>> :
>>>   "pdflatex" not found
>>> Execution halted
>>>
>>> I do have pdflatex, it's what I use all of the time. 
>> However, how do I 
>>> point to it for this build process?
>>>
>>>> -----Original Message-----
>>>> From: James W. MacDonald [mailto:jmacdon at med.umich.edu]
>>>> Sent: Monday, January 21, 2008 4:09 PM
>>>> To: Doran, Harold
>>>> Cc: R Help
>>>> Subject: Re: [R] Adding an Sweave Vignette to a package
>>>>
>>>> Hi Harold,
>>>>
>>>> Doran, Harold wrote:
>>>>> I'm finalizing development of a package that will include a
>>>> vignette.
>>>>> Without the vignette, the package builds fine with no
>>>> warnings and is
>>>>> ready for distribution. Now, I am following the directions for 
>>>>> developing vignettes "Sweave, Part II: Package Vignettes"
>>>> by Friedrich
>>>>> Leisch.
>>>>>
>>>>> I am using a windows XP machine (other session info 
>> below). Here is 
>>>>> what I have done.
>>>>>
>>>>> 1) I add the 'inst/doc' directory to the package source tree.
>>>>> 2) I have added the following information in the preamble
>>>> of the .Rnw
>>>>> file
>>>>>
>>>>> % \VignetteIndexEntry{An \texttt{R} Package for Miscellaneous 
>>>>> Psychometric Analyses} % \VignetteDepends{MiscPsycho, statmod} % 
>>>>> \VignetteKeyword{misc}
>>>>>
>>>>> 3) I then copy the file "MP.Rnw" to the 'inst/doc' directory.
>>>>> 4) I then run Rcmd build g:\MiscPsycho
>>>>>
>>>>> The process begins as usual and it even tries to create the
>>>> vignette.
>>>>> However, it runs into an error at code chunk 1 
>> complaining that it 
>>>>> cannot find the function called simRasch(). This simRasch
>>>> function is
>>>>> one of the functions developed for this package and one that will 
>>>>> exist only when the package is built. The build process is halted.
>>>>>
>>>>> I'm not sure how to handle this. Any advice is appreciated.
>>>> Is there a library(MiscPsycho) at the beginning of that code chunk?
>>>>
>>>> Best,
>>>>
>>>> Jim
>>>>
>>>>
>>>>> Harold
>>>>>
>>>>>> sessionInfo()
>>>>> R version 2.6.1 (2007-11-26)
>>>>> i386-pc-mingw32
>>>>>
>>>>> locale:
>>>>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>>>>> States.1252;LC_MONETARY=English_United
>>>>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>>>>>
>>>>> attached base packages:
>>>>> [1] stats     graphics  grDevices utils     datasets  
>> methods   base
>>>>>
>>>>> other attached packages:
>>>>> [1] statmod_1.3.3
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] tools_2.6.1
>>>>>
>>>>> ______________________________________________
>>>>> R-help at r-project.org mailing list
>>>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>>>> PLEASE do read the posting guide
>>>>> http://www.R-project.org/posting-guide.html
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>> --
>>>> James W. MacDonald, M.S.
>>>> Biostatistician
>>>> Affymetrix and cDNA Microarray Core
>>>> University of Michigan Cancer Center
>>>> 1500 E. Medical Center Drive
>>>> 7410 CCGC
>>>> Ann Arbor MI 48109
>>>> 734-647-5623
>>>>
>> --
>> James W. MacDonald, M.S.
>> Biostatistician
>> Affymetrix and cDNA Microarray Core
>> University of Michigan Cancer Center
>> 1500 E. Medical Center Drive
>> 7410 CCGC
>> Ann Arbor MI 48109
>> 734-647-5623
>>
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list