[NTG-context] MetaObj with labels in built-in objects (MetaObj Standard Library)

Stefan Müller warrence.stm at gmx.de
Tue Sep 20 15:25:38 CEST 2011


Hi list,

some time ago I posted on this list about problems with MetaObj in 
ConTeXt when using labels.  There's a wiki article about this now [1]. 
Just recently I was forced to notice that this solution does not work 
when the label to be drawn is part of the object definition.  So the 
example from [1] works fine with the added boolean flag, but the 
following example (which means basically all built-in MetaObj objects 
with text) does not.  It compiles well but there is no text.

--8<--------------------start--------------------8<--
\startMPinclusions[+]
	input metaobj;
	boolean firstrun; firstrun := true;
\stopMPinclusions

\startMPpage
	if firstrun:
		newBox.a(\sometxt{Text});
		a.c = origin;
	fi;
	drawObj(a);
	firstrun := false;
\stopMPpage
-->8--------------------stop-------------------->8--

I'm out of ideas how to fix this.  I tried putting the text into a 
separate pictrue variable and use this in "newBox".  In addition, I 
thought it should be possible to modify metaobj.mp to check for a 
boolean variable (e.g. "firstrun") and let the macros there react to its 
value accordingly , but I always got either no text or errors.

I can draw the picture I wanted to get in the first place with plain 
MetaFun, but I thought MetaObj would be even more "fun".  Now I'm very 
curious if someone on this list can come up with something.  I think it 
would be great if MetaObj could be fully used within ConTeXt.

Thanks in advance for taking the time to think about this and any hints!
Kind regards,
Stefan.


[1] http://wiki.contextgarden.net/MetaObj_and_Labels


More information about the ntg-context mailing list