[R] Simultaneous subscripts and superscripts
Uwe Ligges
ligges at statistik.uni-dortmund.de
Mon Aug 9 19:54:14 CEST 2004
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
More information about the R-help
mailing list