[Rd] pdf default version

Marc Schwartz (via MN) mschwartz at mn.rr.com
Fri Sep 15 19:42:59 CEST 2006


On Fri, 2006-09-15 at 12:12 -0500, Kevin Wright wrote:
> R has had the ability to generate pdfs with transparent colors for a
> couple of years now using pdf(..., version="1.4").
> 
> By default, Sweave uses just 'pdf' (without version 1.4), so a hack is
> needed when using Sweave to create pdfs with transparent colors.  See
> http://tolstoy.newcastle.edu.au/R/help/04/11/6655.html
> 
> I would find my work process simpler if R defaulted to generating PDFs
> using version="1.4".  The help page for R's pdf command says there is
> a risk of some older pdf viewers not being able to view newer PDFs.
> Does anyone have a feeling for how big a risk this is?  I tried for a
> while to search google for pdf metadata and the distribution of pdf
> documents of different versions, but could find nothing useful to
> report.
> 
> The PDF 1.4 specification appears to have been published in November, 2001.
> 
> Is updating pdf() to version="1.4" feasible?
> 
> Discussions on this topic will be watched with interest.
> 
> Kevin Wright

Rather than globally changing R, wouldn't it be better to add another
option to Sweave?

For example, one can already specify 'height' and 'width' arguments for
figures, why not a pdf version value?

If I am reading it correctly, the relevant code from Sweave.R seems to
be within the RweaveLatexRuncode() function:

  if(options$pdf){
       pdf(file=paste(chunkprefix, "pdf", sep="."),
           width=options$width, height=options$height)

Could this not be modified to something like:

  if(options$pdf){
       pdf(file=paste(chunkprefix, "pdf", sep="."),
           width=options$width, height=options$height,
           version = pdf.version)

Then the call within the .Rnw file could be something like:

  <<fig=true,width=6,height=4,pdf.version=1.4,include=false>>=

I am presuming that I am oversimplifying the changes here as I have not
looked at the other code that would be affected by this change.

Comments?

HTH,

Marc Schwartz




More information about the R-devel mailing list