Quoting nicola <[EMAIL PROTECTED]>:

> Hi,
> the following code
>
> \startMPinclusions
> drawoptions(withpen pencircle scaled 1mm);
> u := 1cm;
> \stopMPinclusions
>
> \startreusableMPgraphic{foo}
> draw origin--(u,u);
> \stopreusableMPgraphic
>
> \starttext
> \midaligned{\reuseMPgraphic{foo}}
> \stoptext
>
> produces a line with default thickness, not 1mm wide. Is this a bug?

No a feature of metapost. beginfig resets drawoptions. Otherwise 
drawoptions from one figure will also affect the output of another 
figure.

> Or > do I misunderstand the purpose of \startMPinclusions (I have assumed
> that it inserts the text verbatim inside each figure definition)?

It inserts text *before* the figure definitions. Have a look at the 
resulting -mpgraph.mp file. The problem is that in metapost beginfig 
resets drawoptions. This is how beginfig is defined

def beginfig(expr c) =
  begingroup
  charcode:=c;
  clearxy; clearit; clearpen;
  pickup defaultpen;
  drawoptions();
  scantokens extra_beginfig;
enddef;

So, you can use
\startMPinclusions
extra_beginfig := "drawoptions(withpen pencircle scaled 1mm)" ;
u := 1cm;
\stopMPinclusions

to override beginfig's redefinitions. I hope that some day there will 
be a overhaul of plain.mp to something more flexible. Metafun provides 
some useful enhancements, but the metapost user interface is still very 
low level.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to