Alexandre Courtiol
2020-Nov-01 16:22 UTC
[Rd] vignettes present in 2 folders or won't work
Dear all, I am struggling with an issue related to static vignettes: they work, but only when present in double in the tarball -- in the folder inst/doc and vignettes; see below for details. Details: I am pre-compiling heavy vignettes thanks to the vignette builder R.rsp. So basically, I have PDF files which I want the package to use as Vignettes. For this, I have the following in my Description file: VignetteBuilder: R.rsp I am organising the vignette by hand using a Makefile (because this is the only way that has proven 100% reliable to me, across a variety of situations). In my Makefile, I have something like: build: clean mkdir -p inst/doc mkdir vignettes -cp sources_vignettes/*/*.pdf* vignettes Rscript -e "tools::compactPDF(paths = 'vignettes', gs_quality 'printer')" cp vignettes/*.pdf* inst/doc Rscript -e "devtools::document()" mkdir inst/extdata/sources_vignettes cp sources_vignettes/*/*.Rnw inst/extdata/sources_vignettes Rscript -e "devtools::build(vignettes = FALSE)" That works fine, the vignettes show up using browseVignettes() after installing the package the normal way. However, after building, the tar.gz contains each pdf corresponding to a vignette twice: once in vignettes and once in inst/doc (which is obvious, when reading the Makefile).>From the reading of "Writing R Extensions" and other material, I cannottell if that is a must or not, but I hope it is not since I wish to avoid that (my pdfs are large even once compressed). My problem is that when I delete either inst/doc or vignette just before calling the last command of the Makefile (Rscript -e "devtools::build(vignettes = FALSE)"), then browseVignettes() does not find the vignettes after a normal installation. If anyone knows of some _complete_ documentation about the ever troublesome topic of vignettes building in R, I would be very grateful too... Many thanks! Alex -- Alexandre Courtiol http://sites.google.com/site/alexandrecourtiol/home *"Science is the belief in the ignorance of experts"*, R. Feynman [[alternative HTML version deleted]]
You are doing a lot of things that are non-standard, so I doubt if anyone is going to be able to help you without access to a simple reproducible example of a package that does what you do. Try to cut out as much as you can to make it minimal. For example, devtools::document() (indeed, most of your code) is probably irrelevant to your problem with vignettes, but things like your .Rbuildignore file are not. Duncan Murdoch On 01/11/2020 11:22 a.m., Alexandre Courtiol wrote:> Dear all, > > I am struggling with an issue related to static vignettes: they work, but > only when present in double in the tarball -- in the folder inst/doc and > vignettes; see below for details. > > Details: > > I am pre-compiling heavy vignettes thanks to the vignette builder R.rsp. > So basically, I have PDF files which I want the package to use as Vignettes. > > For this, I have the following in my Description file: > VignetteBuilder: R.rsp > > I am organising the vignette by hand using a Makefile (because this is the > only way that has proven 100% reliable to me, across a variety of > situations). > > In my Makefile, I have something like: > > build: clean > mkdir -p inst/doc > mkdir vignettes > -cp sources_vignettes/*/*.pdf* vignettes > Rscript -e "tools::compactPDF(paths = 'vignettes', gs_quality > 'printer')" > cp vignettes/*.pdf* inst/doc > Rscript -e "devtools::document()" > mkdir inst/extdata/sources_vignettes > cp sources_vignettes/*/*.Rnw inst/extdata/sources_vignettes > Rscript -e "devtools::build(vignettes = FALSE)" > > That works fine, the vignettes show up using browseVignettes() after > installing the package the normal way. > > However, after building, the tar.gz contains each pdf corresponding to a > vignette twice: once in vignettes and once in inst/doc (which is obvious, > when reading the Makefile). > > From the reading of "Writing R Extensions" and other material, I cannot > tell if that is a must or not, but I hope it is not since I wish to avoid > that (my pdfs are large even once compressed). > > My problem is that when I delete either inst/doc or vignette just before > calling the last command of the Makefile (Rscript -e > "devtools::build(vignettes = FALSE)"), then browseVignettes() does not find > the vignettes after a normal installation. > > If anyone knows of some _complete_ documentation about the ever troublesome > topic of vignettes building in R, I would be very grateful too... > > Many thanks! > > Alex >
Alexandre Courtiol
2020-Nov-01 18:02 UTC
[Rd] vignettes present in 2 folders or won't work
Noted Duncan and TRUE... I cannot do more immediately unfortunately, that is always the issue of asking a last minute panic attack question before teaching a course involving the package... I do have /doc in my .Rbuildignore for reasons I can no longer remember... I will dig and create a MRE/reprex. The students will download heavy packages, but they probably won't notice. *Apologies* In the meantime, perhaps my question was clear enough to get clarity on: 1) whether having vignettes twice in foders inst/doc and vignettes is normal or not when vignettes are static. 2) where could anyone find a complete documentation on R vignettes since it is a recurring issue in this list and elsewhere. Many thanks On Sun, 1 Nov 2020 at 18:19, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:> You are doing a lot of things that are non-standard, so I doubt if > anyone is going to be able to help you without access to a simple > reproducible example of a package that does what you do. Try to cut out > as much as you can to make it minimal. For example, > devtools::document() (indeed, most of your code) is probably irrelevant > to your problem with vignettes, but things like your .Rbuildignore file > are not. > > Duncan Murdoch > > On 01/11/2020 11:22 a.m., Alexandre Courtiol wrote: > > Dear all, > > > > I am struggling with an issue related to static vignettes: they work, but > > only when present in double in the tarball -- in the folder inst/doc and > > vignettes; see below for details. > > > > Details: > > > > I am pre-compiling heavy vignettes thanks to the vignette builder R.rsp. > > So basically, I have PDF files which I want the package to use as > Vignettes. > > > > For this, I have the following in my Description file: > > VignetteBuilder: R.rsp > > > > I am organising the vignette by hand using a Makefile (because this is > the > > only way that has proven 100% reliable to me, across a variety of > > situations). > > > > In my Makefile, I have something like: > > > > build: clean > > mkdir -p inst/doc > > mkdir vignettes > > -cp sources_vignettes/*/*.pdf* vignettes > > Rscript -e "tools::compactPDF(paths = 'vignettes', gs_quality > > 'printer')" > > cp vignettes/*.pdf* inst/doc > > Rscript -e "devtools::document()" > > mkdir inst/extdata/sources_vignettes > > cp sources_vignettes/*/*.Rnw inst/extdata/sources_vignettes > > Rscript -e "devtools::build(vignettes = FALSE)" > > > > That works fine, the vignettes show up using browseVignettes() after > > installing the package the normal way. > > > > However, after building, the tar.gz contains each pdf corresponding to a > > vignette twice: once in vignettes and once in inst/doc (which is obvious, > > when reading the Makefile). > > > > From the reading of "Writing R Extensions" and other material, I cannot > > tell if that is a must or not, but I hope it is not since I wish to avoid > > that (my pdfs are large even once compressed). > > > > My problem is that when I delete either inst/doc or vignette just before > > calling the last command of the Makefile (Rscript -e > > "devtools::build(vignettes = FALSE)"), then browseVignettes() does not > find > > the vignettes after a normal installation. > > > > If anyone knows of some _complete_ documentation about the ever > troublesome > > topic of vignettes building in R, I would be very grateful too... > > > > Many thanks! > > > > Alex > > > >-- Alexandre Courtiol http://sites.google.com/site/alexandrecourtiol/home *"Science is the belief in the ignorance of experts"*, R. Feynman [[alternative HTML version deleted]]