diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/format.typ b/packages/preview/lacy-ubc-math-project/0.1.0/format.typ index 499ab8971..9fbc0c473 100644 --- a/packages/preview/lacy-ubc-math-project/0.1.0/format.typ +++ b/packages/preview/lacy-ubc-math-project/0.1.0/format.typ @@ -23,6 +23,14 @@ // Make sure the numbering and labeling are consistent. #assert(__question-numbering.len() == __max-qs-level and __question-labels.len() == __max-qs-level) +// solution visibility +#let __solution-visible = state("solution-visible", true) +#let toggle-solution(visible) = { + assert(type(visible) == bool, message: "The visibility of the solution must be a boolean.") + __solution-visible.update(v => visible) +} +#let __solution-disabled = sys.inputs.at("hide-solution", default: "") in ("1", "true", "yes", "y") + /// Creates an author (a `dictionary`). /// - firstname (str, content): The author's first name, bold when displayed. /// - lastname (str, content): The author's last name. @@ -125,12 +133,14 @@ /// - body (content): The solution. /// - color (color): The color of the solution frame and text. /// - supplement (content): The supplemental text to be displayed before the solution. -#let solution(body, color: green-solution, supplement: [*Solution*: ]) = { - block( +#let solution(body, color: green-solution, supplement: [*Solution*: ], force: false) = { + context block( width: 100%, inset: 1em, stroke: color + 0.5pt, )[ + #if __solution-disabled { return none } + #if not force and not __solution-visible.get() { return none } #set align(left) #set text(fill: color) #supplement#body diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/lib.typ b/packages/preview/lacy-ubc-math-project/0.1.0/lib.typ index c3ce6ad57..ed00bf196 100644 --- a/packages/preview/lacy-ubc-math-project/0.1.0/lib.typ +++ b/packages/preview/lacy-ubc-math-project/0.1.0/lib.typ @@ -4,7 +4,7 @@ #import prefixes: * #import "@preview/equate:0.2.1": * -#import "format.typ": author, question, solution, green-solution +#import "format.typ": author, question, solution, green-solution, toggle-solution #import "shorthand.typ": * #import "drawing.typ" as drawing @@ -100,8 +100,12 @@ #set page(numbering: none) #set par(first-line-indent: 0em) #set text(font: ("DejaVu Serif", "New Computer Modern"), size: 10pt) - #show ref: set text(fill: blue.darken(30%), stroke: 0.2pt + blue.darken(30%)) - #show link: set text(fill: blue.darken(30%), stroke: 0.2pt + blue.darken(30%)) + #let link_s = it => { + set text(fill: blue.darken(30%)) + underline(it) + } + #show ref: link_s + #show link: link_s #set math.equation(numbering: "(1.1)") diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/manual.pdf b/packages/preview/lacy-ubc-math-project/0.1.0/manual.pdf index ff9ef2dad..65b908049 100644 Binary files a/packages/preview/lacy-ubc-math-project/0.1.0/manual.pdf and b/packages/preview/lacy-ubc-math-project/0.1.0/manual.pdf differ diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/manual.typ b/packages/preview/lacy-ubc-math-project/0.1.0/manual.typ index 0112c70ef..983e99bcc 100644 --- a/packages/preview/lacy-ubc-math-project/0.1.0/manual.typ +++ b/packages/preview/lacy-ubc-math-project/0.1.0/manual.typ @@ -527,6 +527,32 @@ Solution is usually put in a question block as a response to it. ] ``` +== Hiding Solutions +There are 2 ways to hide solutions. + +To disable all solutions (all solutions will not show, no matter what), provide `hide-solution` to compile inputs: +```bash +typst compile filename.typ --input hide-solution=true +``` +The value can be any of `true`, `1`, `yes`, `y`. + +This flag is also visible in the `unsafe` module as ```typc __solution-disabled```. + +To hide arbitrary solutions, use ```typc toggle-solution()``` before the solutions you wish to hide. +In this case, individual solutions can be forced to show by setting ```typc force: true``` in the ```typc solution()``` function. +#showcode(```typst +#solution[Visible.] +// toggle solutions off +#toggle-solution(false) +#solution[Hidden.] +// force it to show +#solution(force: true)[Forced to be visible.] +// toggle them back on +#toggle-solution(true) +#solution[Visible again.] +```) + + = Drawing As we are doing math, inevitably we will need to draw some graphs. diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/template/project1.typ b/packages/preview/lacy-ubc-math-project/0.1.0/template/project1.typ index 3fe33c123..970e5ebea 100644 --- a/packages/preview/lacy-ubc-math-project/0.1.0/template/project1.typ +++ b/packages/preview/lacy-ubc-math-project/0.1.0/template/project1.typ @@ -37,4 +37,5 @@ ] ] -There is also a #link("/lace-wing/lacy-ubc-math-project/blob/master/manual.pdf")[manual] for this project. +There is also a #link("https://github.com/lace-wing/lacy-ubc-math-project")[manual] for this project. + diff --git a/packages/preview/lacy-ubc-math-project/0.1.0/unsafe.typ b/packages/preview/lacy-ubc-math-project/0.1.0/unsafe.typ index 369931296..9f6627168 100644 --- a/packages/preview/lacy-ubc-math-project/0.1.0/unsafe.typ +++ b/packages/preview/lacy-ubc-math-project/0.1.0/unsafe.typ @@ -1 +1 @@ -#import "format.typ": __question-level, __question-counters, __question-labels, __question-numbering, __max-qs-level, __question-duplicates +#import "format.typ": __question-level, __question-counters, __question-labels, __question-numbering, __max-qs-level, __question-duplicates, __solution-visible, __solution-disabled