From: dalyoung <haksan@me.com>
To: ntg-context@ntg.nl
Subject: change numeral to string in Metafun
Date: Wed, 14 Jul 2010 09:19:54 +0900 [thread overview]
Message-ID: <0FC17593-3EC9-4548-8609-E057E352D2E4@me.com> (raw)
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
___________________________________________________________________________________
next reply other threads:[~2010-07-14 0:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-14 0:19 dalyoung [this message]
2010-07-14 0:31 ` Wolfgang Schuster
2010-07-14 10:35 Jeong Dalyoung
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=0FC17593-3EC9-4548-8609-E057E352D2E4@me.com \
--to=haksan@me.com \
--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).