* Lua code and table @ 2021-02-17 17:40 Fabrice Couvreur 2021-02-17 21:13 ` Tomas Hala ` (2 more replies) 0 siblings, 3 replies; 14+ messages in thread From: Fabrice Couvreur @ 2021-02-17 17:40 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 3315 bytes --] Hi, The code works, but is it possible to make it shorter ? Thank you Fabrice \startuseMPgraphic{DiagonalRule} rulethickness := \frameddimension{rulethickness}; drawoptions( withpen pencircle scaled rulethickness withcolor \MPcolor{\framedparameter{framecolor}}); pair leftcorner, rightcorner, Leftcorner, Rightcorner; leftcorner := (rulethickness, \overlayheight-rulethickness); rightcorner := (\overlaywidth-rulethickness, rulethickness); Leftcorner := ( rulethickness, rulethickness); Rightcorner := (\overlaywidth-rulethickness,\overlayheight-rulethickness); draw leftcorner -- rightcorner; draw Leftcorner -- Rightcorner; \stopuseMPgraphic \defineoverlay [DiagonalRule] [\useMPgraphic{DiagonalRule}] \define[2]\DiagonalLabel{% \setuptabulate [after={\blank[\frameddimension{offset}]}] \starttabulate [|p|r|] \NC \NC \bf #2 \NC\NR \NC \bf #1 \NC \NC\NR \stoptabulate } \starttext \startluacode local background_one = { align = "middle", style = "type", background = "DiagonalRule", } local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" } context.startxtable({"align={middle,lohi}, width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"}) context.startxrow() context.startxcell({"frame=off"}) context() context.stopxcell() for _, letter in ipairs(letters_1) do context.startxcell() context(letter) context.stopxcell() end context.stopxrow() for _, letter in ipairs(letters_1) do context.startxrow() context.startxcell() context(letter) context.stopxcell() for j = 0, 7 do context.startxcell( j == 0 and letter == "B" and background_one or j == 0 and letter == "C" and background_one or j == 0 and letter == "D" and background_one or j == 0 and letter == "G" and background_one or j == 0 and letter == "H" and background_one or j == 1 and letter == "A" and background_one or j == 1 and letter == "E" and background_one or j == 1 and letter == "F" and background_one or j == 1 and letter == "G" and background_one or j == 2 and letter == "A" and background_one or j == 2 and letter == "D" and background_one or j == 2 and letter == "F" and background_one or j == 2 and letter == "G" and background_one or j == 2 and letter == "H" and background_one or j == 3 and letter == "A" and background_one or j == 3 and letter == "C" and background_one or j == 3 and letter == "E" and background_one or j == 3 and letter == "H" and background_one or j == 4 and letter == "B" and background_one or j == 4 and letter == "D" and background_one or j == 4 and letter == "F" and background_one or j == 4 and letter == "G" and background_one or j == 5 and letter == "B" and background_one or j == 5 and letter == "C" and background_one or j == 5 and letter == "E" and background_one or j == 6 and letter == "A" and background_one or j == 6 and letter == "B" and background_one or j == 6 and letter == "C" and background_one or j == 6 and letter == "E" and background_one or j == 7 and letter == "A" and background_one or j == 7 and letter == "C" and background_one or j == 7 and letter == "D" and background_one ) context() context.stopxcell() end context.stopxrow() end context.stopxtable() \stopluacode \stoptext [-- Attachment #1.2: Type: text/html, Size: 5546 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-17 17:40 Lua code and table Fabrice Couvreur @ 2021-02-17 21:13 ` Tomas Hala 2021-02-17 21:26 ` Wolfgang Schuster 2021-02-17 23:22 ` Bruce Horrocks 2 siblings, 0 replies; 14+ messages in thread From: Tomas Hala @ 2021-02-17 21:13 UTC (permalink / raw) To: mailing list for ConTeXt users Hi Fabrice, see below, I attached two ideas how to do it. The best, Tomáš Wed, Feb 17, 2021 ve 06:40:54PM +0100 Fabrice Couvreur napsal(a): # Hi, The code works, but is it possible to make it shorter ? # Thank you # Fabrice # \startuseMPgraphic{DiagonalRule} # rulethickness := \frameddimension{rulethickness}; # # drawoptions( # withpen pencircle scaled rulethickness # withcolor \MPcolor{\framedparameter{framecolor}}); # # pair leftcorner, rightcorner, Leftcorner, Rightcorner; # leftcorner := (rulethickness, \overlayheight-rulethickness); # rightcorner := (\overlaywidth-rulethickness, rulethickness); # Leftcorner := ( rulethickness, rulethickness); # Rightcorner := # (\overlaywidth-rulethickness,\overlayheight-rulethickness); # # draw leftcorner -- rightcorner; # draw Leftcorner -- Rightcorner; # \stopuseMPgraphic # # \defineoverlay # [DiagonalRule] # [\useMPgraphic{DiagonalRule}] # # \define[2]\DiagonalLabel{% # \setuptabulate [after={\blank[\frameddimension{offset}]}] # \starttabulate [|p|r|] # \NC \NC \bf #2 \NC\NR # \NC \bf #1 \NC \NC\NR # \stoptabulate # } # \starttext # \startluacode # local background_one = { # align = "middle", # style = "type", # background = "DiagonalRule", # } # # local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" } # context.startxtable({"align={middle,lohi}, # width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"}) # context.startxrow() # context.startxcell({"frame=off"}) # context() # context.stopxcell() # for _, letter in ipairs(letters_1) do # context.startxcell() # context(letter) context.stopxcell() # end # context.stopxrow() # for _, letter in ipairs(letters_1) do # context.startxrow() # context.startxcell() # context(letter) # context.stopxcell() # for j = 0, 7 do # context.startxcell( j == 0 and letter == "B" and background_one # or j == 0 and letter == "C" and background_one # or j == 0 and letter == "D" and background_one # or j == 0 and letter == "G" and background_one # or j == 0 and letter == "H" and background_one # or j == 1 and letter == "A" and background_one # or j == 1 and letter == "E" and background_one # or j == 1 and letter == "F" and background_one # or j == 1 and letter == "G" and background_one # or j == 2 and letter == "A" and background_one # or j == 2 and letter == "D" and background_one # or j == 2 and letter == "F" and background_one # or j == 2 and letter == "G" and background_one # or j == 2 and letter == "H" and background_one # or j == 3 and letter == "A" and background_one # or j == 3 and letter == "C" and background_one # or j == 3 and letter == "E" and background_one # or j == 3 and letter == "H" and background_one # or j == 4 and letter == "B" and background_one # or j == 4 and letter == "D" and background_one # or j == 4 and letter == "F" and background_one # or j == 4 and letter == "G" and background_one # or j == 5 and letter == "B" and background_one # or j == 5 and letter == "C" and background_one # or j == 5 and letter == "E" and background_one # or j == 6 and letter == "A" and background_one # or j == 6 and letter == "B" and background_one # or j == 6 and letter == "C" and background_one # or j == 6 and letter == "E" and background_one # or j == 7 and letter == "A" and background_one # or j == 7 and letter == "C" and background_one # or j == 7 and letter == "D" and background_one # ) # context() # context.stopxcell() # end # context.stopxrow() # end # context.stopxtable() # \stopluacode # \stoptext %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%= \starttext \startluacode function test() for x=0,7 do for y=65,72 do local yy=string.char(y) context(x) context(" "..yy) context(f1(x,yy)..f2(x,yy)..f3(x,yy)) context.par() end end end local background_one = true function f1 (j,letter) local res= j == 0 and letter == "B" and background_one or j == 0 and letter == "C" and background_one or j == 0 and letter == "D" and background_one or j == 0 and letter == "G" and background_one or j == 0 and letter == "H" and background_one or j == 1 and letter == "A" and background_one or j == 1 and letter == "E" and background_one or j == 1 and letter == "F" and background_one or j == 1 and letter == "G" and background_one or j == 2 and letter == "A" and background_one or j == 2 and letter == "D" and background_one or j == 2 and letter == "F" and background_one or j == 2 and letter == "G" and background_one or j == 2 and letter == "H" and background_one or j == 3 and letter == "A" and background_one or j == 3 and letter == "C" and background_one or j == 3 and letter == "E" and background_one or j == 3 and letter == "H" and background_one or j == 4 and letter == "B" and background_one or j == 4 and letter == "D" and background_one or j == 4 and letter == "F" and background_one or j == 4 and letter == "G" and background_one or j == 5 and letter == "B" and background_one or j == 5 and letter == "C" and background_one or j == 5 and letter == "E" and background_one or j == 6 and letter == "A" and background_one or j == 6 and letter == "B" and background_one or j == 6 and letter == "C" and background_one or j == 6 and letter == "E" and background_one or j == 7 and letter == "A" and background_one or j == 7 and letter == "C" and background_one or j == 7 and letter == "D" and background_one return ":"..tostring(res) end function f2 (j,letter) local t = { { ["B"]=true, ["C"]=true, ["D"]=true, ["G"]=true, ["H"]=true, }, { ["A"]=true, ["E"]=true, ["F"]=true, ["G"]=true, }, { ["A"]=true, ["D"]=true, ["F"]=true, ["G"]=true, ["H"]=true, }, { ["A"]=true, ["C"]=true, ["E"]=true, ["H"]=true, }, { ["B"]=true, ["D"]=true, ["F"]=true, ["G"]=true, }, { ["B"]=true, ["C"]=true, ["E"]=true, }, { ["A"]=true, ["B"]=true, ["C"]=true, ["E"]=true, }, { ["A"]=true, ["C"]=true, ["D"]=true, } } local res = t[j+1][letter] or false return ":"..tostring(res) end function f3 (j,letter) local t = { "BCDGH", "AEFG", "ADFGH", "ACEH", "BDFG", "BCE", "ABCE", "ACD" } local res = t[j+1]:find(letter) or 0 return ":"..tostring(res>0) end test() \stopluacode \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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: Lua code and table 2021-02-17 17:40 Lua code and table Fabrice Couvreur 2021-02-17 21:13 ` Tomas Hala @ 2021-02-17 21:26 ` Wolfgang Schuster 2021-02-17 22:52 ` Hans Hagen 2021-02-17 23:22 ` Bruce Horrocks 2 siblings, 1 reply; 14+ messages in thread From: Wolfgang Schuster @ 2021-02-17 21:26 UTC (permalink / raw) To: mailing list for ConTeXt users Fabrice Couvreur schrieb am 17.02.2021 um 18:40: > Hi,The code works, but is it possible to make it shorter ? > Thank you > Fabrice > > > \startuseMPgraphic{DiagonalRule} > rulethickness := \frameddimension{rulethickness}; > > drawoptions( > withpen pencircle scaled rulethickness > withcolor \MPcolor{\framedparameter{framecolor}}); > > pair leftcorner, rightcorner, Leftcorner, Rightcorner; > leftcorner := (rulethickness, \overlayheight-rulethickness); > rightcorner := (\overlaywidth-rulethickness, rulethickness); > Leftcorner := ( rulethickness, rulethickness); > Rightcorner := > (\overlaywidth-rulethickness,\overlayheight-rulethickness); > > draw leftcorner -- rightcorner; > draw Leftcorner -- Rightcorner; > \stopuseMPgraphic \startuseMPgraphic{DiagonalRule} drawoptions( withpen pencircle scaled OverlayLineWidth withcolor OverlayLineColor ); draw ulcorner OverlayBox -- lrcorner OverlayBox ; draw llcorner OverlayBox -- urcorner OverlayBox ; \stopuseMPgraphic 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] 14+ messages in thread
* Re: Lua code and table 2021-02-17 21:26 ` Wolfgang Schuster @ 2021-02-17 22:52 ` Hans Hagen 0 siblings, 0 replies; 14+ messages in thread From: Hans Hagen @ 2021-02-17 22:52 UTC (permalink / raw) To: mailing list for ConTeXt users On 2/17/2021 10:26 PM, Wolfgang Schuster wrote: > Fabrice Couvreur schrieb am 17.02.2021 um 18:40: >> Hi,The code works, but is it possible to make it shorter ? >> Thank you >> Fabrice >> >> >> \startuseMPgraphic{DiagonalRule} >> rulethickness := \frameddimension{rulethickness}; >> >> drawoptions( >> withpen pencircle scaled rulethickness >> withcolor \MPcolor{\framedparameter{framecolor}}); >> >> pair leftcorner, rightcorner, Leftcorner, Rightcorner; >> leftcorner := (rulethickness, \overlayheight-rulethickness); >> rightcorner := (\overlaywidth-rulethickness, rulethickness); >> Leftcorner := ( rulethickness, rulethickness); >> Rightcorner := >> (\overlaywidth-rulethickness,\overlayheight-rulethickness); >> >> draw leftcorner -- rightcorner; >> draw Leftcorner -- Rightcorner; >> \stopuseMPgraphic > > > \startuseMPgraphic{DiagonalRule} > drawoptions( > withpen pencircle scaled OverlayLineWidth > withcolor OverlayLineColor > ); > > draw ulcorner OverlayBox -- lrcorner OverlayBox ; > draw llcorner OverlayBox -- urcorner OverlayBox ; > \stopuseMPgraphic Often this also works: \startuseMPgraphic{DiagonalRule} draw image ( draw ulcorner OverlayBox -- lrcorner OverlayBox ; draw llcorner OverlayBox -- urcorner OverlayBox ; ) withpen pencircle scaled OverlayLineWidth withcolor OverlayLineColor ; \stopuseMPgraphic ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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] 14+ messages in thread
* Re: Lua code and table 2021-02-17 17:40 Lua code and table Fabrice Couvreur 2021-02-17 21:13 ` Tomas Hala 2021-02-17 21:26 ` Wolfgang Schuster @ 2021-02-17 23:22 ` Bruce Horrocks 2021-02-18 9:06 ` Hans Hagen 2 siblings, 1 reply; 14+ messages in thread From: Bruce Horrocks @ 2021-02-17 23:22 UTC (permalink / raw) To: ntg-context > On 17 Feb 2021, at 17:40, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote: > > Hi, The code works, but is it possible to make it shorter ? > Thank you > Fabrice > You can reduce the size of the test by storing the pattern in a table: \startluacode local background_one = { align = "middle", style = "type", background = "DiagonalRule", } local letters_1 = { "A", "B", "C", "D", "E", "F", "G", "H" } local pattern_1 = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } context.startxtable({"align={middle,lohi}, width=0.8cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"}) context.startxrow() context.startxcell({"frame=off"}) context() context.stopxcell() for _, letter in ipairs(letters_1) do context.startxcell() context(letter) context.stopxcell() end context.stopxrow() for i, letter in ipairs(letters_1) do context.startxrow() context.startxcell() context(letter) context.stopxcell() for j = 1, 8 do context.startxcell( string.sub(pattern_1[i],j,j) == "X" and background_one ) context() context.stopxcell() end context.stopxrow() end context.stopxtable() \stopluacode — Bruce Horrocks Hampshire, UK ___________________________________________________________________________________ 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] 14+ messages in thread
* Re: Lua code and table 2021-02-17 23:22 ` Bruce Horrocks @ 2021-02-18 9:06 ` Hans Hagen 2021-02-18 15:14 ` Fabrice Couvreur 0 siblings, 1 reply; 14+ messages in thread From: Hans Hagen @ 2021-02-18 9:06 UTC (permalink / raw) To: mailing list for ConTeXt users On 2/18/2021 12:22 AM, Bruce Horrocks wrote: >> On 17 Feb 2021, at 17:40, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote: >> >> Hi, The code works, but is it possible to make it shorter ? OK, here is my take, based on earlier posts, bringing together some 'technologies': (1) make a document function which isolatees the code (2) then call it where needed (3) use the built in conversion code (4) use so called unique mp graphics (smaller files, faster run) (5) use symbols to get the baseline right (6) use a little abstraction in the table setup watch how we can pass a table instead of a string, so context.startxtable { align = "middle,lohi", width = "0.8cm", offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } is ok, but anm abstraction is even better. Now, who will wikify it ... %%%%%%%%%%% code %%%%%%%%%%% \setupbodyfont[pagella] \starttext \definextable [MyTable] [align={middle,lohi}, width=0.8cm, offset=0.8ex, bodyfont=9pt, framecolor=cyan] \startluacode function document.MyTable(specification) local pattern = specification.pattern local action = specification.action local conversion = specification.conversion or "Characters" local n = #pattern -- context.startxtable { align = "middle,lohi", width = "0.8cm", offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } context.startxtable { "MyTable" } context.startxrow() context.startxcell { frame = "off" } context() context.stopxcell() for i=1,n do context.startxcell() context.convertnumber(conversion,i) context.stopxcell() end context.stopxrow() for i=1,n do context.startxrow() context.startxcell() context.convertnumber(conversion,i) context.stopxcell() for j=1,n do context.startxcell { align = "middle" } action(string.sub(pattern[i],j,j)) context.stopxcell() end context.stopxrow() end context.stopxtable() end \stopluacode \startuniqueMPgraphic{cross}{width,height,depth,color,line} draw image ( draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ; draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ; ) withpen pencircle scaled \MPvar{line} withcolor \MPvar{color} ; \stopuniqueMPgraphic \definesymbol [MyRedCross] [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=red,line=.2ex}] \definesymbol [MyGreenCross] [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=green,line=.2ex}] \startluacode document.MyTable { action = function(value) context(value == "X" and 1 or 0) end, conversion = "Characters", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \startluacode document.MyTable { action = function(value) context(value == "X" and 1 or 0) end, conversion = "Greek", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", } } \stopluacode \startluacode document.MyTable { action = function(value) if value == "X" then context.symbol { "MyRedCross" } end end, conversion = "Romannumerals", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \startluacode document.MyTable { action = function(value) context.symbol { value == "X" and "MyRedCross" or "MyGreenCross" } end, conversion = "Romannumerals", pattern = { "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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] 14+ messages in thread
* Re: Lua code and table 2021-02-18 9:06 ` Hans Hagen @ 2021-02-18 15:14 ` Fabrice Couvreur 2021-02-18 15:26 ` Jano Kula 0 siblings, 1 reply; 14+ messages in thread From: Fabrice Couvreur @ 2021-02-18 15:14 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 7309 bytes --] Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning thanks to you Hans, I compiled your code and I get an error message : lua error > lua error on line 50 in file ./table_1.tex: token call, syntax: [ctxlua]:11: unexpected symbol near '=' 13 \startluacode 14 function document.MyTable(specification) 15 16 local pattern = specification.pattern 17 local action = specification.action 18 local conversion = specification.conversion or "Characters" 19 20 local n = #pattern 21 22 -- context.startxtable { align = "middle,lohi", width = "0.8cm", 23 >> offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } 24 context.startxtable { "MyTable" } 25 context.startxrow() 26 context.startxcell { frame = "off" } 27 context() 28 context.stopxcell() 29 for i=1,n do 30 context.startxcell() 31 context.convertnumber(conversion,i) 32 context.stopxcell() 33 end mtx-context | fatal error: return code: 256 TeX Output exited abnormally with code 1 at Thu Feb 18 16:13:29 Thank you very much Fabrice Le jeu. 18 févr. 2021 à 10:06, Hans Hagen <j.hagen@xs4all.nl> a écrit : > On 2/18/2021 12:22 AM, Bruce Horrocks wrote: > > >> On 17 Feb 2021, at 17:40, Fabrice Couvreur <fabrice1.couvreur@gmail.com> > wrote: > >> > >> Hi, The code works, but is it possible to make it shorter ? > OK, here is my take, based on earlier posts, bringing together some > 'technologies': > > (1) make a document function which isolatees the code > (2) then call it where needed > (3) use the built in conversion code > (4) use so called unique mp graphics (smaller files, faster run) > (5) use symbols to get the baseline right > (6) use a little abstraction in the table setup > > watch how we can pass a table instead of a string, so > > context.startxtable { align = "middle,lohi", width = "0.8cm", offset = > "0.8ex", bodyfont = "9pt", framecolor = "cyan" } > > is ok, but anm abstraction is even better. Now, who will wikify it ... > > %%%%%%%%%%% code %%%%%%%%%%% > > \setupbodyfont[pagella] > > \starttext > > \definextable > [MyTable] > [align={middle,lohi}, > width=0.8cm, > offset=0.8ex, > bodyfont=9pt, > framecolor=cyan] > > \startluacode > function document.MyTable(specification) > > local pattern = specification.pattern > local action = specification.action > local conversion = specification.conversion or "Characters" > > local n = #pattern > > -- context.startxtable { align = "middle,lohi", width = "0.8cm", > offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } > context.startxtable { "MyTable" } > context.startxrow() > context.startxcell { frame = "off" } > context() > context.stopxcell() > for i=1,n do > context.startxcell() > context.convertnumber(conversion,i) > context.stopxcell() > end > context.stopxrow() > for i=1,n do > context.startxrow() > context.startxcell() > context.convertnumber(conversion,i) > context.stopxcell() > for j=1,n do > context.startxcell { align = "middle" } > action(string.sub(pattern[i],j,j)) > context.stopxcell() > end > context.stopxrow() > end > context.stopxtable() > > end > \stopluacode > > \startuniqueMPgraphic{cross}{width,height,depth,color,line} > draw image ( > draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ; > draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ; > ) > withpen pencircle scaled \MPvar{line} > withcolor \MPvar{color} ; > \stopuniqueMPgraphic > > \definesymbol > [MyRedCross] > > > [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=red,line=.2ex}] > > \definesymbol > [MyGreenCross] > > > [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=green,line=.2ex}] > > \startluacode > document.MyTable { > action = function(value) > context(value == "X" and 1 or 0) > end, > conversion = "Characters", > pattern = { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \startluacode > document.MyTable { > action = function(value) > context(value == "X" and 1 or 0) > end, > conversion = "Greek", > pattern = { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > } > } > \stopluacode > > \startluacode > document.MyTable { > action = function(value) > if value == "X" then > context.symbol { "MyRedCross" } > end > end, > conversion = "Romannumerals", > pattern = { > ".XXX..XX", > "X...XXX.", > "X..X.XXX", > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \startluacode > document.MyTable { > action = function(value) > context.symbol { value == "X" and "MyRedCross" or > "MyGreenCross" } > end, > conversion = "Romannumerals", > pattern = { > "X.X.X..X", > ".X.X.XX.", > ".XX.X...", > "XXX.X...", > "X.XX...." > } > } > \stopluacode > > \stoptext > > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > > ___________________________________________________________________________________ > 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: 11961 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-18 15:14 ` Fabrice Couvreur @ 2021-02-18 15:26 ` Jano Kula 2021-02-18 15:28 ` Fabrice Couvreur 0 siblings, 1 reply; 14+ messages in thread From: Jano Kula @ 2021-02-18 15:26 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 926 bytes --] Hello Fabrice, On Thu, 18 Feb 2021 at 16:19, Fabrice Couvreur <fabrice1.couvreur@gmail.com> wrote: > Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning > thanks to you > Hans, I compiled your code and I get an error message : > > lua error > lua error on line 50 in file ./table_1.tex: > > token call, syntax: [ctxlua]:11: unexpected symbol near '=' > > 13 \startluacode > 14 function document.MyTable(specification) > 15 > 16 local pattern = specification.pattern > 17 local action = specification.action > 18 local conversion = specification.conversion or "Characters" > 19 > 20 local n = #pattern > 21 > 22 -- context.startxtable { align = "middle,lohi", width = > "0.8cm", > 23 >> offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } > Just comment out line 23, too, or join 22 + 23 to one line. Jano [-- Attachment #1.2: Type: text/html, Size: 2132 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-18 15:26 ` Jano Kula @ 2021-02-18 15:28 ` Fabrice Couvreur 2021-02-19 11:42 ` Fabrice Couvreur 0 siblings, 1 reply; 14+ messages in thread From: Fabrice Couvreur @ 2021-02-18 15:28 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1649 bytes --] Hello Jano, Thanks. Fabrice Le jeu. 18 févr. 2021 à 16:27, Jano Kula <jano.kula@gmail.com> a écrit : > Hello Fabrice, > > > > On Thu, 18 Feb 2021 at 16:19, Fabrice Couvreur < > fabrice1.couvreur@gmail.com> wrote: > >> Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning >> thanks to you >> Hans, I compiled your code and I get an error message : >> >> lua error > lua error on line 50 in file ./table_1.tex: >> >> token call, syntax: [ctxlua]:11: unexpected symbol near '=' >> >> 13 \startluacode >> 14 function document.MyTable(specification) >> 15 >> 16 local pattern = specification.pattern >> 17 local action = specification.action >> 18 local conversion = specification.conversion or >> "Characters" >> 19 >> 20 local n = #pattern >> 21 >> 22 -- context.startxtable { align = "middle,lohi", width = >> "0.8cm", >> 23 >> offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } >> > > Just comment out line 23, too, or join 22 + 23 to one line. > > Jano > > > > ___________________________________________________________________________________ > 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: 3768 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-18 15:28 ` Fabrice Couvreur @ 2021-02-19 11:42 ` Fabrice Couvreur 2021-02-19 12:06 ` Hans Hagen 0 siblings, 1 reply; 14+ messages in thread From: Fabrice Couvreur @ 2021-02-19 11:42 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 2053 bytes --] Hi Hans, Thanks again for the ideas to improve my code. However, I am new to Lua and my level is far from sufficient to understand everything. Why in no table do the crosses appear in the cells; which was my original idea. Thank you. Fabrice Le jeu. 18 févr. 2021 à 16:28, Fabrice Couvreur <fabrice1.couvreur@gmail.com> a écrit : > Hello Jano, > Thanks. > Fabrice > > Le jeu. 18 févr. 2021 à 16:27, Jano Kula <jano.kula@gmail.com> a écrit : > >> Hello Fabrice, >> >> >> >> On Thu, 18 Feb 2021 at 16:19, Fabrice Couvreur < >> fabrice1.couvreur@gmail.com> wrote: >> >>> Hi all, Thanks to you, I'm not at your level with Lua, but I'm learning >>> thanks to you >>> Hans, I compiled your code and I get an error message : >>> >>> lua error > lua error on line 50 in file ./table_1.tex: >>> >>> token call, syntax: [ctxlua]:11: unexpected symbol near '=' >>> >>> 13 \startluacode >>> 14 function document.MyTable(specification) >>> 15 >>> 16 local pattern = specification.pattern >>> 17 local action = specification.action >>> 18 local conversion = specification.conversion or >>> "Characters" >>> 19 >>> 20 local n = #pattern >>> 21 >>> 22 -- context.startxtable { align = "middle,lohi", width = >>> "0.8cm", >>> 23 >> offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } >>> >> >> Just comment out line 23, too, or join 22 + 23 to one line. >> >> Jano >> >> >> >> ___________________________________________________________________________________ >> 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: 5117 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-19 11:42 ` Fabrice Couvreur @ 2021-02-19 12:06 ` Hans Hagen 2021-02-19 13:12 ` Jano Kula 0 siblings, 1 reply; 14+ messages in thread From: Hans Hagen @ 2021-02-19 12:06 UTC (permalink / raw) To: mailing list for ConTeXt users, Fabrice Couvreur [-- Attachment #1: Type: text/plain, Size: 669 bytes --] On 2/19/2021 12:42 PM, Fabrice Couvreur wrote: > Hi Hans,Thanks again for the ideas to improve my code. However, I am new > to Lua and my level is far from sufficient to understand everything. Why > in no table do the crosses appear in the cells; which was my original > idea.Thank you.Fabrice I get a cross (see attached). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- [-- Attachment #2: xx.tex --] [-- Type: text/plain, Size: 3559 bytes --] \setupbodyfont[pagella] \starttext \definextable [MyTable] [align={middle,lohi}, width=0.8cm, offset=0.8ex, bodyfont=9pt, framecolor=cyan] \startluacode function document.MyTable(specification) local pattern = specification.pattern local action = specification.action local conversion = specification.conversion or "Characters" local n = #pattern -- context.startxtable { align = "middle,lohi", width = "0.8cm", offset = "0.8ex", bodyfont = "9pt", framecolor = "cyan" } context.startxtable { "MyTable" } context.startxrow() context.startxcell { frame = "off" } context() context.stopxcell() for i=1,n do context.startxcell() context.convertnumber(conversion,i) context.stopxcell() end context.stopxrow() for i=1,n do context.startxrow() context.startxcell() context.convertnumber(conversion,i) context.stopxcell() for j=1,n do context.startxcell { align = "middle" } action(string.sub(pattern[i],j,j)) context.stopxcell() end context.stopxrow() end context.stopxtable() end \stopluacode \startuniqueMPgraphic{cross}{width,height,depth,color,line} draw image ( draw (\MPvar{depth},\MPvar{height}) -- (\MPvar{width},0) ; draw (\MPvar{depth},0) -- (\MPvar{width},\MPvar{height}) ; ) withpen pencircle scaled \MPvar{line} withcolor \MPvar{color} ; \stopuniqueMPgraphic \definesymbol [MyRedCross] [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=red,line=.2ex}] \definesymbol [MyGreenCross] [\uniqueMPgraphic{cross}{width=1em,height=1ex,depth=.5ex,color=green,line=.2ex}] \startluacode document.MyTable { action = function(value) context(value == "X" and 1 or 0) end, conversion = "Characters", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \startluacode document.MyTable { action = function(value) context(value == "X" and 1 or 0) end, conversion = "Greek", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", } } \stopluacode \startluacode document.MyTable { action = function(value) if value == "X" then context.symbol { "MyRedCross" } end end, conversion = "Romannumerals", pattern = { ".XXX..XX", "X...XXX.", "X..X.XXX", "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \startluacode document.MyTable { action = function(value) context.symbol { value == "X" and "MyRedCross" or "MyGreenCross" } end, conversion = "Romannumerals", pattern = { "X.X.X..X", ".X.X.XX.", ".XX.X...", "XXX.X...", "X.XX...." } } \stopluacode \stoptext [-- Attachment #3: xx.pdf --] [-- Type: application/pdf, Size: 12946 bytes --] [-- Attachment #4: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-19 12:06 ` Hans Hagen @ 2021-02-19 13:12 ` Jano Kula 2021-02-19 13:26 ` Hans Hagen 0 siblings, 1 reply; 14+ messages in thread From: Jano Kula @ 2021-02-19 13:12 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 614 bytes --] Hi, On Fri, 19 Feb 2021 at 13:06, Hans Hagen <j.hagen@xs4all.nl> wrote: > On 2/19/2021 12:42 PM, Fabrice Couvreur wrote: > > Hi Hans,Thanks again for the ideas to improve my code. However, I am new > > to Lua and my level is far from sufficient to understand everything. Why > > in no table do the crosses appear in the cells; which was my original > > idea.Thank you.Fabrice > I get a cross (see attached). > I've got no crosses with ConTeXt ver: 2021.02.05 17:45 LMTX. Fresh install of ConTeXt ver: 2021.02.19 13:15 LMTX gives me no crosses, too. No missing fonts in both cases. Log and tuc attached. Jano [-- Attachment #1.2: Type: text/html, Size: 1025 bytes --] [-- Attachment #2: hans-metapost.log --] [-- Type: application/octet-stream, Size: 14613 bytes --] fonts > beware: no fonts are loaded yet, using 'lm mono' in box system > system > ConTeXt ver: 2021.02.19 13:15 LMTX fmt: 2021.2.19 int: english/english system > system > 'cont-new.mkxl' loaded open source > level 1, order 1, name 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl' system > beware: some patches loaded from cont-new.mkiv close source > level 1, order 1, name 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl' system > files > jobname 'hans-metapost', input './hans-metapost', result 'hans-metapost' fonts > latin modern fonts are not preloaded languages > language 'en' is active open source > level 1, order 2, name './hans-metapost.tex' open source > level 2, order 3, name 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv' close source > level 2, order 3, name 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv' metapost > initializing instance 'metafun:1' using format 'metafun' and method 'default' metapost > loading 'metafun' as 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/metafun.mpxl' using method 'default' metapost > initializing number mode 'scaled' backend > xmp > using file 'C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml' pages > flushing realpage 1, userpage 1, subpage 1 close source > level 1, order 3, name './hans-metapost.tex' system > start used files system > text: hans-metapost system > stop used files system > start used files system > 1: filename=char-prv.lua filetype=tex format=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/char-prv.lua usedmethod=database system > 2: filename=lmmono10-regular filetype=otf format=otf foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/lm/lmmono10-regular.otf fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/lm/lmmono10-regular.otf usedmethod=database system > 3: filename=publ-imp-default.lua filetype=scripts foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database system > 4: filename=cont-new.mkxl filetype=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkxl/cont-new.mkxl usedmethod=database system > 5: filename=lang-exc.lua filetype=scripts foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua usedmethod=database system > 6: filename=lang-us.lua filetype=scripts foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua usedmethod=database system > 7: filename=C:\Data\context\test/hans-metapost.tex format=tex foundname=C:/Data/context/test/hans-metapost.tex fullname=C:/Data/context/test/hans-metapost.tex usedmethod=direct system > 8: filename=type-imp-texgyre.mkiv filetype=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/type-imp-texgyre.mkiv usedmethod=database system > 9: filename=lm.lfg filetype=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg usedmethod=database system > 10: filename=texgyrepagella-regular filetype=otf format=otf foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/tex-gyre/texgyrepagella-regular.otf usedmethod=database system > 11: filename=texgyrepagella-math.otf filetype=otf format=otf foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf/fonts/opentype/public/tex-gyre-math/texgyrepagella-math.otf usedmethod=database system > 12: filename=pagella-math.lfg filetype=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/pagella-math.lfg fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/fonts/mkiv/pagella-math.lfg usedmethod=database system > 13: filename=metafun.mpxl filetype=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/metafun.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/metafun.mpxl usedmethod=database system > 14: filename=mp-base.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-base.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-base.mpxl usedmethod=database system > 15: filename=mp-tool.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-tool.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-tool.mpxl usedmethod=database system > 16: filename=mp-luas.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-luas.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-luas.mpxl usedmethod=database system > 17: filename=mp-mlib.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-mlib.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-mlib.mpxl usedmethod=database system > 18: filename=mp-math.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-math.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-math.mpxl usedmethod=database system > 19: filename=mp-cont.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-cont.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-cont.mpxl usedmethod=database system > 20: filename=mp-page.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-page.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-page.mpxl usedmethod=database system > 21: filename=mp-butt.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-butt.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-butt.mpxl usedmethod=database system > 22: filename=mp-shap.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-shap.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-shap.mpxl usedmethod=database system > 23: filename=mp-grph.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-grph.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-grph.mpxl usedmethod=database system > 24: filename=mp-grid.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-grid.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-grid.mpxl usedmethod=database system > 25: filename=mp-form.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-form.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-form.mpxl usedmethod=database system > 26: filename=mp-figs.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-figs.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-figs.mpxl usedmethod=database system > 27: filename=mp-func.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-func.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-func.mpxl usedmethod=database system > 28: filename=mp-node.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-node.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-node.mpxl usedmethod=database system > 29: filename=mp-apos.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-apos.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-apos.mpxl usedmethod=database system > 30: filename=mp-abck.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-abck.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-abck.mpxl usedmethod=database system > 31: filename=mp-blob.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-blob.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-blob.mpxl usedmethod=database system > 32: filename=mp-lmtx.mpxl filetype=mp format=mp foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-lmtx.mpxl fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/metapost/context/base/mpxl/mp-lmtx.mpxl usedmethod=database system > 33: filename=lpdf-pdx.xml filetype=tex foundname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml fullname=C:/Data/context/bin/beta-win64-lmtx/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml usedmethod=database system > stop used files system > start commandline options system > autopdf="true" system > currentrun="2" system > fulljobname="./hans-metapost.tex" system > input="./hans-metapost.tex" system > kindofrun="2" system > maxnofruns="9" system > texmfbinpath="C:/Data/context/bin/beta-win64-lmtx/tex/texmf-win64/bin" system > stop commandline options system > start commandline files system > 1: ./hans-metapost.tex system > stop commandline files modules > start used modules modules > stop used modules mkiv lua stats > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua mkiv lua stats > used cache path: C:/Data/context/bin/beta-win64-lmtx/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e mkiv lua stats > resource resolver: loadtime 0.018 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 33 found files, scanned paths: <none> mkiv lua stats > stored bytecode data: 477 modules (0.342 sec), 99 tables (0.025 sec), 576 chunks (0.367 sec) mkiv lua stats > traced context: maxstack: 1538, freed: 2, unreachable: 1536 mkiv lua stats > cleaned up reserved nodes: 72 nodes, 434 lists of 433 mkiv lua stats > node memory usage: 6 attribute, 3 attribute_list, 1 glue, 36 glue_spec, 3 kern, 2 penalty, 2 temp mkiv lua stats > node list callback tasks: 8 unique task lists, 7 instances (re)created, 1888 calls mkiv lua stats > h-node processing time: 0.011 seconds including kernel mkiv lua stats > driver time: 0.015 seconds mkiv lua stats > used backend: pdf (backend for directly generating pdf output) mkiv lua stats > jobdata time: 0.002 seconds saving, 0.001 seconds loading mkiv lua stats > callbacks: internal: 0, file: 0, direct: 0, late: 0, function 0, total: 0 (0 per page) mkiv lua stats > randomizer: resumed with value 0.4932312904298 mkiv lua stats > loaded patterns: en::1, load time: 0.000 mkiv lua stats > loaded fonts: 3 files: lmmono10-regular.otf, texgyrepagella-math.otf, texgyrepagella-regular.otf mkiv lua stats > font engine: otf 3.113, afm 1.513, tfm 1.000, 15 instances, 10 shared in backend, 3 common vectors, 7 common hashes, load time 0.293 seconds mkiv lua stats > metapost: 0.001 seconds, loading: 0.057, execution: 0.000, n: 4, average: 0.015, instances: 1, luacalls: 12190 (file: 11843, text: 0, script: 257, log: 90), memory: 3.286 M mkiv lua stats > font embedding time: 0.015 seconds, 1 fonts mkiv lua stats > result saved in file: hans-metapost.pdf, compresslevel 1, objectcompresslevel 3 mkiv lua stats > used platform: win64, type: windows, binary subtree: texmf-win64 mkiv lua stats > used engine: luametatex version: 2.0816, functionality level: 20210218, format id: 559, compiler: gcc mkiv lua stats > tex properties: 740031 hash slots used of 2097152, 45328 control sequences, approximate memory usage: 32 MB mkiv lua stats > lua properties: engine: lua 5.4, used memory: 57 MB, ctx: 54 MB, max: 56 MB, symbol mask: utf (τεχ) mkiv lua stats > runtime: 1.011 seconds, 1 processed pages, 1 shipped pages, 0.989 pages/second [-- Attachment #3: hans-metapost.tuc --] [-- Type: application/octet-stream, Size: 5895 bytes --] local utilitydata = { } utilitydata.comment={ ["escape"]="[===[ ... ]===]", ["file"]="hans-metapost", ["format"]="cont-en", ["stamp"]="2021.02.19 13:15", ["version"]=0x1.51eb851eb851fp+0, } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.variables then utilitydata.job.variables = { } end utilitydata.job.variables.checksums={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.variables then utilitydata.job.variables = { } end utilitydata.job.variables.collected={ ["macros"]={}, ["randomseed"]=0x1.f9119f970a1ap-2, ["sectionblockorder"]={}, } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.structure then utilitydata.job.structure = { } end utilitydata.job.structure.collected={ ["branches"]={}, ["name"]="", ["type"]="text", } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.positions then utilitydata.job.positions = { } end utilitydata.job.positions.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.passes then utilitydata.job.passes = { } end utilitydata.job.passes.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.datasets then utilitydata.job.datasets = { } end utilitydata.job.datasets.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.pagestates then utilitydata.job.pagestates = { } end utilitydata.job.pagestates.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.specials then utilitydata.structures.specials = { } end utilitydata.structures.specials.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.sections then utilitydata.structures.sections = { } end utilitydata.structures.sections.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.counters then utilitydata.structures.counters = { } end utilitydata.structures.counters.collected={ ["chemical"]={ { 0 }, }, ["combination"]={ { 0 }, }, ["endnote"]={ { 0 }, }, ["figure"]={ { 0 }, }, ["footnote"]={ { 0 }, }, ["formula"]={ { 0 }, }, ["graphic"]={ { 0 }, }, ["intermezzo"]={ { 0 }, }, ["itemgroup:itemize"]={ { 0 }, }, ["itemgroup:itemize:note"]={ { 0 }, }, ["linenote"]={ { 0 }, }, ["paragraph"]={ { 0 }, }, ["realpage"]={ { 1 }, }, ["subpage"]={ { 1 }, }, ["table"]={ { 0 }, }, ["textnote:note"]={ { 0 }, }, ["userpage"]={ { 1 }, }, } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.lists then utilitydata.structures.lists = { } end utilitydata.structures.lists.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.pages then utilitydata.structures.pages = { } end utilitydata.structures.pages.collected={ { ["block"]="bodypart", ["number"]=1, ["numberdata"]=1, ["prefixdata"]=2, ["state"]="start", }, } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.references then utilitydata.structures.references = { } end utilitydata.structures.references.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.references then utilitydata.structures.references = { } end utilitydata.structures.references.referred={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.parwrappers then utilitydata.job.parwrappers = { } end utilitydata.job.parwrappers.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.objects then utilitydata.job.objects = { } end utilitydata.job.objects.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.synonyms then utilitydata.structures.synonyms = { } end utilitydata.structures.synonyms.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.registers then utilitydata.structures.registers = { } end utilitydata.structures.registers.collected={ } if not utilitydata.structures then utilitydata.structures = { } end if not utilitydata.structures.blocks then utilitydata.structures.blocks = { } end utilitydata.structures.blocks.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.files then utilitydata.job.files = { } end utilitydata.job.files.collected={ } if not utilitydata.publications then utilitydata.publications = { } end utilitydata.publications.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.fileobjreferences then utilitydata.job.fileobjreferences = { } end utilitydata.job.fileobjreferences.collected={ } if not utilitydata.job then utilitydata.job = { } end if not utilitydata.job.embedded then utilitydata.job.embedded = { } end utilitydata.job.embedded.collected={ } utilitydata.job.packed={ ["index"]={ { ["conversionset"]="pagenumber", }, { ["connector"]="–", ["prefix"]="no", ["set"]="part", }, }, ["keys"]={ ["directives"]=true, ["metadata"]=true, ["numberdata"]=true, ["numbers"]=true, ["ownnumbers"]=true, ["pagedata"]=true, ["prefixdata"]=true, ["processors"]=true, ["sectiondata"]=true, ["specification"]=true, }, ["skip"]={ ["datasets"]=true, ["positions"]=true, ["userdata"]=true, }, ["version"]=0x1.051eb851eb852p+0, } return utilitydata [-- Attachment #4: Type: text/plain, Size: 493 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] 14+ messages in thread
* Re: Lua code and table 2021-02-19 13:12 ` Jano Kula @ 2021-02-19 13:26 ` Hans Hagen 2021-02-20 17:21 ` Fabrice Couvreur 0 siblings, 1 reply; 14+ messages in thread From: Hans Hagen @ 2021-02-19 13:26 UTC (permalink / raw) To: mailing list for ConTeXt users, Jano Kula On 2/19/2021 2:12 PM, Jano Kula wrote: > Hi, > > On Fri, 19 Feb 2021 at 13:06, Hans Hagen <j.hagen@xs4all.nl > <mailto:j.hagen@xs4all.nl>> wrote: > > On 2/19/2021 12:42 PM, Fabrice Couvreur wrote: > > Hi Hans,Thanks again for the ideas to improve my code. However, I > am new > > to Lua and my level is far from sufficient to understand > everything. Why > > in no table do the crosses appear in the cells; which was my > original > > idea.Thank you.Fabrice > I get a cross (see attached). > > > I've got no crosses with ConTeXt ver: 2021.02.05 17:45 LMTX. > Fresh install of ConTeXt ver: 2021.02.19 13:15 LMTX gives me no > crosses, too. > No missing fonts in both cases. > Log and tuc attached. And with the previously attached xx.tex file? maybe the mailer messes up something? Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ 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] 14+ messages in thread
* Re: Lua code and table 2021-02-19 13:26 ` Hans Hagen @ 2021-02-20 17:21 ` Fabrice Couvreur 0 siblings, 0 replies; 14+ messages in thread From: Fabrice Couvreur @ 2021-02-20 17:21 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 1924 bytes --] Hi Hans The xx.tex file works for me Thanks Fabrice Le ven. 19 févr. 2021 à 14:28, Hans Hagen <j.hagen@xs4all.nl> a écrit : > On 2/19/2021 2:12 PM, Jano Kula wrote: > > Hi, > > > > On Fri, 19 Feb 2021 at 13:06, Hans Hagen <j.hagen@xs4all.nl > > <mailto:j.hagen@xs4all.nl>> wrote: > > > > On 2/19/2021 12:42 PM, Fabrice Couvreur wrote: > > > Hi Hans,Thanks again for the ideas to improve my code. However, I > > am new > > > to Lua and my level is far from sufficient to understand > > everything. Why > > > in no table do the crosses appear in the cells; which was my > > original > > > idea.Thank you.Fabrice > > I get a cross (see attached). > > > > > > I've got no crosses with ConTeXt ver: 2021.02.05 17:45 LMTX. > > Fresh install of ConTeXt ver: 2021.02.19 13:15 LMTX gives me no > > crosses, too. > > No missing fonts in both cases. > > Log and tuc attached. > And with the previously attached xx.tex file? maybe the mailer messes up > something? > > Hans > > ----------------------------------------------------------------- > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl > ----------------------------------------------------------------- > > ___________________________________________________________________________________ > 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: 3962 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 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] 14+ messages in thread
end of thread, other threads:[~2021-02-20 17:21 UTC | newest] Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-02-17 17:40 Lua code and table Fabrice Couvreur 2021-02-17 21:13 ` Tomas Hala 2021-02-17 21:26 ` Wolfgang Schuster 2021-02-17 22:52 ` Hans Hagen 2021-02-17 23:22 ` Bruce Horrocks 2021-02-18 9:06 ` Hans Hagen 2021-02-18 15:14 ` Fabrice Couvreur 2021-02-18 15:26 ` Jano Kula 2021-02-18 15:28 ` Fabrice Couvreur 2021-02-19 11:42 ` Fabrice Couvreur 2021-02-19 12:06 ` Hans Hagen 2021-02-19 13:12 ` Jano Kula 2021-02-19 13:26 ` Hans Hagen 2021-02-20 17:21 ` Fabrice Couvreur
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).