On 17 Feb 2021, at 17:40, Fabrice Couvreur
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