diff --git a/lib/typst/local/handout/0.1.0/lib.typ b/lib/typst/local/handout/0.1.0/lib.typ index 0c0a61a..e5ffa64 100755 --- a/lib/typst/local/handout/0.1.0/lib.typ +++ b/lib/typst/local/handout/0.1.0/lib.typ @@ -3,13 +3,10 @@ // Re-exports // All functions that maybe used by client code are listed here #import "misc.typ": * -#import "object.typ": problem, definition, theorem, example, remark, generic +#import "object.typ": definition, example, generic, problem, remark, theorem #import "solution.typ": ( - if_solutions, - if_no_solutions, - if_solutions_else, - solution, - instructornote, + if_no_solutions, if_solutions, if_solutions_else, instructornote, + sample_solution, solution, ) @@ -38,10 +35,7 @@ margin: 20mm, width: 8.5in, height: 11in, - footer: align( - center, - context counter(page).display(), - ), + footer: align(center, context counter(page).display()), footer-descent: 5mm, ) @@ -102,8 +96,8 @@ // Make handout title { - import "header.typ": make_header, solution_warning, short_solution_warning - import "solution.typ": solutions_state, reset_solutions + import "header.typ": make_header, short_solution_warning, solution_warning + import "solution.typ": reset_solutions, solutions_state reset_solutions() diff --git a/lib/typst/local/handout/0.1.0/object.typ b/lib/typst/local/handout/0.1.0/object.typ index ed38683..dc02069 100644 --- a/lib/typst/local/handout/0.1.0/object.typ +++ b/lib/typst/local/handout/0.1.0/object.typ @@ -29,11 +29,7 @@ } // Render the object - block( - above: 8mm, - below: 2mm, - text(weight: "bold", obj_content), - ) + block(above: 8mm, below: 2mm, text(weight: "bold", obj_content)) // Generate labeled metadata for this object. // @@ -57,7 +53,7 @@ if not ( it.element != none and it.element.has("value") - and type(it.element.value) == "dictionary" + and type(it.element.value) == dictionary and it.element.value.keys().contains(magic_key) ) { // This label is not attached to object metadata @@ -100,9 +96,5 @@ #let remark = _mkobj("Remark") #let generic(obj_content) = { - block( - above: 8mm, - below: 2mm, - text(weight: "bold", obj_content), - ) + block(above: 8mm, below: 2mm, text(weight: "bold", obj_content)) } diff --git a/lib/typst/local/handout/0.1.0/solution.typ b/lib/typst/local/handout/0.1.0/solution.typ index 97c3f75..ac9a052 100755 --- a/lib/typst/local/handout/0.1.0/solution.typ +++ b/lib/typst/local/handout/0.1.0/solution.typ @@ -1,4 +1,4 @@ -#import "misc.typ": ored, oblue +#import "misc.typ": oblue, ored /// If false, hide instructor info. @@ -61,57 +61,71 @@ } #let solution(content) = { - if_solutions( - align( - center, - stack( - block( - width: 100%, - breakable: false, - fill: ored, - stroke: ored + 2pt, - inset: 1.5mm, - align(left, text(fill: white, weight: "bold", [Solution:])), - ), - - block( - width: 100%, - height: auto, - breakable: false, - fill: ored.lighten(80%).desaturate(10%), - stroke: ored + 2pt, - inset: 3mm, - align(left, content), - ), - ), + if_solutions(align(center, stack( + block( + width: 100%, + breakable: false, + fill: ored, + stroke: ored + 2pt, + inset: 1.5mm, + align(left, text(fill: white, weight: "bold", [Solution:])), ), - ) + + block( + width: 100%, + height: auto, + breakable: false, + fill: ored.lighten(80%).desaturate(10%), + stroke: ored + 2pt, + inset: 3mm, + align(left, content), + ), + ))) } +#let sample_solution(content) = { + align(center, stack( + block( + width: 100%, + breakable: false, + fill: oblue, + stroke: oblue + 2pt, + inset: 1.5mm, + align(left, text(fill: white, weight: "bold", [Sample Solution:])), + ), + + block( + width: 100%, + height: auto, + breakable: false, + fill: oblue.lighten(80%).desaturate(10%), + stroke: oblue + 2pt, + inset: 3mm, + align(left, content), + ), + )) +} + + #let instructornote(content) = { - if_solutions( - align( - center, - stack( - block( - width: 100%, - breakable: false, - fill: oblue, - stroke: oblue + 2pt, - inset: 1.5mm, - align(left, text(fill: white, weight: "bold", [Instructor note:])), - ), - - block( - width: 100%, - height: auto, - breakable: false, - fill: oblue.lighten(80%).desaturate(10%), - stroke: oblue + 2pt, - inset: 3mm, - align(left, content), - ), - ), + if_solutions(align(center, stack( + block( + width: 100%, + breakable: false, + fill: oblue, + stroke: oblue + 2pt, + inset: 1.5mm, + align(left, text(fill: white, weight: "bold", [Instructor note:])), ), - ) + + block( + width: 100%, + height: auto, + breakable: false, + fill: oblue.lighten(80%).desaturate(10%), + stroke: oblue + 2pt, + inset: 3mm, + align(left, content), + ), + ))) }