1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
// Test basic styling using the table.cell element.
---
// Cell override
#table(
align: left,
fill: red,
stroke: blue,
columns: 2,
[AAAAA], [BBBBB],
[A], [B],
table.cell(align: right)[C], [D],
align(right)[E], [F],
align(horizon)[G], [A\ A\ A],
table.cell(align: horizon)[G2], [A\ A\ A],
table.cell(inset: 0pt)[I], [F],
[H], table.cell(fill: blue)[J]
)
---
// Cell show rule
#show table.cell: it => [Zz]
#table(
align: left,
fill: red,
stroke: blue,
columns: 2,
[AAAAA], [BBBBB],
[A], [B],
table.cell(align: right)[C], [D],
align(right)[E], [F],
align(horizon)[G], [A\ A\ A]
)
---
#show table.cell: it => (it.align, it.fill)
#table(
align: left,
row-gutter: 5pt,
[A],
table.cell(align: right)[B],
table.cell(fill: aqua)[B],
)
---
// Cell set rules
#set table.cell(align: center)
#show table.cell: it => (it.align, it.fill, it.inset)
#set table.cell(inset: 20pt)
#table(
align: left,
row-gutter: 5pt,
[A],
table.cell(align: right)[B],
table.cell(fill: aqua)[B],
)
---
// Test folding per-cell properties (align and inset)
#table(
columns: (1fr, 1fr),
rows: (2.5em, auto),
align: right,
fill: (x, y) => (green, aqua).at(calc.rem(x + y, 2)),
[Top], table.cell(align: bottom)[Bot],
table.cell(inset: (bottom: 0pt))[Bot], table.cell(inset: (bottom: 0pt))[Bot]
)
---
// Test overriding outside alignment
#set align(bottom + right)
#table(
columns: (1fr, 1fr),
rows: 2em,
align: auto,
fill: green,
[BR], [BR],
table.cell(align: left, fill: aqua)[BL], table.cell(align: top, fill: red.lighten(50%))[TR]
)
---
// First doc example
#table(
columns: 2,
fill: green,
align: right,
[*Name*], [*Data*],
table.cell(fill: blue)[J.], [Organizer],
table.cell(align: center)[K.], [Leader],
[M.], table.cell(inset: 0pt)[Player]
)
---
#{
show table.cell: emph
table(
columns: 2,
[Person], [Animal],
[John], [Dog]
)
}
---
// Style based on position
#{
show table.cell: it => {
if it.y == 0 {
strong(it)
} else if it.x == 1 {
emph(it)
} else {
it
}
}
table(
columns: 3,
gutter: 3pt,
[Name], [Age], [Info],
[John], [52], [Nice],
[Mary], [50], [Cool],
[Jake], [49], [Epic]
)
}
---
// Error: 8-19 cannot use `grid.cell` as a table cell; use `table.cell` instead
#table(grid.cell[])
|