diff --git a/lib.typ b/lib.typ index 4100e4e..c43f3cf 100644 --- a/lib.typ +++ b/lib.typ @@ -53,8 +53,16 @@ "Definition", inset: (x: 1.2em, top: 1em), ) +#let lemma = thmbox("lemma", "Lemma", fill: uit-gray-color.lighten(80%)) #let example = thmplain("example", "Example").with(numbering: none) -#let proof = thmproof("proof", "Proof") +// Disable numbering of equations inside a proof block +#let custom-proof-bodyfmt(body) = { + set math.equation(numbering: none) + proof-bodyfmt(body) +} +#let proof = thmproof("proof", "Proof", bodyfmt: custom-proof-bodyfmt).with( + numbering: none, +) // Helper to display external codeblocks. // Based on https://github.com/typst/typst/issues/1494 diff --git a/template/chapters/figures.typ b/template/chapters/figures.typ index 8b63814..7edbe85 100644 --- a/template/chapters/figures.typ +++ b/template/chapters/figures.typ @@ -341,11 +341,45 @@ $ == Definitions and Theorems +To easily style and reference definitions, theorems, proofs and similar blocks, the ctheorems #footnote()[see #link("https://typst.app/universe/package/ctheorems/")] package is included. +A number of functions are defined which automatically generate titles, styling and numbering functionality. + #definition[ A natural number is called a #highlight[_prime number_] if it is greater than 1 and cannot be written as the product of two smaller natural numbers. -] +] + +The numbering follows the heading counter by default, and we can reference @def:natural-number, @th:comp-num or @le:divide just like any other figure. #theorem[ There are arbitrarily long stretches of composite numbers. +] + +Corollaries are related to theorems, and that their counter is therefore based on the previously defined theorem: + +#corollary[ + if $n$ divides two consecutive natural numbers, then $n = 1$. +] + +#lemma[ + If $n$ divides both $x$ and $y$, it also divides $x - y$. +] + + +We can also pass additional arguments to the functions, in order to for instance modify the title: + +#proof([of @th:comp-num])[ + For any $n > 2$, consider$ + n! + 2, quad n! + 3, quad ..., quad n! + n #qedhere + $ +] + +Note that for proofs, block equations are not numbered, and a _Q.E.D._ symbol (a black square) is automatically inserted in the right margin. +We can control where this symbol appears using `#qedhere`. + +Finally, a lightweight example macro is exposed. +It is not numbered or referable, but has some simple styling rules applied. + +#example[ + Here is an example ] diff --git a/template/thesis.pdf b/template/thesis.pdf index b9237e7..f4f1a26 100644 Binary files a/template/thesis.pdf and b/template/thesis.pdf differ