From skyebend at skyeome.net  Fri Mar 14 17:28:01 2014
From: skyebend at skyeome.net (Skye Bender-deMoll)
Date: Fri, 14 Mar 2014 09:28:01 -0700
Subject: [Rd] Problems building package vignette: Sweave requires multiple
 passes to build document.
Message-ID: <53232E11.4050402@skyeome.net>

Dear R-devel,


Question:

     How can I get Sweave to recognize that the \thebibliography section 
is already created and generate the vignette pdf with a single pass? Or 
is there a way to let R CMD build know that Sweave needs to be run twice?

     If (1) is not possible, any suggestions how to auto-generate a 
crude generic bibtex .bib file from my existing document?

Background:

I maintain serveral R packages that include package vignettes. The 
vignettes include the reference citations inline as\bibitem lines inside 
a thebiblilography section. For some reason, this requires running 
Sweave twice on the document (the first pass is presumably preformatting 
the citation information?) to produce a pdf. This seems to be the source 
of problems when included in R's preferred vignette location 
(/vignettes/myPackage.Rnw) because the R package builder just runs 
Sweave once during the check process, so no pdf is produced and warnings 
are generated like

checking package vignettes in ???inst/doc??? ... WARNING
  Package vignette without corresponding PDF/HTML

In the past, it has been possible for me to pre-build the pdf, and 
include it in the /inst/doc/ directory. But it seems the upcoming 
versions of R may prohibit this.

It appears that it is possible to avoid all this by including a bibtex 
.bib file along with the vignette instead of doing the citations inline. 
If the .bib files exists, it seems to generate with a single pass. But 
reformatting all of the citations for each document into bibtex will be 
a huge pain. Including a blank \bibliography{} command above my 
\thebibliography environment also allows the document to be build in a 
single pass, but generates a warning about duplicate biliography and 
writes the section header twice (not surprisingly).


Note: I've cross-posted this question at:
http://stackoverflow.com/questions/22237675/how-to-get-sweave-to-recognize-thebibliography-environment-and-build-r-package

thanks for your help,
  best,
  -skye



[Rd] Problems building package vignette: Sweave requires multiple passes to build document.
Skye Bender-deMoll