ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* drawoptions in \startMPinclusions
@ 2007-06-14 16:36 nicola
  2007-06-14 18:08 ` drawoptions in startMPinclusions Aditya Mahajan
  0 siblings, 1 reply; 2+ messages in thread
From: nicola @ 2007-06-14 16:36 UTC (permalink / raw)
  To: ntg-context

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

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: drawoptions in startMPinclusions
  2007-06-14 16:36 drawoptions in \startMPinclusions nicola
@ 2007-06-14 18:08 ` Aditya Mahajan
  0 siblings, 0 replies; 2+ messages in thread
From: Aditya Mahajan @ 2007-06-14 18:08 UTC (permalink / raw)
  To: ntg-context

Quoting nicola <vitacolo@dimi.uniud.it>:

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-06-14 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-14 16:36 drawoptions in \startMPinclusions nicola
2007-06-14 18:08 ` drawoptions in startMPinclusions Aditya Mahajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).