First Steps: Mathematics
One small lesson, start to finish: a typeset problem and an answer box that scores itself. Copy the markdown below onto a new page and adjust.
The markdown
## Solving a quadratic
Solve $x^2 - x - 6 = 0$ by factoring.
<question id="quad1" type="text" points="2" showFeedback="true">
Type both roots, separated by a comma (e.g. `1, 2`).
```expected ignore-whitespace
3, -2
```
</question>
What renders
Solving a quadratic
Solve by factoring.
The two parts
- The math is plain KaTeX —
$x^2 - x - 6 = 0$inline,$$...$$for a display equation. - The check is a free-text question (
type="text") with anexpectedblock: the student's typed answer is diffed against3, -2.ignore-whitespacestops spacing around the comma from costing points.points="2"is the max score;showFeedback="true"shows the diff to the student right away — drop it for exams, where feedback stays hidden until the teacher grades.
That covers a numeric answer with partial credit. For sliders that auto-grade against a tolerance, and for scoring code that computes a math result, see Math and Graph Plotter and Code Editors & Scoring in the Components section.