* Re: using variable for subscript in math+lua (and math+MetaFun)
@ 2012-10-25 11:59 Jeong Dal
2012-10-25 13:24 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Jeong Dal @ 2012-10-25 11:59 UTC (permalink / raw)
To: ntg-context
Dear Gesang and Hans,
Your solution is working nicely.
I may use lua to simplify my other work.
I'd like to ask you one more thing.
I tried to write a matrix using MetaFun to add some graphics as following:
label(btex $a_{11}$ etex, ( , ));
label(btex $a_{12}$ etex, ( , ));
label(btex $a_{13}$ etex, ( , ));
…
label(btex $a_{3,3}$ etex, ( , ));
Since the same command is repeated, I tested to use "for" iteration.
But I couldn't succeed. It is OK to use the variable as a text but I couldn't find a way to use a variable as a subscript.
For example,
for i=1 unto 3: label(btex decimal(i) etex, (x,y)); endfor;
is OK. But,
for i=1 upto 3: label(btex $a_{i}$ etex, (x,y)); endfor;
or
for i=1 upto 3: label(btex $a_{deciaml(i)}$ etex, (x,y)); endfor;
are not working as I wanted.
Is there a way to use variable as a subscript in "label"?
Thank you again.
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
* Re: using variable for subscript in math+lua (and math+MetaFun)
2012-10-25 11:59 using variable for subscript in math+lua (and math+MetaFun) Jeong Dal
@ 2012-10-25 13:24 ` Hans Hagen
2012-10-25 14:15 ` Jeong Dal
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2012-10-25 13:24 UTC (permalink / raw)
To: mailing list for ConTeXt users; +Cc: Jeong Dal
On 25-10-2012 13:59, Jeong Dal wrote:
> Dear Gesang and Hans,
>
> Your solution is working nicely.
> I may use lua to simplify my other work.
>
> I'd like to ask you one more thing.
>
> I tried to write a matrix using MetaFun to add some graphics as following:
>
> label(btex $a_{11}$ etex, ( , ));
> label(btex $a_{12}$ etex, ( , ));
> label(btex $a_{13}$ etex, ( , ));
> …
> label(btex $a_{3,3}$ etex, ( , ));
>
> Since the same command is repeated, I tested to use "for" iteration.
> But I couldn't succeed. It is OK to use the variable as a text but I couldn't find a way to use a variable as a subscript.
>
> For example,
>
> for i=1 unto 3: label(btex decimal(i) etex, (x,y)); endfor;
>
> is OK. But,
>
> for i=1 upto 3: label(btex $a_{i}$ etex, (x,y)); endfor;
> or
> for i=1 upto 3: label(btex $a_{deciaml(i)}$ etex, (x,y)); endfor;
>
> are not working as I wanted.
>
> Is there a way to use variable as a subscript in "label"?
play with code like this
\starttext
\startluacode
context.startMPcode()
for i=1,10 do
for j=1,10 do
context('draw (%scm,%scm) withpen pencircle scaled 2mm
;',i,j)
context('draw
thetextext.top("\\tt%s,%s",(%scm,%scm+2mm)) ;',i,j,i,j)
end
end
context.stopMPcode()
\stopluacode
\stoptext
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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: using variable for subscript in math+lua (and math+MetaFun)
2012-10-25 13:24 ` Hans Hagen
@ 2012-10-25 14:15 ` Jeong Dal
0 siblings, 0 replies; 3+ messages in thread
From: Jeong Dal @ 2012-10-25 14:15 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
Dear Hans,
The structure of your code is very interesting.
((((MP code) inside ConTeXt) inside Lua) inside ConTeXt) again!
It is really useful.
Thank you.
Best regards,
Dalyoung
>
> play with code like this
>
> \starttext
>
> \startluacode
> context.startMPcode()
> for i=1,10 do
> for j=1,10 do
> context('draw (%scm,%scm) withpen pencircle scaled 2mm
> ;',i,j)
> context('draw
> thetextext.top("\\tt%s,%s",(%scm,%scm+2mm)) ;',i,j,i,j)
> end
> end
> context.stopMPcode()
> \stopluacode
>
> \stoptext
>
___________________________________________________________________________________
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:[~2012-10-25 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-25 11:59 using variable for subscript in math+lua (and math+MetaFun) Jeong Dal
2012-10-25 13:24 ` Hans Hagen
2012-10-25 14:15 ` Jeong Dal
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).