[NTG-context] metafun transformation error

Hans Hagen j.hagen at xs4all.nl
Fri Jun 4 17:28:19 CEST 2021


On 6/4/2021 5:08 PM, Ajith R wrote:
> Hi,
> 
> 
>> here a ; is missing after the q
> 
> That was a silly mistake while making the MWE.
> When I corrected it, the MWE compiled correctly. However, the original code didn't have that error and wouldn't compile.
> So, I tried another MWE and found out what was causing the error.
> In the array I defined, there were two elements with empty string as their value. Once I changed those empty strings to some valid string, there was no error and the file compiled as expected. Here is the new MWE with one array element defined as empty string
> 
> \starttext
> \switchtobodyfont[30pt]
> \startMPpage
> StartPage ;
> unit := 2 * cm ;
> %numeric lm, row, col, bm;
> pairĀ  middle;
> row := 1; col := 1;
> picture p, q ; p := nullpicture; q := nullpicture;
> 
> 
> string l[], lbl;
> l[0] := "" ; l[1]:= "2";
> 
> 
> for i= 0 upto row:
> middle := 0.5[((( i * unit) ), ((2 * unit))), ((((i+1) * unit) ), ((2 * unit) ))];
> lbl := l[i];
> p := thelabel(lbl, middle);
> q := p reflectedabout (0.5[urcorner p, ulcorner p], 0.5[lrcorner p, llcorner p]);
> draw q;
> 
> 
> endfor
> StopPage ;
> \stopMPpage
> \stoptext
> 
> 
> This will throw an error. If l[0] is defined as, say, "hi", there is no error
> 
> I suppose, my work around would be to use a non empty string and then fill that cell dark. Is there another way?
> 
> Anyway, thanks for your prompt replies and patience.
> 
> Thanks a ton for sharing your efforts with the world
you canot reflect about zero dimensions:

     p := thetextext(lbl, middle);
     message(0.5[urcorner p, ulcorner p]);
     if llcorner p <> urcorner p :
         q := p reflectedabout (0.5[urcorner p, ulcorner p], 
0.5[lrcorner p, llcorner p]);
         draw q;
     fi

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------


More information about the ntg-context mailing list