Color specific cells in a table
Hello, This table will be used to illustrate Pascal's triangle. I manage to color the cell (2,0) but I would also like to color the cells (2,1) and (3,1). Is it possible ? Thank you Fabrice \usecolors[X11] \starttext \startluacode local background_one = { align = "middle", style = "type", background = "color", backgroundcolor = "thistle2", foregroundcolor = "white", } local background_two = { align = "middle", style = "type", background = "color", backgroundcolor = "peachpuff", foregroundcolor = "white", } context.startxtable({"align={middle,lohi}, width=1cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"}) context.startxrow() context.startxcell({"background=color,backgroundcolor=thistle2"}) context("") context.stopxcell() for j = 0, 7 do context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"}) context(j) context.stopxcell() end context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"}) context("\\dots") context.stopxcell() context.stopxrow() for i = 0, 7 do context.startxrow() context.startxcell({"foregroundstyle=bold,background=color,backgroundcolor=thistle2"}) context(i) context.stopxcell() for j = 0, 8 do context.startxcell(j>i and background_one or i == 2 and j == 0 and background_two) context("") context.stopxcell() end context.stopxrow() end context.startxrow() context.startxcell({"background=color,backgroundcolor=thistle2"}) context("\\dots") context.stopxcell() for i = 0, 8 do context.startxcell() context("") context.stopxcell() end context.stopxrow() context.stopxtable() \stopluacode \stoptext
participants (1)
-
Fabrice Couvreur