[metapost] [rfe] nesting beginfig

Hans Hagen pragma at wxs.nl
Wed Feb 21 09:03:28 CET 2007


Stephan Hennig wrote:
> Hi,
>
> inside beginfig(k)...endfig I want to output an additional figure that
> is not related to k.  I tried nesting beginfig, but that doesn't work.
> What's output in the outer figure before the inner figure is opened is
> simply lost.  What's output after closing the inner figure is added to
> the inner figure, currently.
>
> Would it be hard to make nesting figures possible in MetaPost?
>
> Best regards,
> Stephan Hennig
>
>
> beginfig(1);
>   draw (0,0)--(100,100);% Belongs to fig.1, but is lost.
>   beginfig(2);
>     draw (0,50)--(100,50) withcolor red;% Belongs to fig.2.
>   endfig;
>   draw (0,100)--(100,0);% Belongs to fig.2, but should go on fig.1.
> endfig;
> end
> _______________________________________________
>   
i have no time to look into it now, but it's a matter of macros; take a look at the definitions of beginfig/endfig .... you can shipout graphics 
anytime but you need to make sure that the number gets right 

shipout currentpicture

keep in mind that endfig does this but also may add things to currentpicture before shipping 

Hans 

-----------------------------------------------------------------
                                          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