ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Table, xtable and lua
@ 2018-11-10 23:33 Fabrice Couvreur
  2018-11-11  0:24 ` Henri Menke
  2018-11-11  0:25 ` Henri Menke
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice Couvreur @ 2018-11-10 23:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1381 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 2477 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Table, xtable and lua
  2018-11-10 23:33 Table, xtable and lua Fabrice Couvreur
@ 2018-11-11  0:24 ` Henri Menke
  2018-11-11  0:25 ` Henri Menke
  1 sibling, 0 replies; 6+ messages in thread
From: Henri Menke @ 2018-11-11  0:24 UTC (permalink / raw)
  To: ntg-context



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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Table, xtable and lua
  2018-11-10 23:33 Table, xtable and lua Fabrice Couvreur
  2018-11-11  0:24 ` Henri Menke
@ 2018-11-11  0:25 ` Henri Menke
  2018-11-11  8:57   ` Wolfgang Schuster
  1 sibling, 1 reply; 6+ messages in thread
From: Henri Menke @ 2018-11-11  0:25 UTC (permalink / raw)
  To: ntg-context



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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Table, xtable and lua
  2018-11-11  0:25 ` Henri Menke
@ 2018-11-11  8:57   ` Wolfgang Schuster
  2018-11-11  9:50     ` Fabrice Couvreur
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2018-11-11  8:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users



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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Table, xtable and lua
  2018-11-11  8:57   ` Wolfgang Schuster
@ 2018-11-11  9:50     ` Fabrice Couvreur
  2018-11-11 10:27       ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2018-11-11  9:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2353 bytes --]

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.lists@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
>
> ___________________________________________________________________________________

[-- Attachment #1.2: Type: text/html, Size: 4150 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Table, xtable and lua
  2018-11-11  9:50     ` Fabrice Couvreur
@ 2018-11-11 10:27       ` Wolfgang Schuster
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2018-11-11 10:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Fabrice Couvreur


[-- Attachment #1.1: Type: text/plain, Size: 438 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 1251 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-11-11 10:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-10 23:33 Table, xtable and lua Fabrice Couvreur
2018-11-11  0:24 ` Henri Menke
2018-11-11  0:25 ` Henri Menke
2018-11-11  8:57   ` Wolfgang Schuster
2018-11-11  9:50     ` Fabrice Couvreur
2018-11-11 10:27       ` Wolfgang Schuster

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).