ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* making tables with lua
@ 2012-10-17  1:13 Jeong Dal
  2012-10-17  6:49 ` Procházka Lukáš Ing. - Pontex s. r. o.
  2012-10-17  7:19 ` Hans Hagen
  0 siblings, 2 replies; 7+ messages in thread
From: Jeong Dal @ 2012-10-17  1:13 UTC (permalink / raw)
  To: ntg-context

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

___________________________________________________________________________________
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] 7+ messages in thread
[parent not found: <mailman.522.1350456904.2084.ntg-context@ntg.nl>]
* Re: making tables with lua
@ 2012-10-18  4:43 Jeong Dal
  0 siblings, 0 replies; 7+ messages in thread
From: Jeong Dal @ 2012-10-18  4:43 UTC (permalink / raw)
  To: ntg-context

Dear Wolfgang and Proch?zka Luk?? Ing,

Thank you for the solution.
It works nicely. It is so convenient to write many matrices.

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] 7+ messages in thread

end of thread, other threads:[~2012-10-18  4:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-17  1:13 making tables with lua Jeong Dal
2012-10-17  6:49 ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-10-17  7:19 ` Hans Hagen
     [not found] <mailman.522.1350456904.2084.ntg-context@ntg.nl>
2012-10-17  8:34 ` Jeong Dal
2012-10-17  9:18   ` Wolfgang Schuster
2012-10-17  9:24   ` Procházka Lukáš Ing. - Pontex s. r. o.
2012-10-18  4:43 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).