Re: [NTG-context] Table, xtable and lua

2018-11-11 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 11.11.18 um 10:50:

Hi Wolfgang and Henri,
Thank you so much.
What is the document that allows me to find more information about 
context and lua ?


1. The ConTeXt Lua manual (cld-mkiv.pdf) which comes with the 
installation (also available on Hans website: 
http://www.pragma-ade.com/show-man-33.htm)


2. The Lua manual which explains how you can write loops 
(https://www.lua.org/docs.html)


Wolfgang
___
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] Table, xtable and lua

2018-11-11 Thread Fabrice Couvreur
Hi Wolfgang and Henri,
Thank you so much.
What is the document that allows me to find more information about context
and lua ?
Fabrice

Le dim. 11 nov. 2018 à 09:57, Wolfgang Schuster <
wolfgang.schuster.li...@gmail.com> a écrit :

>
>
> Henri Menke schrieb am 11.11.18 um 01:25:
> >
> > On 11/11/18 12:33 PM, Fabrice Couvreur wrote:
> >> Hi,
> >> I can not complete the first line of the table with the letters of the
> >> alphabet.
> >> Thank you.
> >> Fabrice
> >>
> >> \starttext
> >> \startlinecorrection[blank]
> >> \startmidaligned
> >> \startluacode
> >> context.startxtable({"align=middle, width=1.25cm"})
> >>  context.startxrow()
> >>  context.startxcell({"width=0.5cm"}) context("") context.stopxcell()
> >>  letter = {'A','B','C','D','E','F','G','H','I','J'}
> >>   for letter = 1,10 do
> >>   context.startxcell() context(print(letter))
> context.stopxcell()
> >>   end
> >  letters = {'A','B','C','D','E','F','G','H','I','J'}
> >  for _,letter in ipairs(letters) do
> >  context.startxcell() context(letter) context.stopxcell()
> >  end
>
> A few more alternatives (take a look at the number converter):
>
> \setupbodyfont[dejavu]
>
> \starttext
>
> \startluacode
>
> local letters = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }
>
> for _, letter in ipairs(letters) do
>  context(letter)
> end
>
> context.par()
>
> for _, letter in next, letters do
>  context(letter)
> end
>
> context.par()
>
> for i=1,10 do
>  context(letters[i])
> end
>
> context.par()
>
> for i=1,10 do
>  context(converters.convert("A",i))
> end
>
> context.par()
>
> for i=1,10 do
>  context(converters.convert("A",i,"ru"))
> end
>
> \stopluacode
>
> \stoptext
>
> Wolfgang
>
>
> ___
> 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] Table, xtable and lua

2018-11-11 Thread Wolfgang Schuster



Henri Menke schrieb am 11.11.18 um 01:25:


On 11/11/18 12:33 PM, Fabrice Couvreur wrote:

Hi,
I can not complete the first line of the table with the letters of the
alphabet.
Thank you.
Fabrice

\starttext
\startlinecorrection[blank]
\startmidaligned
\startluacode
context.startxtable({"align=middle, width=1.25cm"})
 context.startxrow()
 context.startxcell({"width=0.5cm"}) context("") context.stopxcell()
 letter = {'A','B','C','D','E','F','G','H','I','J'}
  for letter = 1,10 do
  context.startxcell() context(print(letter)) context.stopxcell()
  end

 letters = {'A','B','C','D','E','F','G','H','I','J'}
 for _,letter in ipairs(letters) do
 context.startxcell() context(letter) context.stopxcell()
 end


A few more alternatives (take a look at the number converter):

\setupbodyfont[dejavu]

\starttext

\startluacode

local letters = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" }

for _, letter in ipairs(letters) do
    context(letter)
end

context.par()

for _, letter in next, letters do
    context(letter)
end

context.par()

for i=1,10 do
    context(letters[i])
end

context.par()

for i=1,10 do
    context(converters.convert("A",i))
end

context.par()

for i=1,10 do
    context(converters.convert("A",i,"ru"))
end

\stopluacode

\stoptext

Wolfgang

___
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] Table, xtable and lua

2018-11-10 Thread Henri Menke


On 11/11/18 12:33 PM, Fabrice Couvreur wrote:
> Hi,
> I can not complete the first line of the table with the letters of the
> alphabet.
> Thank you.
> Fabrice
> 
> \starttext
> \startlinecorrection[blank]
> \startmidaligned
> \startluacode
> context.startxtable({"align=middle, width=1.25cm"})
> context.startxrow()
> context.startxcell({"width=0.5cm"}) context("") context.stopxcell()
> letter = {'A','B','C','D','E','F','G','H','I','J'}
>  for letter = 1,10 do
>  context.startxcell() context(print(letter)) context.stopxcell()
>  end

