Sanjoy Mahajan wrote:
> This test file (beta 2006.09.28):
>
> ============ 1.tex ============================
> \starttext
> \startMPenvironment
> \def\2#1#2{\vbox{\halign{\hfil##\hfil\cr #1\cr #2\cr}}}
> \stopMPenvironment
>
> \startreusableMPgraphic{fig}
> label(btex sun etex, origin);
> \stopreusableMPgraphic
>
> \reuseMPgraphic{fig}
>
> \stoptext
> ========================================
>
> fails with the error:
>
> ! Parameters must be numbered consecutively.
> <to be read again> 
>                    ##
> l.44 \global \loadfontfileoncetrue \def \2##
>                                             1##2{\vbox {\halign {\hfil 
> ####\...
>
>
> 1-mpgraph.mp gets this figure definition:
>
> beginfig(1);
> verbatimtex \global \loadfontfileoncetrue \def \2##1##2{\vbox {\halign {\hfil 
> ####\hfil \cr ##1\cr ##2\cr }}}  etex;
> label(btex  sun etex
> , origin);
> ;
> endfig;
>   
environments are saved in macros, therefore  you end up  in  an argument 
mess



\starttext

\startbuffer[mp]
  \def\2#1#2{\vbox{\halign{\hfil##\hfil\cr #1\cr #2\cr}}}
\stopbuffer

\def\useMPenvironmentbuffer[#1]%
  
{\expanded{\startMPenvironment\noexpand\readfile{\TEXbufferfile{\jobname}}{}{}}\stopMPenvironment}

\useMPenvironmentbuffer[mp]

\startreusableMPgraphic{fig}
label(btex sun etex, origin);
\stopreusableMPgraphic

\reuseMPgraphic{fig}

\stoptext

works ok ; maybe i should add that command to the core but anyhow you 
can wikify it
 
> So the parameters in the definition are being doubled up by one of the
> transformations that inserts the verbatimtex..etex block.  By the way,
> should the verbatimtex..etex block go outside the beginfig..endfig, as
> it would in a standalone MP file?  If only for efficiency rather than MP
> reparsing it with each beginfig.
>
>   
depends, if you process them runtime, it does not matter, if you process 
graphics between runs, they may be some cary over effects, although the 
btex/etex snippets are grouped 

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

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to