Exam sampler for Typst. Sortes (SOR-tays) is Latin for random draws.
With Homebrew, which also installs Typst:
brew install wiseodd/tap/sortesOr install Typst and uv, then:
uv tool install sortessortes runs on macOS (Apple silicon) and Linux (x86, ARM). On Windows, use WSL.
Create a course (replace <course> with your course name) and a term inside it (replace <term> with e.g. W2027):
sortes init <course>
cd <course>
sortes term <term>This will create a directory called <course> with bank.typ and typst.toml inside, and an empty term directory <term>.
bank.typ is your question bank, and it has a few example questions to start from.
A question looks like this:
#import "@local/sortes:1.0.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
]Say, the term is W2027 and you write an exam midterm.typ in it.
It uses your own template and asks for questions by section or by ID:
#import "@local/sortes:1.0.0": *
#show: sortes.with(
bank: include "../bank.typ",
lock: json("sortes.lock"),
title: "Midterm",
versions: 2,
points: 20,
)
#draw(<regression>, 3)
#pick(<normal-eq-derive>)Both are ordinary Typst files, so you can preview them in your editor, with <course> as the project root.
Then:
sortes build W2027/midterm.typIn W2027/PDFs, it will output midterm-A.pdf and midterm-B.pdf, and their solutions midterm-A-sol.pdf and midterm-B-sol.pdf.
Print the former.
The questions it drew are recorded in W2027/sortes.lock, so building again gives the same exam.
Commit it with your exams.
More info: https://sortes.kristia.de
make check # fmt, clippy, tests (tests need typst)
make docs # build the docs site into docs/dist