Search code examples
rr-mosaic

Can I have R vignette with a pre-compiled PDF with manual index.html show up the vignette list?


I want to include a pre-compiled PDF as a vignette in a R package. The PDF is not generated via Sweave. Without a .Rnw to process, there is no \VignetteIndexEntry to cause the usual automatic generation of index.html and Meta/vignette.rds.

I created an index.html in inst/doc that is copied into doc during installation. This is corrected linked from the main package help page. However, when I load the package and execute browseVignettes("MyPackage"), I get

No vignettes found by browseVignettes("MyPackage")

This makes sense, because R apparently has no way to know that the package has a vignette. The installed package has no Meta/vignette.rds file. Can I somehow get my PDF to appear with browseVignettes()?

pdfpages

I'm familiar with the approach taken by the mosaic package, which is to use pdfpages to include the entire PDF. While clever, I feel like there should be a better way that avoids the proliferation of files.


Solution

  • Right after Yihui....

    Make a fake Rnw that looks like this:

    %\VignetteIndexEntry{User manual}
    \documentclass{article}
    \begin{document}
    \end{document}
    

    And put it in inst/doc along side your precompiled vignette and you will be all set.