HenrikBengtsson/R.rsp

`devtools::build_vignettes` moves 'static' pdf files to inst/doc

gvegayon opened this issue · 4 comments

The problem

I know that this is something that probably should be addressed on devtools, but still, I was wondering if you have any experience with this issue. When I try to include a static PDF file as a vignette, devtools::build_vignette moves the pdf file to inst/doc which is a bit annoying as I have to move it back to viggnettes if I want to be a nice R dev and have all vignettes docs there.

To reproduce

Following the steps in R_packages-Static_PDF_and_HTML_vignettes.pdf

  1. I have two files in vignettes/:

    • who-fctc-english.pdf
    • who-fctc-english.pdf.asis

    With the later been structured as:

    %\VignetteIndexEntry{WHO Framework Convention on Tobacco Control}
    %\VignetteEngine{R.rsp::asis}
    %\VignetteKeyword{PDF}
    
  2. In DESCRIPTION I have:

    Suggests: R.rsp
    VignetteBuilder: R.rsp
    
  3. Calling devtools::build_vignettes() results in copying the *.asis and *.pdf files to inst/doc and moving the *.pdf there.

Have you faced this issue before?

What does tools:buildVignette[s]() do?

(on phone)

The call tools::buildVignettes(dir = "path to the package", tangle = TRUE) "builds" the vignettes and copies the output files (which in this case is only an empty R script) to the vignettes/ folder. I just figured out that devtools::build_vignettes uses tools::buildVignettes too, but they have an extra step, which is copying the files to inst/doc (see here), which makes a call to the function devtools:::copy_vignettes which calls file.remove (see here). I don't have experience with nuts and bolts of vignette building, but shouldn't there be a way of avoiding this behavior? Perhaps, there's a way to flag that R.rsp keeps the files when the vignette is set as R.rsp::asis. I would love to help with that and provide a pull request to devtools if needed.

Any solution for this issue @gvegayon ?

I finally checked. Yes, this is a bug in devtools::build_vignettes(). As @gvegayon writes, tools::buildVignettes() works correctly, but then devtools::build_vignettes() ends up removing the file from vignettes/.

There's nothing to fix in R.rsp. There's also nothing that can be done by R.rsp here to avoid it.

Please report problem at https://github.com/r-lib/devtools/issues.