Re: [NTG-context] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Jeong Dal
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
___


Re: [NTG-context] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Hans Hagen
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
___

Re: [NTG-context] using variable for subscript in math+lua (and math+MetaFun)

2012-10-25 Thread Jeong Dal
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
___