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? Or do I misunderstand the purpose of \startMPinclusions (I have assumed that it inserts the text verbatim inside each figure definition)? I am using ConTeXt ver: 2007.01.12 15:56 MKII fmt: 2007.6.8 int: english/english Nicola
Quoting nicola
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
participants (2)
-
Aditya Mahajan
-
nicola