diff --git a/exam/lib.typ b/exam/lib.typ index 6237a5f..cc70c03 100644 --- a/exam/lib.typ +++ b/exam/lib.typ @@ -33,26 +33,6 @@ // 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) } -#let qcm(qcm_list) = { - //let checked_box = "☑"; - //let unchecked_box = "☐"; - let checked_box = box(stroke: black, outset: 0.2em, "X") + " "; - let unchecked_box = box(stroke: black, outset: 0.2em, hide("X")) + " "; - set list(marker: unchecked_box, indent: 2em) - if enable_solutions { - show : i => { - show box: b => checked_box; - set text(fill: olive); - i - }; - qcm_list - } else { - qcm_list - } - v(1em) -} - - #let exam(title: "Exam", course: none, date: none, class: none, year: none, author: none, subtitle: none, indications: none, time: none, allowed: none) = doc => { @@ -149,4 +129,29 @@ } +#let qcm(points: 1, question_text, qcm_list) = { + //let checked_box = "☑"; + //let unchecked_box = "☐"; + let checked_box = box(stroke: black, outset: 0.2em, "X") + " "; + let unchecked_box = box(stroke: black, outset: 0.2em, hide("X")) + " "; + set list(marker: unchecked_box, indent: 2em) + let qcm_box = if enable_solutions { + show : i => { + show box: b => checked_box; + set text(fill: olive); + i + }; + qcm_list + } else { + qcm_list + }; + + block(breakable: false)[ + #question(points: points, question_text) + #v(0.5em) + #qcm_box + ] + v(2em, weak: true) + +} diff --git a/exam/typst.toml b/exam/typst.toml index 5751c6d..dfeb491 100644 --- a/exam/typst.toml +++ b/exam/typst.toml @@ -1,6 +1,6 @@ [package] name = "exam" -version = "0.1.0" +version = "0.2.0" entrypoint = "lib.typ" authors = ["Maxime Augier "] license = "MIT"