fix: handle latex equations when rendering typst

This commit is contained in:
2026-09-14 04:20:15 -04:00
parent b375e6c94f
commit 51f095d677
7 changed files with 223 additions and 18 deletions
@@ -12,6 +12,8 @@
// templates/typst.yaml under `extra` rather than editing the geometry here, and
// check one printed page against your scanner before running a class through it.
#import "@preview/mitex:0.2.7": mi
// coursebank:begin data
#let cb-data = (
course: (code: "COURSE 101", title: "Sample Course", term: "2026s"),
+23 -6
View File
@@ -24,6 +24,8 @@
// copy — export the `key` variant instead, or the day you forget an `if` is the
// day the class gets the answers.
#import "@preview/mitex:0.2.7": mi
// ─────────────────────────────────────────────────────────────────────────────
// Metadata
// ─────────────────────────────────────────────────────────────────────────────
@@ -52,12 +54,14 @@
// how a course changes the look without editing this file at all.
#let extra = cb-meta.at("extra", default: (:))
#let accent = rgb(extra.at("accent", default: "#1f4e79"))
#let body-font = extra.at("font", default: "Libertinus Serif")
#let body-font = extra.at("font", default: "Roboto")
#let body-size = eval(extra.at("font-size", default: "11pt"))
#let paper = extra.at("paper", default: "us-letter")
#let show-name-block = extra.at("name-block", default: true)
#let show-points = extra.at("show-points", default: true)
#let page-per-item = extra.at("page-per-item", default: false)
#let show-bubbles = extra.at("show-bubbles", default: true)
#let bubble-radius = eval(extra.at("bubble-radius", default: "0.42em"))
#let form-note = if cb-meta.form.at("count", default: 1) > 1 {
" · Form " + cb-meta.form.id
@@ -120,6 +124,11 @@
}
}
// An unfilled bubble a student marks by hand. `bubble-radius` is the same knob
// the standalone answer sheet reads, so the two stay visually consistent if you
// ever generate both.
#let bubble() = circle(radius: bubble-radius, stroke: 0.5pt)
// ─────────────────────────────────────────────────────────────────────────────
// The renderer
// ─────────────────────────────────────────────────────────────────────────────
@@ -154,11 +163,19 @@
block(inset: (left: 1.2em))[
#for opt in q.at("options", default: ()) {
grid(
columns: (1.4em, 1fr),
gutter: 0.2em,
[#(opt.letter + ".")], [#markup(opt.text)],
)
if show-bubbles {
grid(
columns: (1.6em, 1.4em, 1fr),
gutter: 0.2em,
align(horizon)[#bubble()], [#(opt.letter + ".")], [#markup(opt.text)],
)
} else {
grid(
columns: (1.4em, 1fr),
gutter: 0.2em,
[#(opt.letter + ".")], [#markup(opt.text)],
)
}
v(0.15em)
}
]
+2
View File
@@ -13,6 +13,8 @@
// paper's config, and it is why these are two templates rather than one with a
// flag.
#import "@preview/mitex:0.2.7": mi
// coursebank:begin data
#let cb-data = (
course: (code: "COURSE 101", title: "Sample Course", term: "2026s"),