1

In label.top("foo", origin), top is label suffix. Can I pass label suffix by function call? Given suffix qqaa:

vardef (suffix qqaa)foo (expr ...)
  label.qqaa("whatever", origin);
enddef;

I don't know where (suffix qqaa) should put in function. And I don't know how to call foo to pass the label suffix.

We can define a variable in vardef, e.g., vardef foo (expr ..., position). Then judge position by if else and give right suffix to label. But it will be much more convenient if we can directly pass label suffix.

The purpose is to give flexibility to user to define label position outside core function.

  • Did you look at the definition of the label function in plain.mp? Could you just extend it to take a new suffix, maybe auto, and then do your automatic positioning logic? What exactly are you trying to do? – Thruston Dec 13 '17 at 15:51
  • If all you want is to be able to move your labels a bit more than the usual amount, you could write label("whatever", z0 shifted (a,b)). – Thruston Dec 13 '17 at 15:53
  • 1
    You might also like to read the discussion about developing a free label macro in the Metafun manual. Section 13.2. – Thruston Dec 13 '17 at 16:02
  • @ Thruston function thefreelabel in Metafun is what I want. Learn some how to define intersection point. Thank you. – warem Dec 14 '17 at 3:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.