-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 5713663
Showing
9 changed files
with
1,064 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# typst-theorems | ||
|
||
An implementation of numbered theorem environments in | ||
[typst](https://github.com/typst/typst). | ||
Copy and import the [theorems.typ](theorems.typ) file to use in your own projects. | ||
|
||
Minimal example below; also see [example.typ](example.typ) for a demonstration of more features, and [differential_calculus.typ](differential_calculus.typ) for a practical use case. | ||
|
||
 | ||
|
||
``` | ||
#import "theorems.typ": * | ||
#set page(width: 16cm, height: auto, margin: 1.5cm) | ||
#set heading(numbering: "1.1.") | ||
#let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee")) | ||
#let corollary = thmplain( | ||
"corollary", | ||
"Corollary", | ||
base: "theorem", | ||
titlefmt: strong | ||
) | ||
#let definition = thmbox("definition", "Definition") | ||
#let example = thmplain("example", "Example").with(numbering: none) | ||
#let proof = thmplain( | ||
"proof", | ||
"Proof", | ||
base: "theorem", | ||
bodyfmt: body => [#body #h(1fr) $square$] | ||
).with(numbering: none) | ||
= Prime numbers | ||
#definition[ | ||
A natural number is called a _prime number_ if it is greater than 1 | ||
and cannot be written as the product of two smaller natural numbers. | ||
] | ||
#example[The numbers $2$, $3$, and $17$ are prime.] | ||
#theorem(name: "Euclid")[ | ||
There are infinitely many primes. | ||
] | ||
#proof[ | ||
Suppose to the contrary that $p_1, p_2, dots p_n$ is a finite enumeration | ||
of all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list, | ||
it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. | ||
Since $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = | ||
1$, a contradiction. | ||
] | ||
#corollary[There is no largest prime number.] | ||
#corollary[There are infinitely many composite numbers.] | ||
``` | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#import "theorems.typ": * | ||
|
||
#set page(width: 16cm, height: auto, margin: 1.5cm) | ||
#set text(font: "Linux Libertine", lang: "en") | ||
#set heading(numbering: "1.1.") | ||
|
||
#let theorem = thmbox("theorem", "Theorem", fill: rgb("#eeffee")) | ||
#let corollary = thmplain( | ||
"corollary", | ||
"Corollary", | ||
base: "theorem", | ||
titlefmt: strong | ||
) | ||
#let definition = thmbox("definition", "Definition") | ||
|
||
#let example = thmplain("example", "Example").with(numbering: none) | ||
#let proof = thmplain( | ||
"proof", | ||
"Proof", | ||
base: "theorem", | ||
bodyfmt: body => [#body #h(1fr) $square$] | ||
).with(numbering: none) | ||
|
||
|
||
= Prime numbers | ||
|
||
#definition[ | ||
A natural number is called a _prime number_ if it is greater than 1 | ||
and cannot be written as the product of two smaller natural numbers. | ||
] | ||
#example[ | ||
The numbers $2$, $3$, and $17$ are prime. | ||
] | ||
|
||
#theorem(name: "Euclid")[ | ||
There are infinitely many primes. | ||
] | ||
#proof[ | ||
Suppose to the contrary that $p_1, p_2, dots p_n$ is a finite enumeration of | ||
all primes. Set $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in | ||
our list, it cannot be prime. Thus, some prime factor $p_j$ divides $P + 1$. | ||
Since $p_j$ also divides $P$, it must divide the difference $(P + 1) - P = | ||
1$, a contradiction. | ||
] | ||
|
||
#corollary[ | ||
There is no largest prime number. | ||
] | ||
#corollary[ | ||
There are infinitely many composite numbers. | ||
] |
Binary file not shown.
Oops, something went wrong.