[NTG-context] Labels in MetaPost (MetaObj)

Aditya Mahajan adityam at umich.edu
Sat Jan 22 17:30:10 CET 2011

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.

   path a ;

   a := (0,0) -- (1cm,0) ;

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 

   input metaobj;
   boolean flag; flag := false;

   vardef newSegment@\#=
     if not flag :
       ObjPoint a,b;
       ObjCode "@\#b-@\#a=(1cm,2cm)";
     fi ;

   def drawSegment(suffix n)=
     draw n.a--n.b;
     draw btex \tt \overbar{E} etex shifted n.a; % 1

   ObjLabel.s(btex hello! etex) "labpoint(a)"; % 2
   flag := true ;

@Hans, can we have a `trialtypesetting` for MP code?


More information about the ntg-context mailing list