From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24745 Path: news.gmane.org!not-for-mail From: Willi Egger Newsgroups: gmane.comp.tex.context Subject: Re: Passing text to Metapost functions Date: Mon, 26 Dec 2005 21:03:55 +0100 Message-ID: <43B04CAB.7010201@boede.nl> References: <8B3296E7-0060-4D06-84AE-C3A5816A4F5E@cox.net> <43AFD7AB.7020607@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1135627448 28146 80.91.229.2 (26 Dec 2005 20:04:08 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Dec 2005 20:04:08 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 26 21:04:06 2005 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by ciao.gmane.org with esmtp (Exim 4.43) id 1EqyZe-0004Oy-Pa for gctc-ntg-context-518@m.gmane.org; Mon, 26 Dec 2005 21:04:02 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 95360127DB; Mon, 26 Dec 2005 21:04:01 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31115-05; Mon, 26 Dec 2005 21:03:55 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8871612799; Mon, 26 Dec 2005 21:03:55 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 8D87C12799 for ; Mon, 26 Dec 2005 21:03:54 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 31273-01 for ; Mon, 26 Dec 2005 21:03:53 +0100 (CET) Original-Received: from smtp-vbr7.xs4all.nl (smtp-vbr7.xs4all.nl [194.109.24.27]) by ronja.ntg.nl (Postfix) with ESMTP id 8E60312783 for ; Mon, 26 Dec 2005 21:03:53 +0100 (CET) Original-Received: from [192.168.0.193] (a80-126-172-1.adsl.xs4all.nl [80.126.172.1]) (authenticated bits=0) by smtp-vbr7.xs4all.nl (8.13.3/8.13.3) with ESMTP id jBQK3rVT055366 for ; Mon, 26 Dec 2005 21:03:53 +0100 (CET) (envelope-from w.egger@boede.nl) User-Agent: Mozilla Thunderbird 1.0.7 (Windows/20050923) X-Accept-Language: en-us, en Original-To: mailing list for ConTeXt users In-Reply-To: X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.5 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:24745 Archived-At: Hi David, Put the "x" into a variable: \setMPtext{1}{x} you can define the \stetMPtext within the \starttext \stoptext or outside Call create_axes(xmin,xmax,ymin,ymax,ux,uy)(\MPbetex{1}); Willi David Arnold wrote: > Hans, > > I've tried various things without much success. I cannot seem to > access the contents of xlbl below. > > Is this approach ever going to work? > > Note: I am trying to pass the string "x" to the parameter xlbl. > > %output=pdf > > \setupcolors[state=start] > > \definecolor[gridlines][s=0.7] > > \startMPinclusions > > color gridlines; gridlines:=\MPcolor{gridlines}; > > vardef create_grid(expr xxmin,xxmax,xxscl,yymin,yymax,yyscl,uux,uuy)= > for k=xxmin step xxscl until xxmax: > draw (xmin*uux,k*uuy)--(xmax*uux,k*uuy) withcolor \MPcolor > {gridlines}; > draw (k*uux,ymin*uuy)--(k*uux,ymax*uuy) withcolor \MPcolor > {gridlines}; > endfor; > enddef; > > vardef create_axes (expr xxmin,xxmax,yymin,yymax,uux,uuy) (text xlbl) = > drawdblarrow (1.05*xxmin*uux,0)--(1.05*xxmax*uux,0); > draw textext.origin(\MPstring{xlbl}); > drawdblarrow (0,1.05*yymin*uuy)--(0,1.05*yymax*uuy); > enddef; > > \stopMPinclusions > > > \starttext > > \startMPpage > > %initialize window parameters > numeric xmin, xmax, xscl, ymin, ymax, yscl; > xmin:=-5; > xmax:=5; > xscl:=1; > ymin:=-5; > ymax:=5; > yscl:=1; > > %initialize scale > numeric ux, uy; > (xmax-xmin)*ux=4in; (ymax-ymin)*uy=3in; > > %create the grid > create_grid(xmin,xmax,xscl,ymin,ymax,yscl,ux,uy); > > %create the axes > create_axes(xmin,xmax,ymin,ymax,ux,uy)(x); > > \stopMPpage > > \stoptext > > %%% Local Variables: > %%% mode: conTeXt-en > %%% End: > _______________________________________________ > ntg-context mailing list > ntg-context@ntg.nl > http://www.ntg.nl/mailman/listinfo/ntg-context