Re: [NTG-context] xtables with lua
On Mon, 1 Oct 2018, Fabrice Couvreur wrote: Hi, Thank you Aditya for the link. I knew that with natural tables, but I hoped it could be done with xtables too. Almost the same code works with xtables as well (in your example, I don't know the relationship between the columns) \starttext \startluacode context.startxtable({"align=middle, width=0.8cm"}) context.startxrow() context.startxcell() context("$(+)$") context.stopxcell() for y = 1,6 do context.startxcell() context(y) context.stopxcell() end context.stopxrow() for x = 1,6 do context.startxrow() context.startxcell() context(x) context.stopxcell() for y = 1,6 do context.startxcell() context(x+y) context.stopxcell() end context.stopxrow() end context.stopxtable() \stopluacode \stoptext Aditya ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
Hi, Thank you Aditya for the link. I knew that with natural tables, but I hoped it could be done with xtables too. Fabrice Le lun. 1 oct. 2018 à 05:50, Aditya Mahajan a écrit : > On Mon, 1 Oct 2018, Jeong Dal wrote: > > > What do you mean “does not typeset correctly as expected”? > > As I said, I fixed the post. > > > I copied and tested the last example and got the result without error. > > One problem is that the vertical alignment is not centered as the > example of Aditya’s. > > Would you please tell me what I miss? > > The part in the beginning of the post: > > \setupTABLE[each][each][width=2em,height=2em,align={middle,middle}] > \setupTABLE[r][1][background=color,backgroundcolor=gray] > \setupTABLE[c][1][background=color,backgroundcolor=gray] > > > Aditya___ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > > ___ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
On Mon, 1 Oct 2018, Jeong Dal wrote: What do you mean “does not typeset correctly as expected”? As I said, I fixed the post. I copied and tested the last example and got the result without error. One problem is that the vertical alignment is not centered as the example of Aditya’s. Would you please tell me what I miss? The part in the beginning of the post: \setupTABLE[each][each][width=2em,height=2em,align={middle,middle}] \setupTABLE[r][1][background=color,backgroundcolor=gray] \setupTABLE[c][1][background=color,backgroundcolor=gray] Aditya___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
Dear Otared, What do you mean “does not typeset correctly as expected”? I copied and tested the last example and got the result without error. One problem is that the vertical alignment is not centered as the example of Aditya’s. Would you please tell me what I miss? Thank you. Best regards, Dalyoung > > I wanted to make an observation about the last example in that page, which > does not typeset correctly as expected, and also it does not work well if one > wanted to make a multiplication table instead of the addition table of your > examples. I think the following modification might be necessary (here for the > multiplication table): > ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
On Mon, 1 Oct 2018, Otared Kavian wrote: Hi Aditya, Thanks for pointing to your context-blog: one learns always some good stuff there! I wanted to make an observation about the last example in that page, which does not typeset correctly as expected, and also it does not work well if one wanted to make a multiplication table instead of the addition table of your examples. I think the following modification might be necessary (here for the multiplication table): Thanks. I fixed this with a slightly different solution that does not require an extra if statement. Aditya ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
Hi Aditya, Thanks for pointing to your context-blog: one learns always some good stuff there! I wanted to make an observation about the last example in that page, which does not typeset correctly as expected, and also it does not work well if one wanted to make a multiplication table instead of the addition table of your examples. I think the following modification might be necessary (here for the multiplication table): %%% \startplacetable \startluacode context.bTABLE() context.bTR() context.bTD() context("($\\times$)") context.eTD() for n = 1,6 do context.bTD() context(n) context.eTD() end context.eTR() for x = 1,6 do context.bTR() for y = 0,6 do context.bTD() if y == 0 then context(x) elseif y > 0 then context(x*y) end context.eTD() end context.eTR() end context.eTABLE() \stopluacode \stopplacetable %%% Thanks again, and best regards: OK > On 30 Sep 2018, at 21:15, Aditya Mahajan wrote: > > On Sun, 30 Sep 2018, Fabrice Couvreur wrote: > >> Hi, >> Is it possible to fill columns A, B and C using a loop with lua ? >> Thank you. > > Here is a blog post summarizing a similar question from almost a decade ago: > > https://adityam.github.io/context-blog/post/tex-programming/ > > Aditya > ___ > 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://context.aanhet.net > archive : https://bitbucket.org/phg/context-mirror/commits/ > wiki : http://contextgarden.net > ___ ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] xtables with lua
On Sun, 30 Sep 2018, Fabrice Couvreur wrote: Hi, Is it possible to fill columns A, B and C using a loop with lua ? Thank you. Here is a blog post summarizing a similar question from almost a decade ago: https://adityam.github.io/context-blog/post/tex-programming/ Aditya ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
[NTG-context] xtables with lua
Hi, Is it possible to fill columns A, B and C using a loop with lua ? Thank you. Fabrice \starttext \startxtable[align={lohi,middle},bodyfont=8pt,width=0.8cm] \startxrow \startxcell \stopxcell \startxcell A \stopxcell \startxcell B \stopxcell \startxcell C \stopxcell \stopxrow \startxrow \startxcell 1 \stopxcell \startxcell \m{x} \stopxcell \startxcell \m{N} \stopxcell \startxcell \m{B} \stopxcell \stopxrow \startxrow \startxcell 2 \stopxcell \startxcell 1 \stopxcell \startxcell 7 \stopxcell \startxcell 20 \stopxcell \stopxrow \startxrow \startxcell 3 \stopxcell \startxcell 2 \stopxcell \startxcell 14 \stopxcell \startxcell 24 \stopxcell \stopxrow \startxrow \startxcell 4 \stopxcell \startxcell 3 \stopxcell \startxcell 21 \stopxcell \startxcell 28 \stopxcell \stopxrow \startxrow \startxcell 5 \stopxcell \startxcell 4 \stopxcell \startxcell 28 \stopxcell \startxcell 32 \stopxcell \stopxrow \startxrow \startxcell 6 \stopxcell \startxcell 5 \stopxcell \startxcell 35 \stopxcell \startxcell 36 \stopxcell \stopxrow \startxrow \startxcell 7 \stopxcell \startxcell 6 \stopxcell \startxcell 42 \stopxcell \startxcell 40 \stopxcell \stopxrow \startxrow \startxcell 8 \stopxcell \startxcell 7 \stopxcell \startxcell 49 \stopxcell \startxcell 44 \stopxcell \stopxrow \startxrow \startxcell 9 \stopxcell \startxcell 8 \stopxcell \startxcell 56 \stopxcell \startxcell 48 \stopxcell \stopxrow \startxrow \startxcell 10 \stopxcell \startxcell 9 \stopxcell \startxcell 63 \stopxcell \startxcell 52 \stopxcell \stopxrow \startxrow \startxcell 11 \stopxcell \startxcell 10 \stopxcell \startxcell 70 \stopxcell \startxcell 56 \stopxcell \stopxrow \startxrow \startxcell 12 \stopxcell \startxcell 11 \stopxcell \startxcell 77 \stopxcell \startxcell 60 \stopxcell \stopxrow \stopxtable \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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___