This commit is contained in:
Gaspard Jankowiak 2025-11-17 20:47:05 +01:00
commit 921082f61d
3 changed files with 66 additions and 40 deletions

View file

@ -20,7 +20,7 @@ A summary is then printed on the front page.
Writing an exam is now easy:
#import "@local/exam:0.1.0": exam, exercise_header, exercise_items, mtext
#import "@local/exam:0.1.0": exam, exercise, exercise-items, mtext
#show: exam.with(
title: "Exam",
@ -32,7 +32,7 @@ Writing an exam is now easy:
date: "1. January 1970",
course_short_title: "ABC & EFG",
course_number: "π",
course_code: "π",
duration_minutes: "90",
ask_trainer_name: false,
@ -43,37 +43,59 @@ Writing an exam is now easy:
### Defining exercises and items
A new exercise can be started using `#exercise_header("title", nb_points)`, for example:
A new exercise can be started using `#exercise("title", nb_points)`, for example:
#exercise_header("Relations and their properties", 2)
#exercise("Relations and their properties", 2)
Consider the relation $R subset NN^2$, defined as follows:
$ (x, y) in R #h(0.5cm) <==> #h(0.5cm) x + y #mtext[is odd]. $
Is $R$ reflexive? transitiv? symmetrisch? antisymmetrisch?
Is $R$ reflexive? transitive? symmetric? antisymmetric?
On can also defined (sub-)items for the exercise using `#exercise_items(items, override_points:true)`,
On can also defined (sub-)items for the exercise using `#exercise-items(override_points:true, numbering:"a)", items)`,
where `items` is an array of `(nb_points, statement)`. By default, the number of points the exercise
is worth is recomputed as the sum of points for all items. This behaviour can be turned off by
setting `override_points: false`.
#exercise_header("Properties of functions", 3)
#exercise("Properties of functions", 3)
Let $f : (0, +infinity) → (0, +infinity)$ with $f (x) = e^(-x)$.
#exercise_items((
#exercise-items((
(1, [Is $f$ injective?]),
(1, [Is $f$ surjective?]),
(1, [Is $f$ bijective?]),
))
#exercise("Logical operators", 3.14)
Consider the following truthtable:
#align(center, table(
stroke: frame(0.5pt),
columns: (auto, auto, auto),
align: center,
[$A$], [$B$], [$A or B$],
[1], [1], [1],
[1], [0], [1],
[0], [1], [1],
[0], [0], [1]
))
#exercise-items(override-points: false, numbering: "i)", (
(1, [Is the truthtable correct?]),
(1, [If not, fix it.]),
))
All together, this should output something like:
![screenshot](screenshot-example.png)
### Utilities
These are used in the example above.
- `mtext(str)` to typeset text within math mode using the default text font.
- `frame(stroke_width)` provides `stroke` for use in a `table`, horizontal lines only,
top and bottom lines are bold.