Fixes
This commit is contained in:
parent
f08c30f12b
commit
eb80c5c71c
27
exam/lib.typ
27
exam/lib.typ
@ -22,7 +22,13 @@
|
||||
stop_value.at(0) - start_value.at(0)
|
||||
}
|
||||
|
||||
#let show_points(pts) = [#pts] + if pts < 2 { " pt" } else { " pts" }
|
||||
#let show_points(pts) = if pts == 0 {
|
||||
none
|
||||
} else if pts == 1 {
|
||||
[(1 pt)]
|
||||
} else {
|
||||
[(#pts pts)]
|
||||
}
|
||||
|
||||
// Rend les réponses visibles seulement si compilé avec `--input mode=solution`
|
||||
#let solution(content) = if enable_solutions { set text(fill: olive); content } else { hide(content) }
|
||||
@ -55,6 +61,7 @@
|
||||
|
||||
let date = if date == none { datetime.today() } else { date };
|
||||
let year = if year == none { date.year() } else { year };
|
||||
let total = context [#pctr.final().at(0)]
|
||||
|
||||
|
||||
let indications = if indications == none {
|
||||
@ -94,25 +101,37 @@
|
||||
indications
|
||||
}
|
||||
|
||||
v(5%)
|
||||
|
||||
align(right, text(size: 12pt, [Total: #total points]))
|
||||
|
||||
}
|
||||
|
||||
pagebreak()
|
||||
|
||||
set text(font: "Carlito", size: 12pt)
|
||||
show heading: h => pad(bottom: 0.5em, text(fill: eastern, size: 16pt, weight: "light", [#(h.body) (#show_points(points_counter(h)))]))
|
||||
show heading: h => pad(bottom: 0.5em, text(fill: eastern, size: 16pt, weight: "light", h.body + " " + show_points(points_counter(h))))
|
||||
|
||||
set page(header: [#course #year - #title], footer: align(right, text(fill: gray, "Page ") + context counter(page).display("1 | 1", both: true)))
|
||||
let head = text(fill: gray)[#course #year - #title];
|
||||
|
||||
set page(header: head, footer: align(right, text(fill: gray, "Page ") + context counter(page).display("1 | 1", both: true)))
|
||||
doc
|
||||
};
|
||||
|
||||
// Bloc réponse caché en mode production
|
||||
#let reponse(a) = {
|
||||
let answ_block = block(width: 100%, inset: 1em, solution(a));
|
||||
block(stroke: black, answ_block)
|
||||
v(2em)
|
||||
}
|
||||
|
||||
#let notes(n) = if enable_notes { text(fill: red, n) } else { none };
|
||||
|
||||
// Question d'examen. Numérotée automatiquement, nombre de points optionnel
|
||||
// (défaut 1), bloc de réponse automatique si 2e argument présent
|
||||
#let question(points: 1, q, ..a) = {
|
||||
context pctr.update(t => t + points)
|
||||
let pts = strong([(#show_points(points))]);
|
||||
let pts = strong(show_points(points));
|
||||
|
||||
context { qctr.step() }
|
||||
let num = context { qctr.display() };
|
||||
|
Loading…
Reference in New Issue
Block a user