Skip to content

Commit

Permalink
Added README
Browse files Browse the repository at this point in the history
  • Loading branch information
sahasatvik committed Mar 28, 2023
0 parents commit 5713663
Show file tree
Hide file tree
Showing 9 changed files with 1,064 additions and 0 deletions.
57 changes: 57 additions & 0 deletions README.md
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.

![basic example](basic.png)

```
#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 added basic.pdf
Binary file not shown.
Binary file added basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
51 changes: 51 additions & 0 deletions basic.typ
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 added differential_calculus.pdf
Binary file not shown.
Loading

0 comments on commit 5713663

Please # to comment.