ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* change numeral to string in Metafun
@ 2010-07-14  0:19 dalyoung
  2010-07-14  0:31 ` Wolfgang Schuster
  0 siblings, 1 reply; 3+ messages in thread
From: dalyoung @ 2010-07-14  0:19 UTC (permalink / raw)
  To: ntg-context

Dear all,

I'd like to draw boxes with a label in a certain rule.
I define drawbox macro for it.
It receives 3 numbers, (the height of box, x position, y position).
I'd like to label the height of the box in the middle of the box.

I tired 
 label( h ,(3s*u+u, t*u + h*u/2)); %h is a received numeral.
But it is not working. If I change h to "letter" in label command, it is working.

So, I'd like to know how to put received numeral(the height of the box) as a label.
Or, how to change the value of a variable to a string.

Here is a working sample code.

\startuseMPgraphic{sample}
numeric u;
u := 0.5cm;

def drawbox (expr h, s, t) =
%numeric h,s,t;
draw unitsquare xyscaled (1cm, h*u) shifted (3*s*u, t*u);
label("1",(3s*u+u, t*u + h*u/2));
enddef;

drawbox (3, 0, 0); 
drawbox (6, 0, 3); 
drawbox (2, 1, 0); 
drawbox (1, 1, 2); 
drawbox (3, 2, 0) 
drawbox (4, 2, 3)

\stopuseMPgraphic

\starttext
\placefigure[here][]{sample}
{\useMPgraphic{sample}}

\stoptext


Thank you.
Dalyoung
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: change numeral to string in Metafun
  2010-07-14  0:19 change numeral to string in Metafun dalyoung
@ 2010-07-14  0:31 ` Wolfgang Schuster
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfgang Schuster @ 2010-07-14  0:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Am 14.07.10 02:19, schrieb dalyoung:
> Dear all,
>
> I'd like to draw boxes with a label in a certain rule.
> [...]
>
> So, I'd like to know how to put received numeral(the height of the box) as a label.
> Or, how to change the value of a variable to a string.
>
> [...]
>
> label("1",(3s*u+u, t*u + h*u/2));
>    
label(decimal h,(3s*u+u, t*u + h*u/2));

or

label(textext(decimal h),(3s*u+u, t*u + h*u/2));

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: change numeral to string in Metafun
@ 2010-07-14 10:35 Jeong Dalyoung
  0 siblings, 0 replies; 3+ messages in thread
From: Jeong Dalyoung @ 2010-07-14 10:35 UTC (permalink / raw)
  To: ntg-context

Dear Wolfgang,

It is nicely working.
Thank you for your help.

best regards,

Dalyoung
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2010-07-14 10:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-14  0:19 change numeral to string in Metafun dalyoung
2010-07-14  0:31 ` Wolfgang Schuster
2010-07-14 10:35 Jeong Dalyoung

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