Compare commits

..

1 Commits

Author SHA1 Message Date
b9074076d2
Refactor handout.typ
All checks were successful
CI / Typst formatting (pull_request) Successful in 7s
CI / Typos (pull_request) Successful in 14s
CI / Build (pull_request) Successful in 11m9s
2025-01-24 17:30:38 -08:00
3 changed files with 16 additions and 17 deletions

View File

@ -45,6 +45,16 @@
show list: set block(spacing: 0.5em, below: 1em) show list: set block(spacing: 0.5em, below: 1em)
set heading(numbering: (..nums) => nums.pos().at(0)) set heading(numbering: (..nums) => nums.pos().at(0))
show ref: it => {
import "object.typ": ref_obj
// Custom impl for object references
let x = ref_obj(it)
if (x != none) { return x }
// Use default `ref` implementation otherwise
return it
}
set list( set list(
tight: false, tight: false,
@ -60,16 +70,6 @@
] ]
} }
show ref: it => {
// Custom impl for object references
let x = _ref_obj(it)
if (x != none) { return x }
// Use default `ref` implementation otherwise
return it
}
// //
// Begin content // Begin content
// //

View File

@ -40,7 +40,6 @@
// This can be viewed directly with `#context query(<label>).first().value`, // This can be viewed directly with `#context query(<label>).first().value`,
// Or referenced with `@label` (we define a custom renderer for this metadata later) // Or referenced with `@label` (we define a custom renderer for this metadata later)
if label_name != none { if label_name != none {
//let label_name = "obj:" + label_name
let meta = ( let meta = (
"obj_meta_ref_kind": kind, "obj_meta_ref_kind": kind,
// "obj_content": obj_content, // "obj_content": obj_content,
@ -51,9 +50,9 @@
} }
} }
// `ref` implementation for object meta-references, // `ref` implementation for object meta-references.
// see `show: ref`. // Returns `none` if `it` is not object metadata.
#let _ref_obj(it) = { #let ref_obj(it) = {
let magic_key = "obj_meta_ref_kind" let magic_key = "obj_meta_ref_kind"
if not ( if not (
it.element != none it.element != none
@ -73,7 +72,7 @@
// Produces text like "Problem 2", // Produces text like "Problem 2",
// which takes you to the referenced object when clicked. // which takes you to the referenced object when clicked.
link(v.label, [#obj_type #obj_count]) return link(v.label, [#obj_type #obj_count])
} }
/// Factory function for objects. /// Factory function for objects.

View File

@ -153,7 +153,7 @@ What are the roots of the following polynomial?
#v(1fr) #v(1fr)
#pagebreak() // MARK: page #pagebreak() // MARK: page
#problem() #problem(label: "findci")
If If
$ $
f(x) = c_0 #tp c_1 x #tp c_2 x^2 #tp ... #tp c_n x^n f(x) = c_0 #tp c_1 x #tp c_2 x^2 #tp ... #tp c_n x^n
@ -183,7 +183,7 @@ Find a formula for each $C_i$ in terms of $c_0, c_1, ..., c_n$.
#problem() #problem()
With the same setup as the previous problem, \ With the same setup as @findci, \
find formulas for the roots $r_1, r_2, ..., r_n$. find formulas for the roots $r_1, r_2, ..., r_n$.
#solution([ #solution([