[NTG-context] xtables with lua

Otared Kavian otared at gmail.com
Sun Sep 30 20:59:55 CEST 2018


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 <adityam at umich.edu> 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 at 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
> ___________________________________________________________________________________



More information about the ntg-context mailing list