Repository navigation
|
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"
) |
Answered by
PgBiel
Dec 17, 2023
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 |
1 reply
Answer selected by
yoonghm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Hello,
map-cellsprovides you acellxas 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…