[R-pkg-devel] [External] compact vignettes
Mikael Jagan
j@g@nmn2 @end|ng |rom gm@||@com
Thu Jul 24 14:27:12 CEST 2025
On 2025-07-24 7:42 am, Mikael Jagan wrote:
>> Date: Thu, 24 Jul 2025 02:00:32 +0300
>> From: Ivan Krylov<ikrylov using disroot.org>
>>
>> В Wed, 23 Jul 2025 20:09:26 +0000
>> "Richard M. Heiberger"<rmh using temple.edu> пишет:
>>
>>> When I use
>>> R_QPDF=/Library/Frameworks/R.framework/Resources/bin/qpdf
>>> R_GSCMD=/usr/local/bin/Cellar/ghostscript/10.03.0/bin/gs
>>> GS_QUALITY=ebook
>>> echo $R_QPDF $R_GSCMD $GS_QUALITY
>>> R CMD build --compact-vignettes=both microplot
>>>
>>> I get 558950 bytes
>>>
>>> The bytecount for the package went up.
>> Unfortunately, this seems to be very dependent on versions of software
>> in use, including LaTeX and Ghostscript (and fonts?). I can compress
>> your pre-built 372Kb vignette to 96Kb (as does the CRAN machine), but
>> when I rebuild the package, I can only get down from 276Kb to 156Kb:
>>
>> R -q -s -e '
>> untar("microplot_1.0-47.tar.gz.orig");
>> tools::compactPDF(
>> "microplot/inst/doc",
>> gs_cmd = "gs", gs_quality = "ebook",
>> verbose = TRUE
>> )
>> '
>> qs_quality="ebook" : use_gs=TRUE, use_qpdf=TRUE
>> #{pdf}s = length(paths) = 1
>> - microplot/inst/doc/rmhPoster.pdf: gs: res=0; + qpdf: res=0;
>> ==> (new=98115)/(old=380862) = 0.257613 =====> using it !!
>> compacted ‘rmhPoster.pdf’ from 372Kb to 96Kb
>>
>>
>> LANGUAGE=en R_GSCMD=gs GS_QUALITY=ebook R CMD build \
>> --compact-vignettes=both microplot
>> <...>
>> * creating vignettes ... OK
>> <...>
>> * compacting vignettes and other PDF files
>> compacted ‘rmhPoster.pdf’ from 276Kb to 156Kb
>>
>> And 'gs --version' says '10.00.0', which shouldn't be that different
>> from your '10.03.0'!
>>
>
> I build ghostscript from sources under macOS and upgrade the version
> periodically. I encountered the same issue last year and stayed at
> 10.02 until they released 10.04, because there was a clear regression
> in 10.03. I was never able to track down a relevant bug report, but
> I never looked very hard ...
>
By the way, as mentioned in WRE, you can get ghostscript from a full MacTeX
rather than Homebrew. MacTex 2025 installs a binary ghostscript 10.04 under
/usr/local/bin.
Mikael
> Mikael
>
>> -- Best regards, Ivan
>
More information about the R-package-devel
mailing list