[R] Printing Unicode characters in a PDF document

Dennis Fisher fisher at plessthan.com
Sat Mar 20 19:16:25 CET 2010


Colleagues,

OS:	OS X
R:	2.10.1

I want a mu (µ) to appear in text that is created using a PDF device.  However, the µ does not appear as intended; instead, it is replaced by two dots.  A minimal example is:
> pdf("mu.pdf")
> plot(1,1, type="n")
> text(1,1, "\u3BC")
> dev.off()


The "text" command yields the following warning messages:
> Warning messages:
> 1: In text.default(1, 1, "μ") :
>   conversion failure on 'μ' in 'mbcsToSbcs': dot substituted for <ce>
> 2: In text.default(1, 1, "μ") :
>   conversion failure on 'μ' in 'mbcsToSbcs': dot substituted for <bc>
> 3: In text.default(1, 1, "μ") :
>   font metrics unknown for Unicode character U+03bc
> 4: In text.default(1, 1, "μ") :
>   conversion failure on 'μ' in 'mbcsToSbcs': dot substituted for <ce>
> 5: In text.default(1, 1, "μ") :
>   conversion failure on 'μ' in 'mbcsToSbcs': dot substituted for <bc>

In contrast, when I use a quartz device:
> plot(1,1, type="n")
> text(1,1, "\u3BC")

The mu appears as expected, presumably indicating that the problem relates to devices.

For various reasons, I would like to avoid using plotmath (expression).  Thanks for any assistance.

Dennis


Dennis Fisher MD
P < (The "P Less Than" Company)
Phone: 1-866-PLessThan (1-866-753-7784)
Fax: 1-866-PLessThan (1-866-753-7784)
www.PLessThan.com



More information about the R-help mailing list