[Rd] surprising behaviour of "bgroup": sets all in greek letters (PR#3099)

ligges at statistik.uni-dortmund.de ligges at statistik.uni-dortmund.de
Sun May 25 19:33:49 MEST 2003


Let me summarize the bug reported by Ulf Martin on R-help with the same 
subject line.

The code

   plot(1:10)
   text(1, 9, expression(F == bgroup("{", x, "")))

results in greek letters, which is not expected here.
That happens if the user tries to set only a left delimeter, the same with:

   text(2, 8, expression(F == bgroup("{", x, ".")))

or

   text(3, 7, expression(F == bgroup(".", x, "}")))

but it works if delimeters are specified, as in:

   text(4, 6, expression(F == bgroup("{", x, ")")))


I don't know whether I have just fixed the symptoms here (Paul ?). 
Anyway, the following fix of  .../src/main/plotmath.c  works as expected.

Uwe Ligges



==========================
(diff'ed to R-1.7.0 patched (2003-05-25))
 >  diff -u ./plotmath.old ./r-patched/src/main/plotmath.c


--- ./plotmath.old     2003-05-25 17:47:23.000000000 +0200
+++ ./r-patched/src/main/plotmath.c     2003-05-25 17:49:38.000000000 +0200
@@ -2075,10 +2075,12 @@
      delim2 = DelimCode(expr, CADDDR(expr));
      bbox = RenderElement(CADDR(expr), 0);
      dist = max(bboxHeight(bbox) - axisHeight, bboxDepth(bbox) + 
axisHeight);
-    bbox = RenderDelim(delim1, dist + extra, draw);
+    if (delim1 != '.')
+        bbox = RenderDelim(delim1, dist + extra, draw);
      bbox = CombineBBoxes(bbox, RenderElement(CADDR(expr), draw));
      bbox = RenderItalicCorr(bbox, draw);
-    bbox = CombineBBoxes(bbox, RenderDelim(delim2, dist + extra, draw));
+    if (delim2 != '.')
+        bbox = CombineBBoxes(bbox,     RenderDelim(delim2, dist + 
extra, draw));
      return bbox;
  }



More information about the R-devel mailing list