0.0.1
This commit is contained in:
parent
2d05f1ce95
commit
cc3b567b38
5 changed files with 257 additions and 0 deletions
1
0.0.1/LICENSE
Normal file
1
0.0.1/LICENSE
Normal file
|
@ -0,0 +1 @@
|
|||
Copyright (c) 2025 Beat Jäckle
|
129
0.0.1/README.md
Normal file
129
0.0.1/README.md
Normal file
|
@ -0,0 +1,129 @@
|
|||
# jaebab
|
||||
|
||||
Arbeitsblatt für JäB
|
||||
[typst](https://github.com/typst/typst). Import using
|
||||
```typst
|
||||
#import "@dev/jaebab:0.0.1": *
|
||||
#show: thmrules
|
||||
```
|
||||
|
||||
<!--
|
||||
### Features
|
||||
- Numbered theorem environments can be created and customized.
|
||||
- Environments can share the same counter, via same `identifier`s.
|
||||
- Environment counters can be _attached_ (just as subheadings are attached to headings) to other environments, headings, or keep a global count via `base`.
|
||||
- The depth of a counter can be manually set, via `base_level`.
|
||||
- Environments can be `<label>`'d and `@reference`'d.
|
||||
- Awesome presets (coming soon!)
|
||||
|
||||
## Manual and Examples
|
||||
Get acquainted with `ctheorems` by checking out the minimal example below!
|
||||
|
||||
You can read the [manual](assets/manual.pdf) for a full walkthrough of functionality offered by this module; flick through [manual_examples](assets/manual_examples.pdf) to just see the examples.
|
||||
|
||||

|
||||
|
||||
### Preamble
|
||||
```typst
|
||||
#import "@preview/ctheorems:1.1.3": *
|
||||
#show: thmrules.with(qed-symbol: $square$)
|
||||
|
||||
#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", inset: (x: 1.2em, top: 1em))
|
||||
|
||||
#let example = thmplain("example", "Example").with(numbering: none)
|
||||
#let proof = thmproof("proof", "Proof")
|
||||
```
|
||||
|
||||
### Document
|
||||
```typst
|
||||
= Prime numbers
|
||||
|
||||
#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.
|
||||
]
|
||||
#example[
|
||||
The numbers $2$, $3$, and $17$ are prime.
|
||||
@cor_largest_prime shows that this list is not exhaustive!
|
||||
]
|
||||
|
||||
#theorem("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.
|
||||
] <cor_largest_prime>
|
||||
#corollary[
|
||||
There are infinitely many composite numbers.
|
||||
]
|
||||
|
||||
#theorem[
|
||||
There are arbitrarily long stretches of composite numbers.
|
||||
]
|
||||
#proof[
|
||||
For any $n > 2$, consider $
|
||||
n! + 2, quad n! + 3, quad ..., quad n! + n #qedhere
|
||||
$
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
## Changelog
|
||||
|
||||
### v1.1.3
|
||||
|
||||
- Fixed alignment and block-breaking issues resulting from breaking changes
|
||||
in Typst 0.12.
|
||||
|
||||
### v1.1.2
|
||||
|
||||
- Introduced the `thmproof` function for creating proof environments.
|
||||
- Inserting `#qedhere` in a block equation/list/enum item (in a proof) places
|
||||
the qed symbol on the same line. The qed symbol can be customized via
|
||||
`thmrules`.
|
||||
|
||||
### v1.1.1
|
||||
|
||||
- Extra named arguments given to a theorem environment produced by `thmbox` (or `thmplain`) are passed to `block`.
|
||||
|
||||
### v1.1.0
|
||||
|
||||
- The `supplement` (for references) is no longer set in `thmenv`. It can be passed to the theorem environment directly, along with `refnumbering` to control the appearance of `@reference`s.
|
||||
- Extra named arguments given to `thmbox` are passed to `block`.
|
||||
- Fixed spacing bug for unnumbered environments.
|
||||
- Replaced dummy figure with labelled metadata.
|
||||
|
||||
### v1.0.0
|
||||
|
||||
- Extra named arguments given to a theorem environment are passed to its formatting function `fmt`.
|
||||
- Removed `thmref`, introduced normal `<label>`s and `@reference`s.
|
||||
- Import must be followed by `show: thmrules`.
|
||||
- Removed `name: ...` from theorem environments; use `#theorem("Euclid")[]` instead of `#theorem(name: "Euclid")[]`.
|
||||
- Theorems are now wrapped in `figure`s.
|
||||
|
||||
|
||||
## Credits
|
||||
|
||||
- [sahasatvik (Satvik Saha)](https://github.com/sahasatvik)
|
||||
- [MJHutchinson (Michael Hutchinson)](https://github.com/MJHutchinson)
|
||||
- [rmolinari (Rory Molinari)](https://github.com/rmolinari)
|
||||
- [PgBiel](https://github.com/PgBiel)
|
||||
- [DVDTSB](https://github.com/DVDTSB)-->
|
3
0.0.1/TODO
Normal file
3
0.0.1/TODO
Normal file
|
@ -0,0 +1,3 @@
|
|||
Local repository
|
||||
part label
|
||||
merge first, then compile
|
1
0.0.1/assets/logo.svg
Symbolic link
1
0.0.1/assets/logo.svg
Symbolic link
|
@ -0,0 +1 @@
|
|||
/home/beat/Dokumente/PMS/media/pms_logo_grey_crop.svg
|
123
0.0.1/lib.typ
Normal file
123
0.0.1/lib.typ
Normal file
|
@ -0,0 +1,123 @@
|
|||
//".preamble.typ"
|
||||
#import "@preview/ctheorems:1.1.3": thmbox, thmrules, thmproof, thmplain
|
||||
// #let printanswers = true
|
||||
#let printanswersstate = state("printanswers", false)
|
||||
#let answers(b) = {
|
||||
printanswersstate.update(printanswers => b)
|
||||
}
|
||||
#let ifprintanswers(thencontent, elsecontent: none) = {
|
||||
context if printanswersstate.get(){
|
||||
thencontent
|
||||
}else{
|
||||
elsecontent
|
||||
}
|
||||
}
|
||||
#let underlinespace(width) = box(
|
||||
width: width,
|
||||
stroke: (bottom: .5pt),
|
||||
outset: (bottom: 1pt),
|
||||
)
|
||||
|
||||
#let dx = $#h(.2em) d x$
|
||||
|
||||
#let häuschen_q = tiling(size: (4mm, 4mm),
|
||||
//colour: red
|
||||
)[
|
||||
#square(
|
||||
size: 4mm,
|
||||
fill: none,
|
||||
stroke: gray,
|
||||
//colour: gray,
|
||||
//.conic(..olor.map.rainbow),
|
||||
)
|
||||
// #place(line(start: (0%, 0%), end: (0%, 100%)))
|
||||
// #place(line(start: (0%, 100%), end: (100%, 100%)))
|
||||
]
|
||||
#let häuschen_l = tiling(
|
||||
size: (4mm, 4mm),
|
||||
)[
|
||||
#place(line(stroke: gray, start: (0%, 0%), end: (0%, 100%)))
|
||||
#place(line(stroke: gray, start: (0%, 0%), end: (100%, 0%)))
|
||||
]
|
||||
|
||||
#let fillwithgrid(p) = block(
|
||||
//fill: häuschen_q,
|
||||
fill: häuschen_l,
|
||||
height: p,
|
||||
width: 100%)[
|
||||
//Hallo
|
||||
]
|
||||
#let exmp = thmbox(
|
||||
"exmp",
|
||||
"Beispiel",
|
||||
fill: rgb("#eee"),
|
||||
base_level: 0,
|
||||
)
|
||||
#let solution = thmbox(
|
||||
"solution",
|
||||
"Lösung",
|
||||
// fill: rgb("#eee"),
|
||||
// base_level: none,
|
||||
// qed-symbol: $qed$,
|
||||
// qed-symbol: $circle$,
|
||||
stroke: black,
|
||||
).with(numbering: none)
|
||||
#let question = thmbox(
|
||||
"question",
|
||||
"Aufgabe",
|
||||
// fill: rgb("#eee"),
|
||||
base_level: 0,
|
||||
stroke: black,
|
||||
)
|
||||
#let part = thmplain(
|
||||
"part",
|
||||
"",
|
||||
base: "question",
|
||||
// fill: rgb("fff"),
|
||||
base_level: 0,
|
||||
// thmfmt: "bold"
|
||||
// titlefmt: strong
|
||||
).with(numbering: "a)")
|
||||
|
||||
#let solutionorgrid(p: 10em, body) = {
|
||||
v(-1.2em)
|
||||
context if printanswersstate.get() {
|
||||
solution[#body]
|
||||
}
|
||||
else {fillwithgrid(p)}
|
||||
}
|
||||
#let fillin(sol, width: 8em) = {
|
||||
ifprintanswers(underline(sol), )}
|
||||
#let definition = thmbox(
|
||||
"definition",
|
||||
"Definition",
|
||||
base_level: 0,
|
||||
fill: rgb("#eee"),
|
||||
)
|
||||
#let bemerkung = thmbox(
|
||||
"bemerkung",
|
||||
"Bemerkung",
|
||||
// base_level: none,
|
||||
fill: rgb("#eee"),
|
||||
).with(numbering: none)
|
||||
|
||||
|
||||
|
||||
#let abrules(title: none, doc) = [
|
||||
#if ( sys.inputs.at("answers", default: "false") =="true" ){
|
||||
answers(true)
|
||||
}
|
||||
#set page(
|
||||
// paper: "us-letter",
|
||||
header: ( box(image("assets/logo.svg"), height: 2em)+ h(1fr)
|
||||
+ifprintanswers(
|
||||
"Lösung",
|
||||
elsecontent: "Vorname Name:"+underlinespace(12em),
|
||||
)
|
||||
)
|
||||
,
|
||||
numbering: "1",
|
||||
)
|
||||
#{ifprintanswers({set document(title: context document.title + " -- Lösung")})}
|
||||
#thmrules(doc)
|
||||
]
|
Loading…
Add table
Reference in a new issue