feat: revamp template API and box components

This commit is contained in:
Popa committed 2026-09-11 14:00:59 +02:00
1 parent 51fc2ef3c3
commit 337ff33853
8 files changed
+211 -130

No files matched your search

+46 -26
View File
@@ -1,21 +1,37 @@
#import "@preview/clean-sheets:0.3.0": Cal, base-template, ex_box, qed
#import "@preview/clean-sheets:0.3.0": Cal, base-template, exercise, qed
#let logo = box(
width: 2.4cm,
height: 1cm,
stroke: 0.8pt + eastern,
radius: 3pt,
align(center + horizon, text(fill: eastern, weight: "bold")[UNI LOGO]),
)
#show: body => base-template(
1,
none, // sheetnumber can be omitted for an unnumbered exercise sheet
[Linear Algebra I],
[Prof. Dr. Daniel Docent],
[Dr. Anne Assistant],
4,
([Jane Doe], [Joe Shmoe]),
[John Q. Public],
show-logo: false,
show-end-message: true,
[John Q. Public, James X. Smith],
tutor-label: [Tutors:],
sheet-label: [Example Exercise Sheet],
logo: logo,
page-numbering: "— I of I —",
table-header-smallcaps: true,
text-font: "IBM Plex Sans",
math-font: "IBM Plex Math",
no-pagebreak: true,
show-credits: true,
credits: [_Typset with #link("https://typst.app")[Typst]._],
body,
)
= Exercise 1
#ex_box(
#exercise(
heading: [#lorem(5)],
points: [$5 + 10 + 5$ Points],
)[
@@ -32,16 +48,34 @@
#lorem(40)
]
#lorem(59)#footnote[#lorem(21)]
#lorem(20)#footnote[#lorem(21)]
$
(a + b)^n = sum_(k = 0)^n binom(n, k) space.thin a^(n - k) b^k
bold("B")(P) =
mu_0 / (4 pi)
integral
(I times bold(hat("r"))) / r^2 dif bold(l)
= (mu_0 I) / (4 pi)
integral
(dif bold(l) times bold(hat("r"))) / r^2
$
#lorem(30) #qed
#table(
columns: (1fr,) * 5,
align: (start,) + (center,) * 3 + (end,),
table.header([Header 1], [Header 2], [Header 3], [Header 4], [Header 5]),
[Cell 1], [Cell 2], [Cell 3], [Cell 4], [Cell 5],
[Cell 6], [Cell 7], [Cell 8], [Cell 9], [Cell 10],
[Cell 11], [Cell 12], [Cell 13], [Cell 14], [Cell 15],
)
= Exercise 2
#ex_box(points: [$25$ Points])[
#exercise(points: [$25$ Points])[
#lorem(41)
#lorem(26)
@@ -65,17 +99,13 @@ $
det V(x_1, ..., x_n) = product_(1 <= i < j <= n)(x_j - x_i)
$
#lorem(60)#footnote[#lorem(31)]#footnote[#lorem(13)] #qed
#lorem(59)#footnote[#lorem(31)]#footnote[#lorem(13)]
#lorem(30) #qed
= Exercise 3
#ex_box(heading: [#lorem(8)])[
#lorem(20)
#lorem(30)
]
#exercise[#lorem(20)]
```js
#!/usr/bin/env node
@@ -90,14 +120,4 @@ if (π >= 0 && π !== Infinity || !NaN) for (const [k,v] of Object.entries(obj))
try { await Promise.resolve(fn?.({foo:n=>n**2})); } catch (e) { console.error(`${e}`); }
```
$
bold("B")(P) =
mu_0 / (4 pi)
integral
(I times bold(hat("r"))) / r^2 dif bold(l)
= (mu_0 I) / (4 pi)
integral
(dif bold(l) times bold(hat("r"))) / r^2
$
#lorem(30) #qed
#lorem(20) #qed