Dear Proch?zka Luk?? Ing and Hans,

Thank you for the reply.

It works fine.

I modify your code to write a matrix and it also works too.

\startformula
\startluacode
local NC, NR = context.NC, context.NR
local t = {{1,0,3,4},{0,2,-2,5},{0,0,1,2}}
context.startmatrix() --"{left={\left (\,},right={\,\right)}}")
for _, r in ipairs(t) do
for _, c in ipairs(r) do
NC()
context(c)
end
NR()
end
context.stopmatrix()
\stopluacode
\stopformula

But I couldn't put "( )" before and after matrix.
If I use
context.startmatrix("{left={\left (\,},right={\,\right)}}")
then it wrote "left…" as text before the matrix.

How to enclose matrix with (  )?

Thank you again.

Best regards,

Dalyoung




>  4. Re: making tables with lua
>     (Proch?zka Luk?? Ing. - Pontex s. r. o.)
> 
> 
> Once you have such functions prepared, you just select to type:
> 
> printTabulate(mytab) -- via 'tabulate'
> 
> or
> 
> printTABLE(mytab) -- via 'TABLE'
> 
> If you insist on 'tabulate' family, you could use the following snippet for 
> your start:
> 
> ----
> \starttext
>  \startluacode
>    local tab = {{1,2},{3,4}}
> 
>    printTabulate = function(tab)
>      context.starttabulate{"|" .. string.rep("c|", #tab[1])}
>        context.HL()
>        for _, r in ipairs(tab) do
>          for _, c in ipairs(r) do
>            context.VL()
>            context(c)
>          end
>          context.VL()
>          context.NR()
>          context.HL()
>        end
>      context.stoptabulate()
>    end
> 
>    printTabulate(tab)
>  \stopluacode
> \stoptext
> ----
> 
> You can write a similar function(s) to typeset via 'TABLE'.
> 
> Best regards,
> 
> Lukas
> 
> 
> On Wed, 17 Oct 2012 03:13:39 +0200, Jeong Dal <hak...@me.com> wrote:
> 
>> Dear all,
>> 
>> I used code which generates the table as following:
>> 
>> \startluacode
>> local NC, NR, HL, VL = context.NC, context.NR, context.HL, context.VL
>> context.starttabulate { "|c|c|c|c|c|c|c|c|c|c|" }
>> HL()
>> for i=1, 6, 1 do
>>      for j=1,10 ,1 do
>>              k= i % 3
>>              if k==1 then
>>                      VL() context(10*(i - k)/3+j)
>>              else
>>                      VL()
>>              end
>>      end
>>      VL()
>>      NR()
>>      if k==0 then
>>              HL()
>>      end
>> end
>> context.stoptabulate()
>> \stopluacode
>> 
>> But it has a fixed column definition as "|c|c|c|c|c|c|c|c|c|c|" and the 
>> number of columns.
>> I wonder it is possible to use the variable for "j" to control the number of 
>> columns and the column setting.
>> Of course, I may put similar codes  which are different only in the number 
>> of columns and column settings when I need a table.
>> But I have many similar tables whose number of columns are different only.
>> If such a method is possible, I'd like to put such a code in 
>> \startbuffer?\stopbudffer and call it to generate tables of various number 
>> of columns given at each time.
>> I also don't know whether it is possible to convey a number from ConTeXt to 
>> the variable in Lua code.
>> 
>> I write this email because I saw a hope in recent discussion "Re: Fwd: Need 
>> help with \definetabulate" which has a method to vary the column setting.
>> 
>> \definetabulate
>> [whatever]
>> [|l|r|]
>> 
>> \definetabulate
>> [whatever][else]
>> [|l|c|r|]
>> 
>> 
>> It may be a lazy man's question with no need for others.
>> 
>> Thank you for reading.
>> 
>> Best regards,
>> 
>> Dalyoung
> 
> 
> -- 
> Ing. Luk?? Proch?zka [mailto:l...@pontex.cz]
> Pontex s. r. o.      [mailto:pon...@pontex.cz] [http://www.pontex.cz]
> Bezov? 1658
> 147 14 Praha 4
> 
> Tel: +420 244 062 238
> Fax: +420 244 461 038
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: t-Tabulate.mkiv
> Type: application/octet-stream
> Size: 496 bytes
> Desc: not available
> URL: 
> <http://www.ntg.nl/pipermail/ntg-context/attachments/20121017/d9e8158e/attachment-0001.obj>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: t-Tabulate.pdf
> Type: application/pdf
> Size: 5121 bytes
> Desc: not available
> URL: 
> <http://www.ntg.nl/pipermail/ntg-context/attachments/20121017/d9e8158e/attachment-0001.pdf>
> 
> ------------------------------
> 
> Message: 5
> Date: Wed, 17 Oct 2012 08:55:01 +0200
> From: luigi scarso <luigi.sca...@gmail.com>
> To: mailing list for ConTeXt users <ntg-context@ntg.nl>
> Subject: Re: [NTG-context] ConTeXt unofficial test suite stub
> Message-ID:
>       <CAG5iGsB6f+sEzwu6O_p=+TnDzdwFoq4Y3=69z6c5evbt5_p...@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
> 
> On Wed, Oct 17, 2012 at 8:44 AM, Marco Pessotto <melmo...@gmail.com> wrote:
> 
>> Aditya Mahajan <adit...@umich.edu> writes:
>> 
>>> It may be worthwhile to merge the two repos.
>> 
>> I'm on my way. I'll keep you posted.
>> 
>> 
>> Can you use graphicsmagick ?
> 
> 
> -- 
> luigi
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: 
> <http://www.ntg.nl/pipermail/ntg-context/attachments/20121017/a99aa46a/attachment.html>
> 
> ------------------------------
> 
> ___________________________________________________________________________________
> 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  : https://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________
> 
> End of ntg-context Digest, Vol 100, Issue 43
> ********************************************

___________________________________________________________________________________
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
___________________________________________________________________________________

Reply via email to