From ca82ba6d8608740b440be8e188ac4a9e6f9ea726 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 24 Jan 2025 09:27:10 -0800 Subject: [PATCH 1/5] Added `oorange` color --- lib/typst/local/handout/0.1.0/handout.typ | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/typst/local/handout/0.1.0/handout.typ b/lib/typst/local/handout/0.1.0/handout.typ index f35cebd..bb5709a 100755 --- a/lib/typst/local/handout/0.1.0/handout.typ +++ b/lib/typst/local/handout/0.1.0/handout.typ @@ -22,6 +22,7 @@ // Colors #let ored = rgb("D62121") +#let oorange = rgb("#ffaa3b") #let ogrape = rgb("9C36B5") #let ocyan = rgb("2288BF") #let oteal = rgb("12B886") -- 2.47.1 From f691a49630354b78cb6d795e24169a26bc2a3ca5 Mon Sep 17 00:00:00 2001 From: Mark Date: Thu, 23 Jan 2025 18:21:53 -0800 Subject: [PATCH 2/5] Tweak `#note()` --- lib/typst/local/handout/0.1.0/handout.typ | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/typst/local/handout/0.1.0/handout.typ b/lib/typst/local/handout/0.1.0/handout.typ index bb5709a..583f993 100755 --- a/lib/typst/local/handout/0.1.0/handout.typ +++ b/lib/typst/local/handout/0.1.0/handout.typ @@ -186,15 +186,18 @@ // -#let hint(content) = { - text(fill: rgb(100, 100, 100), style: "oblique", "Hint: ") +#let note(content, type: none) = { + if type != none { + text(fill: rgb(100, 100, 100), style: "oblique", [#type: ]) + } text(fill: rgb(100, 100, 100), content) } -#let note(content) = { - text(fill: rgb(100, 100, 100), content) +#let hint(content) = { + note(content, type: "Hint") } + #let examplesolution(content) = { let c = oblue @@ -282,6 +285,7 @@ if show_solutions { warn } + doc } -- 2.47.1 From a7e7f090f83130b1866a1e2ae5a56a331f1e89c1 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 24 Jan 2025 14:54:57 -0800 Subject: [PATCH 3/5] Added object metadata & references --- lib/typst/local/handout/0.1.0/handout.typ | 114 +++++++++++++++++----- 1 file changed, 92 insertions(+), 22 deletions(-) diff --git a/lib/typst/local/handout/0.1.0/handout.typ b/lib/typst/local/handout/0.1.0/handout.typ index 583f993..33e92d1 100755 --- a/lib/typst/local/handout/0.1.0/handout.typ +++ b/lib/typst/local/handout/0.1.0/handout.typ @@ -151,34 +151,96 @@ // MARK: Sections // -#let generic(t) = block( - above: 8mm, - below: 2mm, - text(weight: "bold", t), -) - -#let _generic_base(kind, ..args) = { +/// Core render code for all objects (problems, theorems, etc) +/// This should never be used directly by client code. +/// +/// Args: +/// - kind: the kind of object to make ("Problem", "Definition", etc) +/// - label_name: a string. If provided, generate metadata for this object +/// under the given label. Labels must be unique, and are prefixed with `obj` +/// This label can then be used to reference this object. +/// +/// For example: +/// ``` +/// #problem(label: "problem1") +/// This is @obj:problem1 +/// ``` +#let _obj_base(kind, ..args, label_name: none) = { counter("obj").step() - if args.pos().len() == 0 { - generic([ - #kind - #context counter("obj").display(): - ]) + let n = context counter("obj").get().first() + + // The complete title text of this object, + // like "Problem 5:" or "Theorem: " + let obj_content = if args.pos().len() == 0 { + [#kind #n:] } else { - generic( - [ - #kind - #context counter("obj").display(): - ] - + " " - + args.pos().at(0), + [#kind #n: #args.pos().at(0)] + } + + // Render the object + block( + above: 8mm, + below: 2mm, + text(weight: "bold", obj_content), + ) + + // Generate labeled metadata for this object. + // + // This can be viewed directly with `#context query(