Question banks in Typst, sampled into exams with balanced versions.
This is the Typst half of sortes.
You write the bank and the exams with it, and preview both in your editor.
The sortes command draws each exam’s questions, shuffles them into versions whose answer letters are spread evenly, and renders the print and solution PDFs.
Install it with uv tool install sortes.
Bank
#import "@preview/sortes:0.1.0": *
= Supervised Learning and Regression <regression>
#q(<supervised-def>)[
What is supervised learning?
- Minimizing a function given data
- #correct[Approximating the function $bold(x) |-> y$ from labeled data]
- Learning without labels
#why[It learns from labeled pairs.]
]
#q(<normal-eq-shape>)[
$bold(X)$ has $N$ rows and $D$ columns. What is the shape of $bold(X)^top bold(X)$?
#blank(expect: [a *shape*])[$D times D$]
]
#q(<normal-eq-derive>, points: 4)[
Derive the normal equation for linear regression.
#answer(height: 5cm)[Set the gradient of the squared error to zero and solve for $bold(theta)$.]
]
A question has one of three answer types: choices (a - list with #correct[...]), one line (#blank[...]), or a box (#answer[...]).
A heading with a label starts a section that exams draw from.
The preview shows every question with its ID and the right answers marked.
Exam
#import "@preview/sortes:0.1.0": *
#show: sortes.with(
bank: include "../bank.typ",
lock: json("sortes.lock"),
title: "Midterm",
versions: 2,
points: 20,
)
= Regression
#pick(<supervised-def>)
#draw(<regression>, 2)
sortes build midterm.typ draws the questions once and records them in sortes.lock.
Until then, the preview shows a placeholder for each draw.
See the guide and the references.