Possible bug with boxit

Laurence Finston <[email protected]> Tue, 22 Feb 2022 23:41:59 +0100
Newsgroups gmane.comp.tex.metapost
Message-ID <trinity-88218480-3076-4630-aae9-8978a38fd544-1645569719485@3c-app-gmx-bs07>
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

--
http://tug.org/metapost/
ttemp.mp (application/octet-stream, 9.5 KB) - not displayed