From p.murrell at auckland.ac.nz  Sun Sep 19 23:11:50 2004
From: p.murrell at auckland.ac.nz (Paul Murrell)
Date: Sun Sep 19 23:12:01 2004
Subject: [Rd] Incorrect display of b[hat((a))] expression in plots
References: <000001c473fc$e927a9a0$01000001@hblaptop>
	<4107608F.2090802@statistik.uni-dortmund.de>
	<41081B7C.1030104@stat.auckland.ac.nz>
	<414DC989.1050703@statistik.uni-dortmund.de>
Message-ID: <414DF616.4010104@stat.auckland.ac.nz>

Hi


Uwe Ligges wrote:
> Paul Murrell wrote:
> 
>> Hi
>>
>>
>> Uwe Ligges wrote:
>>
>>> Confirmed.
>>>
>>> I might look at it during August, since the underlying code is not 
>>> that new to me. If Paul (or anybody else from R Core) has not 
>>> answered yet and there is not already a related bug report in the 
>>> database, I'd suggest to submit a bug report.
>>
>>
>>
>>
>> Yep, bug not lack-of-implementation.
>>
>> Uwe:  sounds like you might get to this before me.  Some possibly 
>> useful observations from a brief look yesterday:
>> (i)  Looks like only the actual drawing that is wrong;  the bounding 
>> box calculations appear correct (the parentheses around the outside 
>> look about right)
>> (ii)  The offending accents are all common to RenderAccent() (they all 
>> appear in AccentTable)
> 
> 
> 
> 
> 
> Paul, Henrik,
> 
> here we go - later than promised, but not too late for 2.0.0, I hope.
> 
> 
> The last lines of RenderAccent() need:
> 
> +   if(draw)
>     PMoveTo(savedX + width, savedY, mc);
> 
> rather than just
> 
>     PMoveTo(savedX + width, savedY, mc);
> 
> and it took me more than 2 painful hours to get the point! :-(


Looks good to me.  Committing for 2.0.0
Thanks heaps Uwe! :)


> (Do we have a PR#? I don't find it.)


Don't think so.

Paul


>>> Henrik Bengtsson wrote:
>>>
>>>> Hi, I am not sure if this is a bug or a non-implement feature of
>>>> text-drawing functions with TeX-style expression, but hat() and some 
>>>> of its
>>>> equals does not get the right "bounding boxes" if they are put in 
>>>> sub- or
>>>> superscripts. For instance, for the expression 'b[hat(a)]' the hat() 
>>>> seems
>>>> to shift 'hat(a)' too much to the right of 'b'. Try the below 
>>>> example and
>>>> you'll see what I mean:
>>>>
>>>> label <- list(
>>>>   expression((b[sqrt(a)])),
>>>>   expression((b[bar(a)])),
>>>>   expression((b[widehat(a)])),
>>>>   expression((b[widetilde(a)])),
>>>>   expression((tilde(a))),
>>>>   # Problematic:
>>>>   expression((b[dot(a)])),
>>>>   expression((b[ring(a)])),
>>>>   expression((b[hat(a)])),
>>>>   expression((b[tilde(a)])),
>>>>   expression((b^dot(a))),
>>>>   expression((b^ring(a))),
>>>>   expression((b^hat(a))),
>>>>   expression((b^tilde(a)))
>>>> )
>>>>
>>>> plot(NA, xlim=c(0,2), ylim=c(-1,length(label)))
>>>> for (kk in seq(label))
>>>>   text(1,length(label)-kk, label=label[[kk]])
>>>>
>>>> The problem occurs for the postscript and png devices too (I haven't 
>>>> tried
>>>> the others).
>>>>
>>>> I'm on WindowsXP and "R version 1.9.1, 2004-06-21" (non-patched).
>>>>
>>>> Best wishes
>>>>
>>>> Henrik Bengtsson
>>>>
>>>> Dept. of Mathematical Statistics @ Centre for Mathematical Sciences 
>>>> Lund Institute of Technology/Lund University, Sweden (+2h UTC)
>>>> +46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax)
>>>> h b @ m a t h s . l t h . s e, http://www.maths.lth.se/~hb/
>>>>
>>>> ______________________________________________
>>>> R-devel@stat.math.ethz.ch mailing list
>>>> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>>>
>>>
>>>
>>>
>>> ______________________________________________
>>> R-devel@stat.math.ethz.ch mailing list
>>> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
>>
>>
>>
>>


-- 
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
paul@stat.auckland.ac.nz
http://www.stat.auckland.ac.nz/~paul/


[Rd] Incorrect display of b[hat((a))] expression in plots
Paul Murrell