For example I want to pass the string \huge$p_2f_1$
To the macro
vardef macro(expr point, lab)=
label(btex lab, point);
enddef;
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this communityThe 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);
enddef;
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");