ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* MetaPost question
@ 2001-11-17 19:54 Jose Luis Diaz
  2001-11-18  6:18 ` Johannes H?sing
  2001-11-18 11:57 ` Denis B. Roegel
  0 siblings, 2 replies; 4+ messages in thread
From: Jose Luis Diaz @ 2001-11-17 19:54 UTC (permalink / raw)


Hello ConTeXt users,

 Sorry  for posing a question not about ConTeXt, but I realize that in
 this  list there also are people very fluent in Metapost. My question
 is:

 How  can I convert a number in a string, concatenate this string with
 other strings and have TeX to typeset the whole result?

 I.e., suppose that I have an array of numbers:

    pair t[];
    t[1]=3; t[2]=20; t[3]=25;

 For example, these numbers are some points along an abcise axis. Then
 I want to put a big dot at each of these points. Not difficult:

  for i=1 upto 3: draw (0u, t[i]*u) withpen circlepen scaled 4mm;
  endfor;

 But  then  suppose  that  I also want a label below each dot, typeset
 with  TeX,  which  reads:  $t_1=3$,  $t_2=20$,  $t_3=25$. I can't use
 btex/etex  because I want to construct the text $t_1=3$ from the loop
 variable, something like:

  for i=1 upto 3:
    sprintf(string,"$f_%d=%d$",i,t[i]);  %This is not Metapost, obviusly
    label.bot(TEX(string), (0u, t[i]*u)); % This is
  endfor;

  How can be done?

  Thanks.

-- 
  Jose Luis Diaz


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

end of thread, other threads:[~2001-11-18 13:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-17 19:54 MetaPost question Jose Luis Diaz
2001-11-18  6:18 ` Johannes H?sing
2001-11-18 11:57 ` Denis B. Roegel
2001-11-18 13:17   ` Re[2]: " Jose Luis Diaz

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