[R] umlauts in Rd files

Peter Dalgaard p.dalgaard at biostat.ku.dk
Wed Jun 15 14:36:55 CEST 2005


Robin Hankin <r.hankin at noc.soton.ac.uk> writes:

> Hi
> 
> I'm having difficulty following the advice in section 2.7 of R-exts.
> 
> In one of my packages, there is a function called mobius().
> 
> I want to refer to it in the Rd file as the Möbius function, and to 
> illustrate the
>   Möbius  inversion formula (just to be explicit: this is "Mobius" but 
> with two dots over the second letter).
> 
> R-exts section 2.7  gives
> 
> \enc{Jöreskog}{Joreskog}
> 
> as an example, but when I cut-and-paste this, the dvi file (as produced 
> by R CMD Rd2dvi)
> shows the umlauted "o" as A and Z with some diacritical marks, not the 
> desired o with
> two dots on.
> 
> Using \"{o} is fine for the dvi output but not the ascii output.
> 
> How do I put an umlauted "o" in an Rd file in such a way as to have a 
> nice
> ascii help page and nice dvi files?

Well... You can't. There's no odiaeresis in ASCII. That's exactly the
problem. In UTF-8 or ISO-Latin-1/9 (aka 8859-1 or ditto with the
addition of the Euro) you can display the character and we did
previously implicitly assume Latin-1. However this is of no use to
people in say Latin-2 locales, and in fact we can no longer spell the
entire R Core Team correctly using any of the Latin-N locales (we
lose either M{\"a}chler or {\v S}imon). 

As far as I understand the current situation, we recommend that text
files be pure ASCII (which has also led us to introduce deliberate
misspellings of various people in the NEWS file and similar places).

What is happening to you is something else though: The double
characters are a tell-tale sign that you have provided UTF-8 to
something that expected an 8-bit encoding like Latin-1. The fix for
that should be to put \encoding{UTF-8} somewhere at the beginning of
the .Rd file.

(I may well have gotten some detail wrong here, Brian probably knows
the best.)


-- 
   O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)                  FAX: (+45) 35327907




More information about the R-help mailing list