From ripley at stats.ox.ac.uk  Wed Nov 19 15:09:05 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Wed, 19 Nov 2008 14:09:05 +0000 (GMT)
Subject: [Rd] (PR#13234) Problems with Sweave and
 pdf.options(encoding="ISOLatin7")
In-Reply-To: <fcb463950811190345s542bc666yd045fb01f013321a@mail.gmail.com>
References: <20081031093507.EF812282C76E@mail.pubhealth.ku.dk>
	<alpine.LFD.2.00.0811190927060.20865@auk.stats.ox.ac.uk>
	<fcb463950811190345s542bc666yd045fb01f013321a@mail.gmail.com>
Message-ID: <alpine.LFD.2.00.0811191349260.31289@auk.stats.ox.ac.uk>

On Wed, 19 Nov 2008, Vaidotas Zemlys wrote:

> 2008/11/19 Prof Brian Ripley <ripley at stats.ox.ac.uk>:
>> I can't actually check what happens since the message has been garbled en
>> route to me.  Can you please send what you intended using \uxxxx escapes so
>> it is portable.  (What I have is what appears to be UTF-8 re-encoded in
>> UTF-8, things like c3 84 3f.)
>>
>> And can you also confirm that the example works correctly directly in pdf()?
>
> OK, the modified R code is:
>
> plot(rnorm(100),main="\u0105\u010D\u0117\u0119\u012F\u0161\u016B\u0173\u017E")
>
> It does not work correctly with Sweave, as I wrote in my email, I
> rechecked. And yes it works if only pdf is used.

It works for me in xpdf, but not Acroread 8.1.3.

>> On Fri, 31 Oct 2008, zemlys at gmail.com wrote:
>>
>>> Hi,
>>>
>>> Sweave for some reason does not respect encoding setting in pdf.options.
>>
>> Rather it uses its own setting.  I think you need to set option
>> pdf.encoding="ISOLatin7" on the Sweave call.
>
> Is it possible to do that? Sweave function in R, does not support
> that, and using
> SweaveHooks produced the same result.

So it is not recognizing the option, it seems:  Yes, RweaveLatexSetup 
does not know about it.

>> It would probably be better if Sweave() fetched the default for
>> options$pdf.encoding from pdf.options(), and definitely that this was
>> documented.
>
> I did not find any mention about encodings in ?Sweave, ?RweaveLatex
> and ?Rtangle,  and Sweave manual and FAQ.

Yes, Sweave is supposedly frozen pending unbundling.

Note that this does work (at least for me) in lt_LT.utf8: it is because 
you were in fr_FR.utf8 that you had a problem.

So I think the solution is actually pretty simple: use the correct locale.
I've changed R-patched to take the defaults from pdf.options(), but Sweave 
should still be able to set them.

> I looked at the code of RweaveLatexSetup, and saw that pdf.encoding is
> defined explicitly, that is how I figured out, that
> probably eps files are probably ok.
>
> Sorry for the garbled message, next time I will send unicode portable
> code without relying on email encodings.
>
> Sincerely yours,
>
> Vaidotas Zemlys
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] (PR#13234) Problems with Sweave and pdf.options(encoding="ISOLatin7")
Prof Brian Ripley