Search code examples
rcran

Using a static (prebuilt) PDF vignette in R package


What is the proper way, to include a static PDF file as a "vignette" in a CRAN package as of R 3.0?

The trick described in this document of using an empty stub Rnw does not seem to work in R 3.0. The document suggests that there is now a better way based on \VignetteEngine{} but it's not quite clear how this works for static PDF files.


Solution

  • With R.rsp (>= 1.19.0) you can include a static PDF 'vignettes/main.pdf' by adding a tiny 'vignettes/main.pdf.asis' text file that contains:

    %\VignetteIndexEntry{My amazing package}
    %\VignetteEngine{R.rsp::asis}
    

    and make sure to have:

    Suggests: R.rsp
    VignetteBuilder: R.rsp
    

    in your package's DESCRIPTION file. This also works for static HTML vignettes. This is also explained in one of the R.rsp vignettes.