ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Passing text to Metapost functions
@ 2005-12-26  3:34 David Arnold
  2005-12-26 11:44 ` Hans Hagen
  0 siblings, 1 reply; 8+ messages in thread
From: David Arnold @ 2005-12-26  3:34 UTC (permalink / raw)


All,

I'd like to do something like this:

create_axes(xmin,xmax,ymin,ymax,ux,uy)(x);

Where x will be a label for my x-axis. But once in a while it might  
be t or u or some other thing such as "Days."

I want to use it like this:

beginfig(0);

%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-axes function
vardef create_axes(expr xxmin, xxmax, yymin, yymax, uux, uuy)(text  
xlbl)=
   drawdblarrow (1.05*xxmin*uux,0)--(1.05*xxmax*uux,0);
   label.rt(btex $xlbl$, (1.05*xxmax*uux,0));
   drawdblarrow (0,1.05*yymin*uuy)--(0,1.05*yymax*uuy);
enddef;

create_axes(xmin,xmax,ymin,ymax,ux,uy)(x);

endfig;

end.

Two questions:

1. How can I do this in plain metapost?

2. What would be the "Context Way?"

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-12-27  8:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-26  3:34 Passing text to Metapost functions David Arnold
2005-12-26 11:44 ` Hans Hagen
2005-12-26 18:04   ` David Arnold
2005-12-26 20:03     ` Willi Egger
2005-12-26 21:17       ` David Arnold
2005-12-27  8:09     ` Taco Hoekwater
2005-12-27  8:24       ` David Arnold
2005-12-27  8:58         ` Taco Hoekwater

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