Download src/classroom/typst/lib.typ from zal-analytics-core/znote-data: direct link, hf CLI and curl.
- Browser
- Download file 4.11 kB
-
https://huggingface.co/datasets/zal-analytics-core/znote-data/resolve/main/src/classroom/typst/lib.typ
- Command line
-
hf download hf://datasets/zal-analytics-core/znote-data/src/classroom/typst/lib.typ
-
curl -L -o lib.typ https://huggingface.co/datasets/zal-analytics-core/znote-data/resolve/main/src/classroom/typst/lib.typ
4.11 kB
| #let ink = rgb("#26323a") | |
| #let teal = rgb("#0f766e") | |
| #let orange = rgb("#c2410c") | |
| #let blue = rgb("#1d4ed8") | |
| #let quiet = rgb("#66757f") | |
| #let sans = ("Segoe UI", "Helvetica Neue", "Arial", "Libertinus Serif") | |
| #let today = datetime.today().display("[day padding:none] [month repr:long] [year]") | |
| #let question-number = counter("classroom-question") | |
| #let points-total = state("classroom-points", 0) | |
| #let base(body) = { | |
| set text(font: sans, size: 11pt, fill: ink, lang: "en") | |
| set par(leading: 0.7em, spacing: 1.2em) | |
| show heading: set text(fill: teal) | |
| show heading: set block(above: 1.5em, below: 0.8em) | |
| body | |
| } | |
| #let sheet(course, title, body) = { | |
| show: base | |
| set page( | |
| paper: "a4", | |
| margin: (x: 2.3cm, top: 2.8cm, bottom: 2.3cm), | |
| header: text(size: 9pt, fill: quiet)[#course #h(1fr) #title], | |
| footer: context align(center, text(size: 9pt, fill: quiet, counter(page).display())), | |
| ) | |
| body | |
| } | |
| #let callout(colour, label, title, body) = block( | |
| width: 100%, | |
| inset: (left: 12pt, rest: 8pt), | |
| stroke: (left: 3pt + colour), | |
| fill: colour.lighten(92%), | |
| [#text(weight: "bold", fill: colour)[#label#if title != none [: #title]] \ #body], | |
| ) | |
| #let definition(title: none, body) = callout(teal, "Definition", title, body) | |
| #let example(title: none, body) = callout(blue, "Example", title, body) | |
| #let remark(title: none, body) = callout(orange, "Note", title, body) | |
| #let question(points: none, body) = { | |
| question-number.step() | |
| if points != none { points-total.update(total => total + points) } | |
| block(width: 100%, above: 1.6em, below: 0.8em)[ | |
| #text(weight: "bold", fill: teal, context question-number.display("1.")) | |
| #body | |
| #if points != none { h(1fr); text(size: 9pt, fill: quiet)[(#points #if points == 1 [point] else [points])] } | |
| ] | |
| } | |
| #let answer-lines(count) = for _ in range(count) { | |
| v(1.9em) | |
| line(length: 100%, stroke: 0.4pt + quiet) | |
| } | |
| #let notes(title: "Title", course: none, lecturer: none, date: today, body) = { | |
| show: sheet.with(course, title) | |
| set par(justify: true) | |
| set heading(numbering: "1.1") | |
| block(below: 2em)[ | |
| #text(size: 22pt, weight: "bold", fill: teal, title) \ | |
| #text(size: 10pt, fill: quiet, (course, lecturer, date).filter(part => part != none).join[ · ]) | |
| ] | |
| body | |
| } | |
| #let worksheet(title: "Title", course: none, body) = { | |
| show: sheet.with(course, title) | |
| text(size: 20pt, weight: "bold", fill: teal, title) | |
| block(above: 1.2em, below: 1.8em, grid( | |
| columns: (auto, 2fr, auto, 1fr), | |
| gutter: 0.6em, | |
| align: bottom, | |
| [Name:], line(length: 100%, stroke: 0.4pt + quiet), [Date:], line(length: 100%, stroke: 0.4pt + quiet), | |
| )) | |
| body | |
| } | |
| #let exam(title: "Title", course: none, duration: none, date: today, body) = { | |
| show: sheet.with(course, title) | |
| align(center)[ | |
| #text(size: 22pt, weight: "bold", fill: teal, title) \ | |
| #text(fill: quiet, (course, date).filter(part => part != none).join[ · ]) | |
| ] | |
| block(width: 100%, above: 1.5em, below: 2em, inset: 10pt, stroke: 0.6pt + teal, grid( | |
| columns: (auto, 1fr, auto, auto), | |
| gutter: 0.7em, | |
| align: bottom, | |
| [Name:], line(length: 100%, stroke: 0.4pt + quiet), | |
| [#if duration != none [Time: #duration]], | |
| context [Points: #box(width: 2.5em, line(length: 100%, stroke: 0.4pt + quiet)) / #points-total.final()], | |
| )) | |
| body | |
| } | |
| #let slides(title: "Title", course: none, lecturer: none, date: today, body) = { | |
| show: base | |
| set text(size: 20pt) | |
| set page( | |
| paper: "presentation-16-9", | |
| margin: (x: 2cm, top: 2cm, bottom: 1.8cm), | |
| footer: context text(size: 11pt, fill: quiet)[#course #h(1fr) #counter(page).display()], | |
| ) | |
| show heading.where(level: 1): it => { | |
| pagebreak(weak: true) | |
| block(below: 1em, stroke: (bottom: 2pt + orange), inset: (bottom: 8pt), text(size: 30pt, weight: "bold", fill: teal, it.body)) | |
| } | |
| show heading.where(level: 2): set text(size: 22pt) | |
| page(footer: none, align(horizon)[ | |
| #rect(width: 4cm, height: 6pt, fill: orange) | |
| #text(size: 40pt, weight: "bold", fill: teal, title) | |
| #text(size: 16pt, fill: quiet, (course, lecturer, date).filter(part => part != none).join[ · ]) | |
| ]) | |
| body | |
| } | |