-
I use the following code to render a table. I want to align the heading rows to the center and fill it with different colour. However, it does not k if #figure(
tablex(
columns: (1fr, 4fr),
align: left,
auto-vlines: false,
header-rows: 1,
map-cells: cell => {
if cell.y == 0 {
cell.align = right // no effect
cell.fill = blue // no effect
set text(size: 14pt, fill: red)
strong(cell.content)
}
else {
set text(size: 12pt)
cell.content
}
},
/* Header */
// cellx(...) also has no effect
cellx(fill: blue, align: center)[Index], cellx(fill: blue, align: center)[Example],
[`A` ], [Apple],
[`B` ], [Ball],
[`C` ], [Car],
),
kind: table,
caption: "English alphabet"
) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello,
This means you need to do the following:
Note that there is no other way to provide data to tablex other than by returning the cell here - the |
Beta Was this translation helpful? Give feedback.
Hello,
map-cells
provides you acellx
as a parameter and expects you to return acellx
. When you return the cell's content, you are discarding all other properties from thecellx
.This means you need to do the following:
Note that there is no other way to provide data to tabl…