Dear List, I'd like to add text to a plot where a text symbol has both a superscript and subscript. For example, the variable S with a superscript 2 and a subscript t. I have been able to accomplish this using either expression( paste(S,atop(scriptstyle(2),scriptstyle(t))) ) or expression( {S[t]}^2 ) but the spacing isn't quite right (or rather what I'd like) using either of these. By 'right' I mean the placement and spacing don't quite coincide with what I'd expect if I superimposed S^2 with S[t]. Is there a way to place BOTH a subscript and superscript so that they are placed identically as if I had overlayed S^2 and S[t]? I'm using R 1.9.0 on Mac OSX. Thanks, Brian -- ********************************************************************* Brian Beckage Department of Botany University of Vermont Marsh Life Science Building Burlington, VT 05405
expression(S[t]^2) looks pretty good for me (on windows()). Andy> From: Brian Beckage > > Dear List, > > I'd like to add text to a plot where a text symbol has both a > superscript and subscript. For example, the variable S with a > superscript 2 and a subscript t. I have been able to accomplish this > using either > > expression( paste(S,atop(scriptstyle(2),scriptstyle(t))) ) > > or > > expression( {S[t]}^2 ) > > but the spacing isn't quite right (or rather what I'd like) using > either of these. By 'right' I mean the placement and spacing don't > quite coincide with what I'd expect if I superimposed S^2 with S[t]. > Is there a way to place BOTH a subscript and superscript so that they > are placed identically as if I had overlayed S^2 and S[t]? > > I'm using R 1.9.0 on Mac OSX. > > Thanks, > Brian > > > -- > ********************************************************************* > Brian Beckage > Department of Botany > University of Vermont > Marsh Life Science Building > Burlington, VT 05405 > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >
Brian Beckage wrote:> Dear List, > > I'd like to add text to a plot where a text symbol has both a > superscript and subscript. For example, the variable S with a > superscript 2 and a subscript t. I have been able to accomplish this > using either > > expression( paste(S,atop(scriptstyle(2),scriptstyle(t))) ) > > or > > expression( {S[t]}^2 ) > > but the spacing isn't quite right (or rather what I'd like) using either > of these. By 'right' I mean the placement and spacing don't quite > coincide with what I'd expect if I superimposed S^2 with S[t]. Is there > a way to place BOTH a subscript and superscript so that they are placed > identically as if I had overlayed S^2 and S[t]? > > I'm using R 1.9.0 on Mac OSX. > > Thanks, > Brian >I think that depends on the font in use. If letters don't have the same width, it is difficult to calculate pretty bounding boxes ... and the expected behaviour is to left-align. Hence it's as expected. Are you volunteering to add some fuzz to plotmath.c? I guess you will have to add quite a lot of code for this tiny step... (and R is not TeX, BTW). Uwe Ligges
Andy Liaw wrote> expression(S[t]^2) looks pretty good to me (on windows()).And to me too (sparc-sun-solaris2.9; R version 1.9.1). cheers, Rolf Turner
I guess it's good to type what makes sense: I can understand squaring S[t], but it's hard for me to fathom subscripting S^2...> -----Original Message----- > From: Brian Beckage [mailto:Brian.Beckage at uvm.edu] > Sent: Monday, August 09, 2004 1:55 PM > To: Liaw, Andy; r-help at stat.math.ethz.ch > Subject: RE: [R] Simultaneous subscripts and superscripts > > > Yep, it looks good on my system as well. I had tried > expression(S^2[t]) but not expression(S[t]^2) and the order matters. > > Thanks for the help. > > Brian > > > > > > Brian > > At 1:44 PM -0400 8/9/04, Liaw, Andy wrote: > >expression(S[t]^2) looks pretty good for me (on windows()). > > > >Andy > > > >> From: Brian Beckage > >> > >> Dear List, > >> > >> I'd like to add text to a plot where a text symbol has both a > >> superscript and subscript. For example, the variable S with a > >> superscript 2 and a subscript t. I have been able to > accomplish this > >> using either > >> > >> expression( paste(S,atop(scriptstyle(2),scriptstyle(t))) ) > >> > >> or > >> > >> expression( {S[t]}^2 ) > >> > >> but the spacing isn't quite right (or rather what I'd like) using > >> either of these. By 'right' I mean the placement and > spacing don't > >> quite coincide with what I'd expect if I superimposed S^2 > with S[t]. > >> Is there a way to place BOTH a subscript and superscript > so that they > >> are placed identically as if I had overlayed S^2 and S[t]? > >> > >> I'm using R 1.9.0 on Mac OSX. > >> > >> Thanks, > >> Brian > >> > >> > >> -- > >> > ********************************************************************* > >> Brian Beckage > >> Department of Botany > >> University of Vermont > >> Marsh Life Science Building > >> Burlington, VT 05405 > >> > >> ______________________________________________ > >> R-help at stat.math.ethz.ch mailing list > >> https://www.stat.math.ethz.ch/mailman/listinfo/r-help > >> PLEASE do read the posting guide! > >> http://www.R-project.org/posting-guide.html > >> > >> > > > > > >------------------------------------------------------------- > ----------------- > >Notice: This e-mail message, together with any attachments, > >contains information of Merck & Co., Inc. (One Merck Drive, > >Whitehouse Station, New Jersey, USA 08889), and/or its affiliates > >(which may be known outside the United States as Merck Frosst, Merck > >Sharp & Dohme or MSD and in Japan, as Banyu) that may be > >confidential, proprietary copyrighted and/or legally privileged. It > >is intended solely for the use of the individual or entity named on > >this message. If you are not the intended recipient, and have > >received this message in error, please notify us immediately by > >reply e-mail and then delete it from your system. > >------------------------------------------------------------- > ----------------- > > > -- > ********************************************************************* > Brian Beckage > Department of Botany > University of Vermont > Marsh Life Science Building > Burlington, VT 05405 > > Phone: 802 656-0197 > Fax : 802 656-0440 > email: Brian.Beckage at uvm.edu > web : www.uvm.edu/~bbeckage > ********************************************************************* > >