Hi, I want to define a macro in MetaPost which does: def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y)); where t in btex ... text is replaced by the argument. How to do so? Tobias
On Wed, 2 May 2007, Tobias Burnus wrote:
Hi,
I want to define a macro in MetaPost which does:
def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y));
where t in btex ... text is replaced by the argument. How to do so?
You can do that using TEX.mp. I remember that it is also possible to use textext to do something like this. I need to check my files to see if I have an example. Aditya
On Wed, 2 May 2007, Aditya Mahajan wrote:
On Wed, 2 May 2007, Tobias Burnus wrote:
Hi,
I want to define a macro in MetaPost which does:
def myfunc (expr x,y)(text t) = draw thelabel.rt (btex You passed \quotation{t} etex, (x,y));
where t in btex ... text is replaced by the argument. How to do so?
You can do that using TEX.mp. I remember that it is also possible to use textext to do something like this. I need to check my files to see if I have an example.
Here is a working solution. \starttext \forceMPTEXcheck{myfunc} \startMPinclusions def myfunc (expr x,y) (text t) = label.rt (textext("You passed \quotation{" & t & "}"), (x,y)) enddef; \stopMPinclusions \startMPpage myfunc (0,0) ("Hello") ; myfunc (2cm,1cm) ("World") ; \stopMPpage \stoptext Aditya
participants (2)
-
Aditya Mahajan
-
Tobias Burnus