From simon.urbanek at r-project.org  Tue Nov  1 01:37:12 2011
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Mon, 31 Oct 2011 20:37:12 -0400
Subject: [Rd] Sweave, cairo_pdf, xetex, CJK (Re:  Sweave, cairo_pdf, CJK,
	ghostscript)
In-Reply-To: <1320105163.3506.YahooMailClassic@web29504.mail.ird.yahoo.com>
References: <1320105163.3506.YahooMailClassic@web29504.mail.ird.yahoo.com>
Message-ID: <CDE936C4-192F-4362-AAD9-CA2A88788297@r-project.org>


On Oct 31, 2011, at 7:52 PM, Hin-Tak Leung wrote:

> --- On Mon, 31/10/11, Simon Urbanek <simon.urbanek at r-project.org> wrote:
> 
>> On Oct 31, 2011, at 5:56 PM, Hin-Tak Leung wrote:
>> 
>>> I am still doing some cosmetic things (adding
>> annotations with some of the really minority languages in
>> Sichuan), but here are a few misc tips and quirks so far:
>>> 
>>> - cairo_pdf() behaves differently via "R CMD Sweave
>> <file>" vs Sweave("file") within R. The former
>> produces a lot of warnings about not being able to determine
>> strwidth and have to substitute. Probably understandable,
>> but still annoying.
>>> 
>>> - It generates pdf 1.5 - when used in combination with
>> xetex, - which uses xdvipdfmx for pdf generation, and
>> xdvipdfmx has the rather disturbing behavior of *silently*
>> *skipping* included pdf's that's higher than the default
>> (instead of do it with warning like pdfTeX) so no graphics
>> will be included, unless xetex is run with
>> -output-driver="xdvipdfmx -V 5"... to declare to output pdf
>> 1.5 .
>>> 
>>> - xetex needs noae in \usepackage{SWeave}. FWIW,
>> Werner Lemberg's CJK (the LaTeX package) can work without
>> declaring noae, so that's my preferred choice at the moment,
>> although I have got both of them working, for doing Chinese
>> in a LaTeX document.
>>> 
>>> I think some of these information should go into the
>> man page of cairo_pdf()...
>>> 
>> 
>> Well, I don't see how most of the above is in any way
>> relevant. What PDF gets generated really depends on the
>> cairo version you are using, not on R. Only most recent
>> versions of Cairo (1.10.x) switched the format to PDF-1.5
>> and added format restriction functions, they are not
>> available in general. In addition, PDF-1.5 is 8 years old,
>> so whatever tools can't deal with it are seriously out of
>> date.
> 
> That's ignorant.

Oh, really? I'll leave it to you to verify the canonical source (Adobe) which lists PDF 1.5 as released in August 2003, more than 8 years ago. Please check you facts before making such obviously incorrect statements.

Cheers,
Simon


> In terms of visual elements and desktop publishing, the last major change in the pdf specification was 1.4, which introduces transparency. Most open-source pdf rendering capbalities are based on either ghostscript or xpdf/libpoppler . (TexLive/xetex/xdvipdfmx in the latter camp). Granted the developer od xdivpdfmx made a strange decision - the pdf specification explicitly state that renderers/readers should ignore features they don't understand and make "best effort" rather than abort, but what you claimed - "whatever tools cannot cannot deal with [PDF-1.5] are seriously out of date" is utterly wrong: neither ghostscript nor libpopper supports that fully. And I wonder what "tools" you use (other than Acrobat) are not based on those two.
> 
> FWIW, have a look at ghostscript's bug database, and search for "cairo".
> 
> 



[Rd] Sweave, cairo_pdf, xetex, CJK (Re: Sweave, cairo_pdf, CJK, ghostscript)
Simon Urbanek