On Sat, 22 Jan 2011, Stefan Müller wrote:
So its either using text or using metaobj? Too bad, metaobj is quite fun... I
still hope you guys can fix this, but it's not urgent (to me).
Anyway, what does the [+] after
\startMPinclusions? I did not find documentation for that on the wiki.
\startMPinclusions
path a ;
\stopMPinclusions
\startMPinclusions
a := (0,0) -- (1cm,0) ;
\stopMPinclusions
will fail, because the second inclusions overwrites the first. If you use
[+], then the second inclusions in appended after the first.
Just as a wild guess I tested the example below today, trying to make use of
the things Aditya said, but to no avail.
The trick is to ensure that the offending code (assignObj) is not run
twice.
\startMPinclusions[+]
input metaobj;
boolean flag; flag := false;
\stopMPinclusions
\startMPdefinitions
vardef newSegment@\#=
if not flag :
assignObj(@\#,"Segment");
ObjPoint a,b;
ObjCode "@\#b-@\#a=(1cm,2cm)";
fi ;
enddef;
def drawSegment(suffix n)=
draw n.a--n.b;
draw btex \tt \overbar{E} etex shifted n.a; % 1
enddef;
\stopMPdefinitions
\starttext
\startMPpage
newSegment.s;
ObjLabel.s(btex hello! etex) "labpoint(a)"; % 2
s.a=origin;
drawObj(s);
flag := true ;
\stopMPpage
\stoptext
@Hans, can we have a `trialtypesetting` for MP code?
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________