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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to