I sent this privately to ivo welch yesterday, and he thinks it might be useful to someone else as well. Since I'm on a Mac the screen device is quartz():

> quartz()
> plot( c(0,1), c(0,1) );
> text( 0.5, 0.5, "\u2113" )
# and then File/Save As/
--
David.

Begin forwarded message:

From: David Winsemius <dwinsem...@comcast.net>
Date: August 17, 2010 3:44:34 PM EDT
To: ivo welch <ivo.we...@gmail.com>
Subject: Re: [R] \ell symbol (log-likelihood)


On Aug 17, 2010, at 1:08 PM, ivo welch wrote:

yes, I got the same thing.


When I plot to the Mac default screen device (which only does "Save as.." to pdf files) I get the desired glyph. Saving it produces the desired file. If you need to save files programatically, there might be work-arounds using the screen device as an intermediate.

You could also look up this obscure reference:
http://finzi.psych.upenn.edu/Rhelp10/2009-August/209605.html

The author (me) says that he found out that UTF-8 is not an acceptable encoding and that others are needed for ps devices (and perhaps this applies to pdf as well, but he is unsure) and can be found in your grDevices folder. I wish I could tell you which combination of encoding with which font can get you what you want but that is beyond my ken.

--
David.


best,

/iaw
----
Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com)
CV Starr Professor of Economics (Finance), Brown University

On Tue, Aug 17, 2010 at 12:50 PM, David Winsemius
<dwinsem...@comcast.net> wrote:

On Aug 17, 2010, at 8:41 AM, ivo welch wrote:

Dear R experts---is it possible to plot the \ell symbol in R under the
pdf device?  the following did not work:

pdf(file="ell.pdf");
plot( c(0,1), c(0,1) );
text( 0.5, 0.5, "\u2113" )
dev.off()

my guess is that this cannot be done, but I thought I would ask.

(On a Mac:)

After 7 warning messages I got an ellipsis ("...") printed at the desired location. Interestingly I think the error message might have properly printed the desired glyph (assuming you wanted a cursive lower case "l":

Warning messages:
1: In text.default(0.5, 0.5, "ℓ") :
conversion failure on 'ℓ' in 'mbcsToSbcs': dot substituted for <e2>

I also looked in the Hershey fonts without recognition (but could have missed one). One the Mac there is an option among the Zapfino family but I
suspect that is of little use to you.



David Winsemius, MD
West Hartford, CT



David Winsemius, MD
West Hartford, CT


David Winsemius, MD
West Hartford, CT

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to