[Rd] ugly in plotmath: frac(1, sqrt(...)) (PR#1101)

ligges@statistik.uni-dortmund.de ligges@statistik.uni-dortmund.de
Thu, 4 Oct 2001 11:40:33 +0200 (MET DST)


ligges@statistik.uni-dortmund.de wrote:
> 
> ligges@statistik.uni-dortmund.de wrote:
> >
> > Sometimes (dependent on device and settings of 'cex' and 'lwd') the line
> > of a square root symbol plottet in the denominator of a fraction appears
> > to be in or above the line of the fraction.
> >
> > Examples:
> >
> > ### Choose one of these:
> > # pdf("test.pdf", height=6, width=8)
> > # bmp("test.bmp", width=1100, height=800, pointsize=12)
> > # bitmap("test.tif", type="tiff24nc", width=12, height=9, res=300,
> > pointsize=12)
> > # png("test.png", width=1100, height=800, pointsize=12)
> > # postscript("test.eps", height=6, width=8, horizontal=FALSE)
> >
> >  par(cex=2, lwd=2)
> >  plot(1:10)
> >  text(2, 8, expression(frac(1, sigma[i]*sqrt(2*pi))))
> > dev.off()
> 
> After some investigations:
> In plotmath.c, line 2250 the "the gap between the nucleus and the
> radical extension" is defined:
>  #define RADICAL_GAP    0.4
> 
> It looks like this gap is not added to the hight (or included in the
> calculations of the hight) of the denominator of a fraction. So the
> whole denominator is located to close to the fraction bar, if a root is
> drawn.
> I don't see, how this can be fixed smartly ...


Suggestion for a fix.

plotmath.c, lines 2340 ff.:

    orderBBox = CombineBBoxes(orderBBox, RenderElement(body, draw));
    orderBBox = CombineBBoxes(orderBBox, RenderGap(2 * radTrail, draw));
 +  orderBBox = EnlargeBBox(orderBBox, radGap, 0, 0);
    SetStyle(style);
    return orderBBox;


Uwe Ligges

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._