Re: [R] asterisk in subscript

2011-01-28 Thread Prof Brian Ripley

On Fri, 28 Jan 2011, Andrew Collier wrote:


hi,

i am trying to label a plot axis with the equivalent of the latex $n_*$.
i initially tried

expression(paste(italic(n)[*]))

but this made the * absolutely tiny and centred about midway wrt the n.
then

expression(paste(italic(n)[textstyle(*)]))

made the * about the right size but now it looks more like a superscript
than a subscript.

does anyone have an idea of how to get the * to the right subscript
position (ie. somewhere near the baseline of the n)? thanks!


I think these *are* correct: remember that an asterisk is a 
superscript.  However, what you see depends on the graphics device and 
font you used, and you have not told us (pace the posting guide).  If 
your OS and device support Unicode, try \u2217:


expression(paste(italic(n)[\u2217]))

looks about right to me (X11() on Linux).


best regards,
andrew.

--
Andrew B. Collier

Physicist
Waves and Space Plasmas Group
Hermanus Magnetic Observatory

Honorary Senior Lecturer tel: +27 31 2601157
Space Physics Research Institute fax: +27 31 2607795
University of KwaZulu-Natal, Durban, South Africagsm: +27 83 3813655


--
Brian D. Ripley,  rip...@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, UKFax:  +44 1865 272595

__
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.


Re: [R] asterisk in subscript

2011-01-28 Thread Andrew Collier
thanks for the rapid response.

yes, in x11 your suggestion works perfectly. i have never thought of the
asterisk as being a superscript... to me it has always been the
mulitply sign which is centred. thanks for the education!

however, my plot is being sent to postscript, which i guess does not
support unicode because i get a whole flurry of warnings and the text on
the plot is not correct.

Warning messages:
1: In title(...) : font metrics unknown for Unicode character U+2217
2: In title(...) : font metrics unknown for Unicode character U+2217
3: In title(...) : font metrics unknown for Unicode character U+2217
4: In title(...) : font metrics unknown for Unicode character U+2217
5: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for e2
6: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for 88
7: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for 97
8: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for e2
9: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for 88
10: In title(...) :
  conversion failure on '∗' in 'mbcsToSbcs': dot substituted for 97

the plotting command is

plot(NA, xlim = c(0,10), ylim = c(0, 20), ylab =
expression(paste(symbol(\341), italic(n), symbol(\361))), xlab =
expression(paste(italic(n)[\u2217])))

i am just using the plain vanilla font (no changes).

it is being run on R version 2.11.1 (2010-05-31) under ubuntu.

my locale is

LC_CTYPE=en_ZA.utf8;LC_NUMERIC=C;LC_TIME=en_ZA.utf8;LC_COLLATE=en_ZA.utf8;LC_MONETARY=C;LC_MESSAGES=en_ZA.utf8;LC_PAPER=en_ZA.utf8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_ZA.utf8;LC_IDENTIFICATION=C


-- 
Andrew B. Collier

Physicist
Waves and Space Plasmas Group
Hermanus Magnetic Observatory

Honorary Senior Lecturer tel: +27 31 2601157
Space Physics Research Institute fax: +27 31 2607795
University of KwaZulu-Natal, Durban, South Africagsm: +27 83 3813655



On Fri, 2011-01-28 at 09:48 +, Prof Brian Ripley wrote: 
 On Fri, 28 Jan 2011, Andrew Collier wrote:
 
  hi,
 
  i am trying to label a plot axis with the equivalent of the latex $n_*$.
  i initially tried
 
  expression(paste(italic(n)[*]))
 
  but this made the * absolutely tiny and centred about midway wrt the n.
  then
 
  expression(paste(italic(n)[textstyle(*)]))
 
  made the * about the right size but now it looks more like a superscript
  than a subscript.
 
  does anyone have an idea of how to get the * to the right subscript
  position (ie. somewhere near the baseline of the n)? thanks!
 
 I think these *are* correct: remember that an asterisk is a 
 superscript.  However, what you see depends on the graphics device and 
 font you used, and you have not told us (pace the posting guide).  If 
 your OS and device support Unicode, try \u2217:
 
 expression(paste(italic(n)[\u2217]))
 
 looks about right to me (X11() on Linux).
 
  best regards,
  andrew.
 
  -- 
  Andrew B. Collier
 
  Physicist
  Waves and Space Plasmas Group
  Hermanus Magnetic Observatory
 
  Honorary Senior Lecturer tel: +27 31 2601157
  Space Physics Research Institute fax: +27 31 2607795
  University of KwaZulu-Natal, Durban, South Africagsm: +27 83 3813655


__
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.


Re: [R] asterisk in subscript

2011-01-28 Thread Ted Harding
On 28-Jan-11 10:24:23, Andrew Collier wrote:
 thanks for the rapid response.
 
 yes, in x11 your suggestion works perfectly. i have never
 thought of the asterisk as being a superscript... to me it
 has always been the mulitply sign which is centred.
 thanks for the education!
 
 however, my plot is being sent to postscript, which i guess
 does not support unicode because i get a whole flurry of
 warnings and the text on the plot is not correct.
 [snip]

Indeed, PostScript does not support Unicode, though for the
characters which it does support it would be possible to
convert Unicode into appropriate PostScript references.

However, PostScript does have a centred (non-superscript)
asterisk. This is in the Symbol character set, and it is
called asteriskmath, with octal code 052 (decimal 42).

But I do now know how to instruct R to cause this to be printed!
(Though I feel sure someone else does).

Ted.


E-Mail: (Ted Harding) ted.hard...@wlandres.net
Fax-to-email: +44 (0)870 094 0861
Date: 28-Jan-11   Time: 10:43:39
-- XFMail --

__
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.


Re: [R] asterisk in subscript

2011-01-28 Thread Andrew Collier
magic! this does the trick:

expression(paste(italic(n)[symbol(\052)]))

thanks for the hint, ted!

-- 
Andrew B. Collier

Physicist
Waves and Space Plasmas Group
Hermanus Magnetic Observatory

Honorary Senior Lecturer tel: +27 31 2601157
Space Physics Research Institute fax: +27 31 2607795
University of KwaZulu-Natal, Durban, South Africagsm: +27 83 3813655

__
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.