How to fill entire columns of a table?

you can always write your own:

#let autotable(
  fills: ((0, "1"), (2, "A")),
  columns: (5%,30%,5%,30%,30%),
  header,
  ..cells
) = {
  let rows = cells.pos().chunks(columns.len() - fills.len())
  let filled-rows = rows.enumerate().map(((y, row)) => {
    for (fill-pos, fill-pattern) in fills {
      row.insert(fill-pos, numbering(fill-pattern, y + 1))
    }
    row
  })
  table(columns: columns, header, ..filled-rows.flatten())
}

then use it like:

#autotable(
  table.header(
    [], [*Column A*], [],[*Column B*],[*Answer* \
    (Write the alphabet of Column B)]
  ),
  [Hicks],[Samuelson],[#h(0.8em)1--],
  [Marshall],[Edgeworth],[#h(0.8em)2--],
  [Jorda],[Friedman],[#h(0.8em)3--],
  [Mankiw],[Hicks],[#h(0.8em)4--],
  [Samuelson],[Marshall],[#h(0.8em)5--],
  [Samuelson],[Marshall],[#h(0.8em)6--],
  [Samuelson],[Marshall],[#h(0.8em)7--],
  [Samuelson],[Marshall],[#h(0.8em)8--],
  [Samuelson],[Marshall],[#h(0.8em)9--],
  [Samuelson],[Marshall],[#h(0.8em)10--],
)

(it’s not very robust of course)

1 Like