Files
university/data/theorems.typ
2025-08-09 01:06:43 +02:00

125 lines
2.1 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",
//)
// Global baselevel for the boxes
#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("#efdebf99"),
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 = thmenv( //pro
"note",
none,
none,
(name, number, body, color: black) => [
#v(0.5em)
#align(left, [_Note_: #name #body]) #h(1fr) // float a QED symbol to the right
#v(0.5em)
]
).with(numbering: none)
#let remark = thmenv( //pro
"remark",
none,
none,
(name, number, body, color: black) => [
#v(0.5em)
#align(left, [_Remark_: #name #body]) #h(1fr) // float a QED symbol to the right
#v(0.5em)
]
).with(numbering: none)
#let proof = thmenv( //pro
"proof",
none,
none,
(name, number, body, color: black) => [
#v(0.5em)
#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)
#let example = thmbox( //exa
"experiment",
"Experiment",
fill: rgb("#efefff99"),
).with(numbering: none)