From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/3889 Path: main.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: Labeling of axes Date: Sun, 28 Jan 2001 20:03:47 +0100 Sender: owner-ntg-context@let.uu.nl Message-ID: <3.0.6.32.20010128200347.0093cb40@server-1> References: <3.0.6.32.20010117173850.007a2bd0@pop.wxs.nl> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: main.gmane.org 1035394597 21011 80.91.224.250 (23 Oct 2002 17:36:37 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 23 Oct 2002 17:36:37 +0000 (UTC) Cc: ntg-context@ntg.nl Original-To: walter kehowski In-Reply-To: <3A71E135.7F3F95E1@gcmail.maricopa.edu> Xref: main.gmane.org gmane.comp.tex.context:3889 X-Report-Spam: http://spam.gmane.org/gmane.comp.tex.context:3889 At 01:42 PM 1/26/01 -0700, walter kehowski wrote: >ConTeXtnicians, > >This is a MetaPost question, not a ConTeXt question, per se. Does anybody know >how to use a for loop to label axes and, secondly, how to pass paramters to a >metapost file? > >For example, > >numeric u; u=1.0cm; >for i=-10 upto 10: >if not(i=0) lablel.lft(btex $i$ etex, (i,0)*u); fi; >endfor; > >does not work. Any suggestions? This is indeed a problem, since metapost only sees one btex/etex here and not obe for every loop. This is why in context you can use the textext macro: beginfig(1) ; numeric u ; u = 1.0cm ; for i=-10 upto 10 : if not (i=0) : draw textext.lft("$" & decimal i & "$") shifted (i*u,0) ; fi ; endfor; endfig ; end given that you have configured texexec well: texexec --mptex thisfile.mp mptopdf thisfile.1 will give you a nice axis (beware if you look into gs: mptopdf does not overwrite an open file). [there are a few more text related tricks; also, i'm working on a module for drawing axis etc] Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com -------------------------------------------------------------------------