buildVignette {tools}R Documentation

Build One Vignette


Run Sweave (or other custom weave function), texi2pdf, and/or Stangle (or other custom tangle function) on one vignette.

This is the workhorse of R CMD Sweave.


buildVignette(file, dir = ".", weave = TRUE, latex = TRUE, tangle = TRUE, 
              quiet = TRUE, clean = TRUE, keep = character(),
              engine = NULL, buildPkg = NULL, encoding, ...)



character; the vignette source file.


character; the working directory in which the intermediate and output files will be produced.


logical; should weave be run?


logical; should texi2pdf be run if weaving produces a ‘.tex’ file?


logical; should tangle be run?


logical; run in quiet mode?


logical; whether to remove some newly created, often intermediate, files. See details below.


a list of file names to keep in any case when cleaning. Note that “target” files are kept anyway.


NULL or character; name of vignette engine to use. Overrides any ‘⁠\VignetteEngine{}⁠’ markup in the vignette.


NULL or a character vector; optional packages in which to find the vignette engine.


the encoding to assume for the file. If not specified, it will be read if possible from the file's contents. Note that if the vignette is part of a package, buildVignettes reads the package's encoding from the ‘DESCRIPTION’ file but this function does not.


Additional arguments passed to weave and tangle.


This function determines the vignette engine for the vignette (default utils::Sweave), then weaves and/or tangles the vignette using that engine. Finally, if clean is TRUE, newly created intermediate files (non “targets”, where these depend on the engine, etc, and not any in keep) will be deleted. If clean is NA, and weave is true, newly created intermediate output files (e.g., ‘.tex’) will not be deleted even if a ‘.pdf’ file has been produced from them.

If buildPkg is specified, those packages will be loaded before the vignette is processed and will be used as the default packages in the search for a vignette engine, but an explicitly specified package in the vignette source (e.g., using ‘⁠\VignetteEngine{utils::Sweave}⁠’ to specify the Sweave engine in the utils package) will override it. In contrast, if the engine argument is given, it will override the vignette source.


A character vector naming the files that have been produced.


Henrik Bengtsson and Duncan Murdoch

See Also

buildVignettes for building all vignettes in a package.

[Package tools version 4.4.1 Index]