[metapost] drawdblarrow and if b0rked?

Hans Hagen pragma at wxs.nl
Thu Aug 28 11:42:17 CEST 2008


Giuseppe Bilotta wrote:
> Hello,
> 
> I'm attaching to this email a file that used to compile with
> metapost. I'm not sure at what upgrade it got borked because
> I haven't been compiling it in a while but now the
> 
>   drawdblarrow subpath (.11, .90) of ((cinf+i*h, markbase) -- (cinf+(i+1)*h, prevmarkbase)) if i = 2: withcolor red elseif i=parts-2: withcolor blue fi;
> 
> line causes metapost to choke on withcolor.red.elseif,
> complaining about the extra elseif.
> 
> Suggestions?

     path p; p := fullcircle scaled 10cm ;
     numeric i, parts ; i = 1 ; parts = 4 ;
     drawdblarrow p withcolor if i = 2: red elseif i=parts-2: blue else: 
nocolor fi;
     numeric i, parts ; i = 2 ; parts = 5 ;
     drawdblarrow p if i = 2: withcolor red elseif i=parts-2: withcolor 
blue fi;
%     drawdblarrow p withcolor if i = 2: red elseif i=parts-2: blue 
else: nocolor fi;

even gives me

! A statement can't begin with `right delimiter that matches ('.

so there is something fishy


for the moment use;

drawdblarrow p withcolor if i = 2: red elseif i=parts-2: blue else: 
nocolor fi;

i.e. move withcolor upfront and use nocolor as catch


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


More information about the metapost mailing list