R: Package vignette engines

vignette_engines {knitr} | R Documentation

## Package vignette engines

### Description

Since R 3.0.0, package vignettes can use non-Sweave engines, and knitr has provided a few engines to compile vignettes via `knit()` with different templates. See https://yihui.name/knitr/demo/vignette/ for more information.

### Note

If you use the `knitr::rmarkdown` engine, please make sure that you put rmarkdown in the Suggests field of your ‘DESCRIPTION’ file. Also make sure the executables `pandoc` and `pandoc-citeproc` can be found by rmarkdown during `R CMD build`. If you build your package from RStudio, this is normally not a problem. If you build the package outside RStudio, run `which pandoc` and `which pandoc-citeproc` in the terminal (or `Sys.which('pandoc')` and `Sys.which('pandoc-citeproc')` in R) to check if `pandoc` and `pandoc-citeproc` can be found. If you use Linux, you may make symlinks to the Pandoc binaries in RStudio: https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md, or install `pandoc` and `pandoc-citeproc` separately.

When the rmarkdown package is not installed or not available, or `pandoc` or `pandoc-citeproc` cannot be found, the `knitr::rmarkdown` engine will fall back to the `knitr::knitr` engine, which uses R Markdown v1 based on the markdown package.

### Examples

    library(knitr)
    vig_list = tools::vignetteEngine(package = "knitr")
    str(vig_list)
    vig_list[["knitr::knitr"]][c("weave", "tangle")]
    vig_list[["knitr::knitr_notangle"]][c("weave", "tangle")]
    vig_list[["knitr::docco_classic"]][c("weave", "tangle")]

[Package knitr version 1.20 Index]