You could use a grid for each row of the column of distributed cells. You would then treat everything as a single cell from the perspective of the table. This allows you to distribute the cells without measuring anything (other than the number of cells/elements in each row).
Some notes/warnings and things I have noticed so far:
- You have to share the style of the table with the grid inside the function
distributed-cells()
. This is not an issue as long as you use variables for align, stroke, inset etc… - The outer stroke of the distribute cells is currently drawn by the table and the grid. I don’t know if my brain is playing tricks on me here, but it does look like the lines are too thick. If that is bothering you as well, you can only draw the inner lines in the grid.
- Currently the table will collapse if your page width is set to auto since both the column widths inside the grid and the width of the column “Characteristic” in the table use the fractional length
1fr
. This will not be an issue if your paper size is set to A4 or if you are wrapping the table in a block to specify the width.
#let distribute-cells(..cells) = table.cell(inset: 0pt,
grid(
columns: (1fr,) * cells.pos().len(),
align: center + horizon,
stroke: 1pt,
inset: 5pt,
..cells,
)
)
#table(
columns: (auto, 1fr),
align: center + horizon,
stroke: 1pt,
table.header("Dimension", "Characteristic"),
"Input", distribute-cells("Text", "Image", "Audio", "Video"),
"Output", distribute-cells("Text", "Image", "Audio", "Video", "3D-Model"),
"Type of task", distribute-cells("Information processing", "Problem solving", "Social", "Physical"),
)