[R-pkg-devel] vignettes - size of pdf

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Fri Nov 11 20:56:29 CET 2022


On 11 November 2022 at 16:06, Ivan Krylov wrote:
| В Fri, 11 Nov 2022 12:54:52 +0000
| "Grose, Daniel" <dan.grose using lancaster.ac.uk> пишет:
| 
| > * checking sizes of PDF files under 'inst/doc' ... WARNING
| >   'gs+qpdf' made some significant size reductions:
| >      compacted 'cpop.pdf' from 805Kb to 547Kb
| >   consider running tools::compactPDF(gs_quality = "ebook") on these
| > files
| > 
| > I do not understand how I can do this given that the pdf is produced
| > when installing the package. Any ideas ?
| 
| I think that the PDF file is built during R CMD build, not (only) R CMD
| INSTALL. At the very least, the source package currently on CRAN
| contains both the *.pdf and the *.ltx files under inst/doc:
| https://github.com/cran/cpop/tree/master/inst/doc
| 
| Does it help to pass the --compact-vignettes=gs+qpdf argument to R CMD
| build? It seems to be off by default.

I find command-line helper scripts convenient in my workflow, and so I added
dozens in the examples/ folder of the littler package. I had already relied
on 'build.r' to build the source packages and find this message tedious too
so about a year ago I changed it to default to compact at _source_ build
time. The script is (thanks to doctopt) all of about five lines of which the
final three are

  argv <- if (opt$fast) c("--no-build-vignettes", "--no-manual", opt$PACKAGES) else opt$PACKAGES

  extraargs <- c("--compact-vignettes=both", "--resave-data", argv)

  tools:::.build_packages(extraargs, no.q=interactive())

Does the trick for me (and CRAN as I get no nags on packages made this way).

Dirk


-- 
dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org



More information about the R-package-devel mailing list