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: Draw grid
Date: Sat, 03 Jan 2004 22:13:52 +0100	[thread overview]
Message-ID: <6.0.1.1.2.20040103221155.01e76ec0@localhost> (raw)
In-Reply-To: <3.0.5.32.20040102103448.00984d20@mail.northcoast.com>

Hi David,

I added to mp-tool:

% showgrid(-5,10,1cm,-10,10,1cm);

def showgrid (expr MinX, MaxX, DeltaX, MinY, MaxY, DeltaY)=
   begingroup
     save defaultfont, defaultscale, size ;
     string  defaultfont  ; defaultfont  := "cmtt10"; % i.e. infofont
     numeric defaultscale ; defaultscale := 8pt / fontsize defaultfont;
     numeric size         ; size         := 2pt ;
     for x=MinX upto MaxX :
       for y=MinY upto MaxY :
         draw (x*DeltaX, y*DeltaY)
           withpen pencircle scaled
           if (x mod 5 = 0) and (y mod 5 = 0) :
             1.5size withcolor .50white
           else :
                size withcolor .75white
           fi ;
       endfor ;
     endfor ;
     for x=MinX upto MaxX:
       label.bot(decimal x, (x*DeltaX,-size));
     endfor ;
     for y=MinY upto MaxY:
       label.lft(decimal y, (-size,y*DeltaY)) ;
     endfor ;
   endgroup
enddef;

I also send you a supp-pdf that does not fail on you example (peculiar 
sequence of settings catched)

Hans  

      reply	other threads:[~2004-01-03 21:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-02 18:34 David Arnold
2004-01-03 21:13 ` Hans Hagen [this message]

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=6.0.1.1.2.20040103221155.01e76ec0@localhost \
    --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).