[NTG-context] \sometxt in staticMPfigure
Hans Hagen
pragma at wxs.nl
Tue Sep 26 22:11:59 CEST 2006
Sanjoy Mahajan wrote:
>> you can test the beta
>>
>
> This gives the clearboxes error:
>
> =================== box.tex ===================
> \startMPinclusions
> input boxes
> \stopMPinclusions
>
> \starttext
> \startstaticMPfigure{fig}
> boxit.h(btex h etex);
> drawboxed(h);
> \stopstaticMPfigure
> \usestaticMPfigure[fig]
> \stoptext
> =====================================
>
> The cause is that it produces this intermediate mp file:
>
> ========= box-fig.mp ===============
> input boxes
> boxit.h(btex h etex);
> drawboxed(h);
> ===================================
>
> This fails because all three lines go into a beginfig..endfig and
> metapost fails. That may be a metapost bug in this case, but for
> robustness I think it should become:
>
> input boxes
> beginfig(1)
> boxit.h(btex h etex);
> drawboxed(h);
> endfig;
> end
>
> In order to do that transformation, box-fig.mp would need separate
> sections for the inclusions and for the main figure code.
>
> Am I using inclusions incorrectly? i.e. Should I instead use
> MPextensions to get material placed at the top of the metapost file
> for use by all figures? Like this:
>
> =============== box-e.tex ================
> \startMPextensions
> input boxes
> \stopMPextensions
>
> \starttext
> \startstaticMPfigure{fig}
> boxit.h(btex h etex);
> drawboxed(h);
> \stopstaticMPfigure
> \usestaticMPfigure[fig]
> \stoptext
> =======================================
>
> But that produces
>
> (texexec-mpgraph.mp
> >> boxit.h
> ! Isolated expression.
> <to be read again>
> (
> l.148 boxit.h(
> btex h etex
> ?
>
> because the added extensions ('input boxes') are not included in
> texexec-mpgraph.mp.
>
the problem (if you look into the mp file) is that there is *no*
beginfig; this is because we now use a more stupid (stripped down)
variant of saving the graphic.
\startstaticMPfigure{fig}
beginfig(1);
boxit.h(btex h etex);
drawboxed(h);
endfig;
\stopstaticMPfigure
i'll add the b/e to the main macro.
-----------------------------------------------------------------
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 ntg-context
mailing list