ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Cc: ntg-context@ntg.nl
Subject: Re: Labeling of axes
Date: Sun, 28 Jan 2001 20:03:47 +0100	[thread overview]
Message-ID: <3.0.6.32.20010128200347.0093cb40@server-1> (raw)
In-Reply-To: <3A71E135.7F3F95E1@gcmail.maricopa.edu>

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
-------------------------------------------------------------------------


  reply	other threads:[~2001-01-28 19:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-01-17 16:38 Just testing Pierre Goossens
2001-01-26 20:42 ` Labeling of axes walter kehowski
2001-01-28 19:03   ` Hans Hagen [this message]
2001-01-29 15:46     ` Ed L Cashin
2001-01-29 17:32       ` Hans Hagen
2001-01-29 16:13     ` Marc van Dongen
2001-01-29 17:29       ` Hans Hagen
     [not found]         ` <3A769CBD.F164433E@econ.muni.cz>
2001-01-30 12:33           ` Bug in XML + Fields? Hans Hagen
2003-08-24 19:29     ` Labeling of axes Christopher Creutzig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3.0.6.32.20010128200347.0093cb40@server-1 \
    --to=pragma@wxs.nl \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).