This package provides theorem-like environments for academic writing in Typst.
- Every environment supports cross-referencing via Typst’s native reference system.
- Theorem numbering is composed of the level-1 heading number and a sequential letter (starting from
a), and resets automatically at each level-1 heading (= Heading). - Two visual styles are available through
theme.style:"minimal"(inline header) and"box"(highlighted frame with colored border and background). - The theme color is fully customizable, affecting titles, borders, background, and reference links.
- Theorem-like environments are classified into two distinct styles. Framed blocks — rendered with a highlighted border and background — include
Definition,Property,Axiom,Postulate,Assumption,Hypothesis,Conjecture,Proposition,Lemma,Theorem,Corollary,Remark, andNote. Plain blocks — rendered without a frame — includeProof,Example,Exercise,Problem,Solution, andConclusion. All environments support automatic numbering and multi-language localization.
Basic Usage
To use, simply import the package and add a show rule:
#import "@preview/theoframe:0.3.0": *
#show: theoframe-setup
Setup Options
The #show: theoframe-setup rule accepts a theme argument to customize the appearance of all theorem-like environments:
#show: theoframe-setup.with(theme: (style: "box", color: rgb("#067300")))
style:“minimal”
#import "@preview/theoframe:0.3.0":*
#show: theoframe-setup
// #show: theoframe-setup.with(theme: (style: "box", color: rgb("#067300")))
#set page(paper:"a4", margin: 1cm)
= Preliminaries
This section introduces the basic definitions required for the subsequent results. We begin by formally defining even and odd integers, which form the foundation of our discussion on number-theoretic properties.
#definition(name: [Even Integer])[
An integer $n$ is called *even* if it is divisible by $2$, i.e., there exists an integer $k$ such that $n = 2k$.
]<def:even>
#definition(name: [Odd Integer])[
An integer $n$ is called *odd* if it is not divisible by $2$, i.e., there exists an integer $k$ such that $n = 2k + 1$.
]<def:odd>
= Main Results
Having established the basic definitions, we now present the main theoretical results of this note. We start with a fundamental theorem concerning the sum of even integers, followed by a natural corollary.
#theorem(name: [Sum of Two Even Integers])[
The sum of any two even integers is even.
]<thm:sum-even>
#proof(name: [Proof of @thm:sum-even])[
Let $a$ and $b$ be two even integers. By @def:even, there exist integers $k$ and $m$ such that $a = 2k$ and $b = 2m$. Then
$a + b = 2k + 2m = 2(k + m)$,
which shows that $a + b$ is divisible by $2$, hence even by @def:even.
]<pf:sum-even>
#corollary(name: [Sum of Multiple Even Integers])[
The sum of any finite number of even integers is even.
]<cor:sum-multiple>
#proof[
This follows directly from @thm:sum-even by induction on the number of terms.
]
= Additional Examples
To further illustrate the concepts introduced above, we provide a concrete example of even numbers and pose a related problem for the reader to solve.
#example(name: [Concrete Even Numbers])[
The integers $4$, $10$, and $16$ are even since $4 = 2 times 2$, $10 = 2 times 5$, and $16 = 2 times 8$.
]<ex:even-numbers>
#problem(name: [Sum of Two Odd Integers])[
Show that the sum of two odd integers is even.
]<prob:sum-odd>
#solution(name: [Solution to @prob:sum-odd])[
Let $a$ and $b$ be odd integers. By @def:odd, there exist integers $k$ and $m$ such that $a = 2k + 1$ and $b = 2m + 1$. Then
$a + b = (2k + 1) + (2m + 1) = 2k + 2m + 2 = 2(k + m + 1)$,
which is even by @def:even.
]<sol:sum-odd>
style:“box”
#import "@preview/theoframe:0.3.0":*
// #show: theoframe-setup
#show: theoframe-setup.with(theme: (style: "box", color: rgb("#067300")))
#line(length: 100%)
// #show outline: it => {
// show heading: set text(fill: rgb("#067300"))
// it
// }
#outline(title: "Definitions", target: figure.where(kind: "definition"))
#outline(title: "Theorems", target: figure.where(kind: "theorem"))
#line(length: 100%)
#let fig-arr = kind-array.map(it => figure.where(kind: it))
#outline(title: "Theorems-like environment", target: selector.or(..fig-arr))