[metapost] Possible bug with boxit

Laurence Finston Laurence.Finston at gmx.de
Tue Feb 22 23:41:59 CET 2022


In the attached MP file, I use macros from boxes.mp.  It doesn't fail to call boxit outside of a figure, but it doesn't produce the expected result (at least, the one I expected):  If I call it outside of a figure but not within the figure, I get this error when I call drawunboxed:

>> sproc_.C
! Not a string.
<to be read again>
                   (
<for(C)> scantokens.sproc_(SUFFIX0)(
                                    (SUFFIX0)); ENDFOR
fixsize->...$=(TEXT2):scantokens.sproc_$($);endfor
                                                  .endgroup
drawunboxed->fixsize((TEXT0))
                             ;fixpos((TEXT0));forsuffixes.s=(TEXT0):draw.pic...
l.290   drawunboxed(C)
                      ;
?

If I call it outside the figure and then inside it, I get this error:

! Redundant equation.
<to be read again>
                   ;
boxit->...FIX2)sw)=ypart((SUFFIX2)se-(SUFFIX2)sw);
                                                  0=xpart((SUFFIX2)ne-(SUFFI...
l.273   boxit.C(V67)
                    ;  %% boxit must be called here in order for drawunboxed...

?

If I call it in figure 0 and don't call it in the following figure (100), I get the following error when I call bpath in fig. 100:

>> sproc_.C
! Not a string.
<to be read again>
                   (
<for(C)> scantokens.sproc_(SUFFIX0)(
                                    (SUFFIX0)); ENDFOR
fixsize->...$=(TEXT2):scantokens.sproc_$($);endfor
                                                  .endgroup
bpath->begingroup.fixsize((SUFFIX2))
                                    ;fixpos((SUFFIX2));scantokens.pproc_(SUF...
<to be read again>
                   ;
l.326   undraw bpath(C);

?

If I call boxit in both figures and not outside them, it works and the following two files are output:

ttemp000.eps .. ttemp100.eps

I didn't find any indication in mpboxes.pdf that the variables created by boxit would be local to an enclosing figure and I wouldn't have expected this behavior.

Is this a bug?

Thanks,

Laurence
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ttemp.mp
Type: application/octet-stream
Size: 9723 bytes
Desc: not available
URL: <https://tug.org/pipermail/metapost/attachments/20220222/d949d991/attachment.obj>


More information about the metapost mailing list.