For example I want to pass the string \huge$p_2f_1$

To the macro

vardef macro(expr point, lab)=
    label(btex lab, point);

The btex ... etex tags convert the TeX expression between them into a picture, not a string.

You could use something like this

vardef macro(expr point, lab)=
    label(lab, point);

and then

macro(origin, btex your TeX code etex);

Or, assuming you're using LuaLaTeX and luamplib with the option \mplibtextextlabel{enable}, then the text argument of label is indeed supposed to be a string and you can enter something like this when you use the macro above:

macro(origin, "your TeX code");

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.