Files
clean-sheets/src/components/student-table.typ
T

54 lines
1.2 KiB
Typst

#let _student-names(students) = {
if type(students) == str {
students
} else {
students.join(", ")
}
}
#let exercise-overview(exercises, students, tutor, col: black, border: gray, tutor-label: none) = {
let text-color = col.darken(25%)
let _s = 0.4pt + border
set par(justify: false)
grid(
columns: (1fr, 1fr),
column-gutter: 1em,
stroke: (bottom: 0.5pt + text-color),
inset: (y: 0.75em),
align: bottom,
grid(
columns: 2,
column-gutter: 1em,
text(fill: text-color)[Name:], _student-names(students),
),
grid(
columns: 2,
column-gutter: 1em,
text(fill: text-color)[#if tutor-label != none { tutor-label } else { [Tutor:] }], tutor,
),
)
let ex_cells = ()
for i in range(1, exercises + 1) {
ex_cells += (table.cell(stroke: (right: _s, bottom: _s))[A#i],)
}
v(0.75cm)
set text(fill: text-color)
align(
center,
table(
columns: (4em,) * exercises + (1.2pt, 4em),
align: center,
stroke: none,
..ex_cells,
table.cell(stroke: (bottom: _s, right: _s))[],
table.cell(stroke: (bottom: _s))[$Sigma$],
..(table.cell(stroke: (right: _s), inset: (y: 0.75em))[],) * (exercises + 1),
),
)
}