[NTG-context] Labels in MetaPost (MetaObj)

Stefan Müller warrence.stm at gmx.de
Sun Jan 23 13:25:03 CET 2011


On 23.01.2011 12:40, Stefan Müller wrote:
> On 22.01.2011 17:30, Aditya Mahajan wrote:
>> 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.
>
> Thank you for the explanation. So if I only have one "inclusions
> section" it doesn't matter?
>
>>> 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.
>
> Your example works perfect. Many thanks for that as well. I didn't
> realize, that assignObj is causing the trouble, but now it's obvious.
> I'm just curious: the MP-code is only run twice by context if it
> contains labels, right? Otherwise I don't understand why the assignObj
> isn't always failing.

Sorry for double posting... The method with "if not flag" is a bit 
arkward, because assignObj isn't the only problem. "rotateObj(s, 90)" 
would rotate the object 180 degrees instead of 90; when defining the 
relation between several objects some equations may became redundant (my 
script is rather complex and I'm not sure why some of the equations 
cause trouble).

Stefan


More information about the ntg-context mailing list