letters = {'A','B','C','D','E','F','G','H','I','J'}
for _,letter in ipairs(letters) do
context.startxcell() context(letter) context.stopxcell()
end

> context.stopxrow()
> context.startxrow({"background=color","backgroundcolor=gray"})
> 
> context.startxcell({"width=0.5cm","background=color","backgroundcolor=white"})
> context("1") context.stopxcell()
> context.startxcell({"width=2cm"}) context("Année") context.stopxcell()
>  for y = 1998,2006 do
>  context.startxcell() context(y) context.stopxcell()
>  end
> context.stopxrow()
> context.startxrow()
> context.startxcell({"width=0.5cm"}) context("2") context.stopxcell()
> 
> context.startxcell({"width=2cm","background=color","backgroundcolor=gray"})
> context("Prix (kg)") context.stopxcell()
>  local p = 1
>  for y = 1,9 do
>  context.startxcell() context("%0.3f",p) context.stopxcell()
>  p = p*1.031
>  end
> context.stopxrow()
> context.stopxtable()
> \stopluacode
> \stopmidaligned
> \stoplinecorrection
> \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
> ___
> 

___
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] Table, xtable and lua

2018-11-10 Thread Henri Menke


On 11/11/18 12:33 PM, Fabrice Couvreur wrote:
> Hi,
> I can not complete the first line of the table with the letters of the
> alphabet.
> Thank you.
> Fabrice
> 
> \starttext
> \startlinecorrection[blank]
> \startmidaligned
> \startluacode
> context.startxtable({"align=middle, width=1.25cm"})
> context.startxrow()
> context.startxcell({"width=0.5cm"}) context("") context.stopxcell()
> letter = {'A','B','C','D','E','F','G','H','I','J'}
>  for letter = 1,10 do
>  context.startxcell() context(print(letter)) context.stopxcell()
>  end

for _,letter in ipairs(letters) do
context.startxcell() context(letter) context.stopxcell()
end

> context.stopxrow()
> context.startxrow({"background=color","backgroundcolor=gray"})
> 
> context.startxcell({"width=0.5cm","background=color","backgroundcolor=white"})
> context("1") context.stopxcell()
> context.startxcell({"width=2cm"}) context("Année") context.stopxcell()
>  for y = 1998,2006 do
>  context.startxcell() context(y) context.stopxcell()
>  end
> context.stopxrow()
> context.startxrow()
> context.startxcell({"width=0.5cm"}) context("2") context.stopxcell()
> 
> context.startxcell({"width=2cm","background=color","backgroundcolor=gray"})
> context("Prix (kg)") context.stopxcell()
>  local p = 1
>  for y = 1,9 do
>  context.startxcell() context("%0.3f",p) context.stopxcell()
>  p = p*1.031
>  end
> context.stopxrow()
> context.stopxtable()
> \stopluacode
> \stopmidaligned
> \stoplinecorrection
> \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
> ___
> 

___
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] Table, xtable and lua

2018-11-10 Thread Fabrice Couvreur
Hi,
I can not complete the first line of the table with the letters of the
alphabet.
Thank you.
Fabrice

\starttext
\startlinecorrection[blank]
\startmidaligned
\startluacode
context.startxtable({"align=middle, width=1.25cm"})
context.startxrow()
context.startxcell({"width=0.5cm"}) context("") context.stopxcell()
letter = {'A','B','C','D','E','F','G','H','I','J'}
 for letter = 1,10 do
 context.startxcell() context(print(letter)) context.stopxcell()
 end
context.stopxrow()
context.startxrow({"background=color","backgroundcolor=gray"})

context.startxcell({"width=0.5cm","background=color","backgroundcolor=white"})
context("1") context.stopxcell()
context.startxcell({"width=2cm"}) context("Année") context.stopxcell()
 for y = 1998,2006 do
 context.startxcell() context(y) context.stopxcell()
 end
context.stopxrow()
context.startxrow()
context.startxcell({"width=0.5cm"}) context("2") context.stopxcell()

context.startxcell({"width=2cm","background=color","backgroundcolor=gray"})
context("Prix (kg)") context.stopxcell()
 local p = 1
 for y = 1,9 do
 context.startxcell() context("%0.3f",p) context.stopxcell()
 p = p*1.031
 end
context.stopxrow()
context.stopxtable()
\stopluacode
\stopmidaligned
\stoplinecorrection
\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
___