From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/24742 Path: news.gmane.org!not-for-mail From: David Arnold Newsgroups: gmane.comp.tex.context Subject: Re: Passing text to Metapost functions Date: Mon, 26 Dec 2005 10:04:02 -0800 Message-ID: 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 (Apple Message framework v746.2) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1135620564 8752 80.91.229.2 (26 Dec 2005 18:09:24 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 26 Dec 2005 18:09:24 +0000 (UTC) Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 26 19:09:22 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 1Eqwmg-0001ag-LO for gctc-ntg-context-518@m.gmane.org; Mon, 26 Dec 2005 19:09:22 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 42B641279D; Mon, 26 Dec 2005 19:09:22 +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 30078-05; Mon, 26 Dec 2005 19:09:21 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 4B1FB1279B; Mon, 26 Dec 2005 19:05:25 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 5ABDA1279B for ; Mon, 26 Dec 2005 19:05:23 +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 30152-01 for ; Mon, 26 Dec 2005 19:05:22 +0100 (CET) Original-Received: from fed1rmmtao01.cox.net (fed1rmmtao01.cox.net [68.230.241.38]) by ronja.ntg.nl (Postfix) with ESMTP id BEB4F12799 for ; Mon, 26 Dec 2005 19:05:21 +0100 (CET) Original-Received: from [10.0.1.2] (really [70.191.56.23]) by fed1rmmtao01.cox.net (InterMail vM.6.01.05.02 201-2131-123-102-20050715) with ESMTP id <20051226180433.NIXG15695.fed1rmmtao01.cox.net@[10.0.1.2]> for ; Mon, 26 Dec 2005 13:04:33 -0500 In-Reply-To: <43AFD7AB.7020607@wxs.nl> Original-To: mailing list for ConTeXt users X-Mailer: Apple Mail (2.746.2) 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:24742 Archived-At: 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: