How to fill area in table, including gutter between cells?

Hey, I have a table without borders, and I would like to fill an area of it gray. However, the gutter results in a gap in the fill between the cells. For example, here I want to fill the second row:

#table(
  gutter: 1cm,
  columns: 2,
  stroke: none,
  [Normal],[Row],
  table.cell([Join], fill: gray),table.cell([me], fill: gray)
)

Unfortunately, it looks like this:

Any ideas how to fix this?

Use inset instead to adjust your table cell size:

#table(
  inset: 0.5cm,
  columns: 2,
  stroke: none,
  [Normal],[Row],
  table.cell([Join], fill: gray),table.cell([me], fill: gray)
)

Here is the result:

Adjust the value inset: 0.5cm according to your requirement or You can apply selectively for either x or y like inset:(y:0.5cm). gutter is the gap between cells, hence wont get colored since only cells are being styled, whereas inset is the padding, hence whole cell along with the padding area will get applied with the style.

2 Likes

Hey. This is not possible as explained in How to fill area in table, including gutter between cells? - #2 by Ujjwal_Jyoti_Goswami. The only alternative is to fill the table’s background with block:

#block(fill: gray.lighten(20%), table(
  columns: 2,
  gutter: 1cm,
  stroke: none,
  fill: (_, y) => if y == 1 { gray },
  [Normal], [Row],
  [Join], [me],
))

#block(fill: gray.lighten(20%), table(
  columns: 2,
  gutter: 1cm,
  stroke: none,
  fill: (_, y) => if y == 1 { gray } else { white },
  [Normal], [Row],
  [Join], [me],
))

@Ujjwal_Jyoti_Goswami thank you very much for the answers! This works for me :)

1 Like