├── basic.pdf ├── basic.png ├── manual.pdf ├── manual_examples.pdf ├── differential_calculus.pdf ├── manual_template.typ ├── LICENSE ├── basic.typ ├── README.md ├── manual_examples.typ ├── theorems.typ ├── manual.typ └── differential_calculus.typ /basic.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahasatvik/typst-theorems/HEAD/basic.pdf -------------------------------------------------------------------------------- /basic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahasatvik/typst-theorems/HEAD/basic.png -------------------------------------------------------------------------------- /manual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahasatvik/typst-theorems/HEAD/manual.pdf -------------------------------------------------------------------------------- /manual_examples.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahasatvik/typst-theorems/HEAD/manual_examples.pdf -------------------------------------------------------------------------------- /differential_calculus.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sahasatvik/typst-theorems/HEAD/differential_calculus.pdf -------------------------------------------------------------------------------- /manual_template.typ: -------------------------------------------------------------------------------- 1 | #let project(title: "", authors: (), url: "", body) = { 2 | set page(paper: "a4", numbering: "1", number-align: center) 3 | set document(author: authors, title: title) 4 | set text(font: "Libertinus Serif", lang: "en") 5 | set heading(numbering: "1.1.") 6 | set par(justify: true) 7 | set list(marker: ([•], [--])) 8 | show heading: it => pad(bottom: 0.5em, it) 9 | show raw.where(block: true): it => pad(left: 4em, it) 10 | show link: it => underline(text(fill: blue, it)) 11 | 12 | 13 | 14 | align(center)[ 15 | #block(text(weight: 700, 1.75em, title)) 16 | ] 17 | 18 | pad( 19 | top: 0.5em, 20 | bottom: 2em, 21 | x: 2em, 22 | grid( 23 | columns: (1fr,) * calc.min(3, authors.len()), 24 | gutter: 1em, 25 | ..authors.map(author => align(center)[ 26 | #author \ 27 | #link(url) 28 | ]), 29 | ), 30 | ) 31 | 32 | outline(indent: true) 33 | 34 | v(2em) 35 | 36 | body 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Satvik Saha 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /basic.typ: -------------------------------------------------------------------------------- 1 | #import "theorems.typ": * 2 | #show: thmrules.with(qed-symbol: $square$) 3 | 4 | #set page(width: 16cm, height: auto, margin: 1.5cm) 5 | #set text(font: "Libertinus Serif", lang: "en") 6 | #set heading(numbering: "1.1.") 7 | 8 | #let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee")) 9 | #let corollary = thmplain( 10 | "corollary", 11 | "Corollary", 12 | base: "theorem", 13 | titlefmt: strong 14 | ) 15 | #let definition = thmbox("definition", "Definition", inset: (x: 1.2em, top: 1em)) 16 | 17 | #let example = thmplain("example", "Example").with(numbering: none) 18 | #let proof = thmproof("proof", "Proof") 19 | 20 | 21 | = Prime numbers 22 | 23 | #definition[ 24 | A natural number is called a #highlight[_prime number_] if it is greater 25 | than 1 and cannot be written as the product of two smaller natural numbers. 26 | ] 27 | #example[ 28 | The numbers $2$, $3$, and $17$ are prime. 29 | @cor_largest_prime shows that this list is not exhaustive! 30 | ] 31 | 32 | #theorem("Euclid")[ 33 | There are infinitely many primes. 34 | ] 35 | #proof[ 36 | Suppose to the contrary that $p_1, p_2, dots, p_n$ is a finite enumeration 37 | of all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list, 38 | it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. Since 39 | $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = 1$, a 40 | contradiction. 41 | ] 42 | 43 | #corollary[ 44 | There is no largest prime number. 45 | ] 46 | #corollary[ 47 | There are infinitely many composite numbers. 48 | ] 49 | 50 | #theorem[ 51 | There are arbitrarily long stretches of composite numbers. 52 | ] 53 | #proof[ 54 | For any $n > 2$, consider $ 55 | n! + 2, quad n! + 3, quad ..., quad n! + n #qedhere 56 | $ 57 | ] 58 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # typst-theorems 2 | 3 | An implementation of numbered theorem environments in 4 | [typst](https://github.com/typst/typst). 5 | Available as [ctheorems](https://typst.app/universe/package/ctheorems) in the 6 | official Typst Universe. 7 | Import with 8 | 9 | ```typst 10 | #import "@preview/ctheorems:1.1.3": * 11 | #show: thmrules 12 | ``` 13 | 14 | Alternatively, copy and import the [theorems.typ](theorems.typ) file to use in 15 | your own projects. 16 | 17 | ### Features 18 | - Numbered theorem environments can be created and customized. 19 | - Environments can share the same counter, via same `identifier`s. 20 | - Environment counters can be _attached_ (just as subheadings are attached to headings) to other environments, headings, or keep a global count via `base`. 21 | - The depth of a counter can be manually set, via `base_level`. 22 | - Environments can be `