Files
university/data/theorems.typ
2025-05-03 22:57:20 +02:00

111 lines
1.8 KiB
Typst

// The nice latex boxes to look cool
#import "@preview/ctheorems:1.1.3": *
// Defaults for the block
//width: 100%,
//inset: 1.2em,
//radius: 0.3em,
//breakable: false,
// What is this for?
#show: thmrules
// Use this to format the size: inset: (x: 1.2em, top: 1em, bottom: 1em)
// TODO: fix the alignment
// TODO: make the numbering good dnd manual and insert the title at the top (from the first line)
// Template for templates?
//#let base = thmenv(
// "base",
//)
#let BASE_LEVEL = 0
#let theorem = thmbox( //tem
"theorem",
"Theorem",
base_level: BASE_LEVEL,
fill: rgb("#eeffdd"),
bodyfmt: body => [
#body #h(1fr)
]
)
#let corollary = thmplain( //cor
"corollary",
"Corollary",
base_level: BASE_LEVEL,
base: "theorem",
titlefmt: strong,
bodyfmt: body => [
#body #h(1fr)
]
)
#let definition = thmbox( //def
"definition",
"Definition",
base_level: BASE_LEVEL,
fill: rgb("#eedebb"),
bodyfmt: body => [
#body #h(1fr)
]
)
#let axiom = thmbox( //axi
"axiom",
"Axiom",
base_level: BASE_LEVEL,
bodyfmt: body => [
#body #h(1fr)
]
)
#let lemma = thmbox( //lem
"lemma",
"Lemma",
base_level: BASE_LEVEL,
fill: rgb("#cddfff"),
bodyfmt: body => [
#body #h(1fr)
]
)
// Other boxes and fields
#let note = thmbox( //nte
"note",
"Note",
bodyfmt: body => [
// Just make the text normally formatted
#body #h(1fr)
]
).with(numbering: none)
#let remark = thmplain( //rem
"remark",
"Remark",
bodyfmt: body => [
#body #h(1fr)
]
).with(numbering: none)
#let proof = thmenv( //pro
"proof",
none,
none,
(name, number, body, color: black) => [
#align(left, [_Proof_: #name #body]) #h(1fr) $square$ // float a QED symbol to the right
#v(0.5em)
]
).with(numbering: none)
#let example = thmbox( //exa
"example",
"Example",
fill: rgb("#efefff99"),
).with(numbering: none)