{"id":26000010,"url":"https://github.com/OrangeX4/typst-theorion","last_synced_at":"2025-03-05T18:42:38.490Z","repository":{"id":279038517,"uuid":"937545968","full_name":"OrangeX4/typst-theorion","owner":"OrangeX4","description":"Out-of-the-box, customizable and multilingual theorem environment package for Typst.","archived":false,"fork":false,"pushed_at":"2025-03-05T12:56:37.000Z","size":2217,"stargazers_count":27,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-05T13:40:52.214Z","etag":null,"topics":["colorful-box","package","theorem","theorems","typst","typst-package"],"latest_commit_sha":null,"homepage":"","language":"Typst","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OrangeX4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-23T10:27:35.000Z","updated_at":"2025-03-05T12:56:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"29a0ae5a-bb06-43fb-9eb8-9d973923d8a0","html_url":"https://github.com/OrangeX4/typst-theorion","commit_stats":null,"previous_names":["orangex4/typst-theorion"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrangeX4%2Ftypst-theorion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrangeX4%2Ftypst-theorion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrangeX4%2Ftypst-theorion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OrangeX4%2Ftypst-theorion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OrangeX4","download_url":"https://codeload.github.com/OrangeX4/typst-theorion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242083209,"owners_count":20069255,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colorful-box","package","theorem","theorems","typst","typst-package"],"created_at":"2025-03-05T18:40:52.858Z","updated_at":"2025-03-05T18:42:38.485Z","avatar_url":"https://github.com/OrangeX4.png","language":"Typst","funding_links":[],"categories":["Typst"],"sub_categories":[],"readme":"# 🌌Theorion\n\n[![Typst Universe](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Ftypst.app%2Funiverse%2Fpackage%2Ftheorion\u0026query=%2Fhtml%2Fbody%2Fdiv%2Fmain%2Fdiv%5B2%5D%2Faside%2Fsection%5B2%5D%2Fdl%2Fdd%5B3%5D\u0026logo=typst\u0026label=universe\u0026color=%2339cccc)](https://typst.app/universe/package/theorion)\n![GitHub](https://img.shields.io/github/license/OrangeX4/typst-theorion)\n![GitHub Repo stars](https://img.shields.io/github/stars/OrangeX4/typst-theorion)\n![Cosmos badge](https://img.shields.io/badge/cosmos-4-aqua)\n\n[Theorion](https://github.com/OrangeX4/typst-theorion) (The Orion) is an out-of-the-box, customizable and multilingual **theorem** environment package for [Typst](https://typst.app/docs/).\n\n- **Out-of-the-box styles** 🎨\n- **Built-in multilingual support** 🌐\n- **Highly customizable** ⚙️:\n  - Custom counters and numbering styles\n  - Configurable inheritance levels\n  - Custom theorem environments\n  - Custom rendering functions\n- **Rich theorem environments** 📚: theorem, definition, lemma, corollary, example, proof, and many more presets for note-taking\n- **Theorem restatement** 🔄: `#theorion-restate(filter: it =\u003e it.outlined and it.identifier == \"theorem\")`\n- **Additional features** 📑:\n  - Theorem table of contents\n  - Appendix numbering adjustments\n  - Complete label and reference system\n  - Optional outline and numbering display\n  - [Touying](https://github.com/touying-typ/touying) animation support\n\n## Quick Start\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.fancy: *\n// #import cosmos.rainbow: *\n// #import cosmos.clouds: *\n#show: show-theorion\n\n#theorem(title: \"Euclid's Theorem\")[\n  There are infinitely many prime numbers.\n] \u003cthm:euclid\u003e\n\n#theorem-box(title: \"Theorem without numbering\", outlined: false)[\n  This theorem is not numbered.\n]\n```\n\n## Customization\n\n```typst\n// 1. Change the counters and numbering:\n#set-inherited-levels(1)\n#set-zero-fill(true)\n#set-leading-zero(true)\n#set-theorion-numbering(\"1.1\")\n\n// 2. Other options:\n#set-result(\"noanswer\")\n#set-qed-symbol[#math.qed]\n\n// 3. Custom theorem environment for yourself\n#let (theorem-counter, theorem-box, theorem, show-theorem) = make-frame(\n  \"theorem\",\n  \"Theorem\",  // supplement, string or dictionary like `(en: \"Theorem\")`, or `theorion-i18n-map.at(\"theorem\")` for built-in i18n support\n  counter: theorem-counter,  // inherit the old counter, `none` by default\n  inherited-levels: 2,  // useful when you need a new counter\n  inherited-from: heading,  // heading or just another counter\n  render: (prefix: none, title: \"\", full-title: auto, body) =\u003e [#strong[#full-title.]#sym.space#emph(body)],\n)\n#show: show-theorem\n\n// 4. Just use it.\n#theorem(title: \"Euclid's Theorem\")[\n  There are infinitely many prime numbers.\n] \u003cthm:euclid\u003e\n#theorem-box(title: \"Theorem without numbering\", outlined: false)[\n  This theorem is not numbered.\n]\n\n// 5. Example of appendix\n#counter(heading).update(0)\n#set heading(numbering: \"A.1\")\n#set-theorion-numbering(\"A.1\")\n\n// 6. Table of contents\n#outline(title: none, target: figure.where(kind: \"theorem\"))\n```\n\n## Restate Theorems\n\n```typst\n// 1. Restate all theorems\n#theorion-restate(filter: it =\u003e it.outlined and it.identifier == \"theorem\", render: it =\u003e it.render)\n// 2. Restate all theorems with custom render function\n#theorion-restate(\n  filter: it =\u003e it.outlined and it.identifier == \"theorem\",\n  render: it =\u003e (prefix: none, title: \"\", full-title: auto, body) =\u003e block[#strong[#full-title.]#sym.space#emph(body)],\n)\n// 3. Restate a specific theorem\n#theorion-restate(filter: it =\u003e it.label == \u003cthm:euclid\u003e)\n```\n\n## Example\n\n[Source code](examples/example.typ)\n\n![example](examples/example.png)\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.fancy: *\n// #import cosmos.rainbow: *\n// #import cosmos.clouds: *\n#show: show-theorion\n\n#set page(height: auto)\n#set heading(numbering: \"1.1\")\n#set text(lang: \"en\")\n\n/// 1. Change the counters and numbering:\n// #set-inherited-levels(1)\n// #set-zero-fill(true)\n// #set-leading-zero(true)\n// #set-theorion-numbering(\"1.1\")\n\n/// 2. Other options:\n// #set-result(\"noanswer\")\n// #set-qed-symbol[#math.qed]\n\n/// 3. Custom theorem environment for yourself\n// #let (theorem-counter, theorem-box, theorem, show-theorem) = make-frame(\n//   \"theorem\",\n//   \"Theorem\",  // supplement, string or dictionary like `(en: \"Theorem\")`, or `theorion-i18n-map.at(\"theorem\")` for built-in i18n support\n//   counter: theorem-counter,  // inherit the counter, `none` by default\n//   inherited-levels: 2,  // useful when you need a new counter\n//   inherited-from: heading,  // heading or another counter\n//   render: (prefix: none, title: \"\", full-title: auto, body) =\u003e [#strong[#full-title.]#sym.space#emph(body)],\n// )\n// #show: show-theorem\n\n/// 4. Just use it.\n// #theorem(title: \"Euclid's Theorem\")[\n//   There are infinitely many prime numbers.\n// ] \u003cthm:euclid\u003e\n// #theorem-box(title: \"Theorem without numbering\", outlined: false)[\n//   This theorem is not numbered.\n// ]\n\n/// 5. Example of appendix\n// #counter(heading).update(0)\n// #set heading(numbering: \"A.1\")\n// #set-theorion-numbering(\"A.1\")\n\n/// 6. Table of contents\n// #outline(title: none, target: figure.where(kind: \"theorem\"))\n\n= Theorion Environments\n\n== Table of Theorems\n\n#outline(title: none, target: figure.where(kind: \"theorem\"))\n\n== Basic Theorem Environments\n\nLet's start with the most fundamental definition.\n\n#definition[\n  A natural number is called a #highlight[_prime number_] if it is greater than 1\n  and cannot be written as the product of two smaller natural numbers.\n] \u003cdef:prime\u003e\n\n#example[\n  The numbers $2$, $3$, and $17$ are prime. As proven in @cor:infinite-prime,\n  this list is far from complete! See @thm:euclid for the full proof.\n]\n\n#theorem(title: \"Euclid's Theorem\")[\n  There are infinitely many prime numbers.\n] \u003cthm:euclid\u003e\n\n#proof[\n  By contradiction: Suppose $p_1, p_2, dots, p_n$ is a finite enumeration of all primes.\n  Let $P = p_1 p_2 dots p_n$. Since $P + 1$ is not in our list,\n  it cannot be prime. Thus, some prime $p_j$ divides $P + 1$.\n  Since $p_j$ also divides $P$, it must divide their difference $(P + 1) - P = 1$,\n  a contradiction.\n]\n\n#corollary[\n  There is no largest prime number.\n] \u003ccor:infinite-prime\u003e\n\n#lemma[\n  There are infinitely many composite numbers.\n]\n\n== Functions and Continuity\n\n#theorem(title: \"Continuity Theorem\")[\n  If a function $f$ is differentiable at every point, then $f$ is continuous.\n] \u003cthm:continuous\u003e\n\n#tip-box[\n  @thm:continuous tells us that differentiability implies continuity,\n  but not vice versa. For example, $f(x) = |x|$ is continuous but not differentiable at $x = 0$.\n  For a deeper understanding of continuous functions, see @thm:max-value in the appendix.\n]\n\n== Geometric Theorems\n\n#theorem(title: \"Pythagorean Theorem\")[\n  In a right triangle, the square of the hypotenuse equals the sum of squares of the other two sides:\n  $x^2 + y^2 = z^2$\n] \u003cthm:pythagoras\u003e\n\n#important-box[\n  @thm:pythagoras is one of the most fundamental and important theorems in plane geometry,\n  bridging geometry and algebra.\n]\n\n#corollary[\n  There exists no right triangle with sides measuring 3cm, 4cm, and 6cm.\n  This directly follows from @thm:pythagoras.\n] \u003ccor:pythagoras\u003e\n\n#lemma[\n  Given two line segments of lengths $a$ and $b$, there exists a real number $r$\n  such that $b = r a$.\n] \u003clem:proportion\u003e\n\n== Algebraic Structures\n\n#definition(title: \"Ring\")[\n  Let $R$ be a non-empty set with two binary operations $+$ and $dot$, satisfying:\n  1. $(R, +)$ is an abelian group\n  2. $(R, dot)$ is a semigroup\n  3. The distributive laws hold\n  Then $(R, +, dot)$ is called a ring.\n] \u003cdef:ring\u003e\n\n#proposition[\n  Every field is a ring, but not every ring is a field. This concept builds upon @def:ring.\n] \u003cprop:ring-field\u003e\n\n#example[\n  Consider @def:ring. The ring of integers $ZZ$ is not a field, as no elements except $plus.minus 1$\n  have multiplicative inverses.\n]\n\n/// Appendix\n#counter(heading).update(0)\n#set heading(numbering: \"A.1\")\n#set-theorion-numbering(\"A.1\")\n\n= Theorion Appendices\n\n== Advanced Analysis\n\n#theorem(title: \"Maximum Value Theorem\")[\n  A continuous function on a closed interval must attain both a maximum and a minimum value.\n] \u003cthm:max-value\u003e\n\n#warning-box[\n  Both conditions of this theorem are essential:\n  - The function must be continuous\n  - The domain must be a closed interval\n]\n\n== Advanced Algebra Supplements\n\n#axiom(title: \"Group Axioms\")[\n  A group $(G, \\cdot)$ must satisfy:\n  1. Closure\n  2. Associativity\n  3. Identity element exists\n  4. Inverse elements exist\n] \u003caxiom:group\u003e\n\n#postulate(title: \"Fundamental Theorem of Algebra\")[\n  Every non-zero polynomial with complex coefficients has a complex root.\n] \u003cpost:fta\u003e\n\n#remark[\n  This theorem is also known as Gauss's theorem, as it was first rigorously proved by Gauss.\n]\n\n== Common Problems and Solutions\n\n#problem[\n  Prove: For any integer $n \u003e 1$, there exists a sequence of $n$ consecutive composite numbers.\n]\n\n#solution[\n  Consider the sequence: $n! + 2, n! + 3, ..., n! + n$\n\n  For any $2 \u003c= k \u003c= n$, $n! + k$ is divisible by $k$ because:\n  $n! + k = k(n! / k + 1)$\n\n  Thus, this forms a sequence of $n-1$ consecutive composite numbers.\n]\n\n#exercise[\n  1. Prove: The twin prime conjecture remains unproven.\n  2. Try to explain why this problem is so difficult.\n]\n\n#conclusion[\n  Number theory contains many unsolved problems that appear deceptively simple\n  yet are profoundly complex.\n]\n\n== Important Notes\n\n#note-box[\n  Remember that mathematical proofs should be both rigorous and clear.\n  Clarity without rigor is insufficient, and rigor without clarity is ineffective.\n]\n\n#caution-box[\n  When dealing with infinite series, always verify convergence before discussing other properties.\n]\n\n#quote-box[\n  Mathematics is the queen of sciences, and number theory is the queen of mathematics.\n  — Gauss\n]\n\n#emph-box[\n  Chapter Summary:\n  - We introduced basic number theory concepts\n  - Proved several important theorems\n  - Demonstrated different types of mathematical environments\n]\n\n== Restated Theorems\n\n// 1. Restate all theorems\n#theorion-restate(filter: it =\u003e it.outlined and it.identifier == \"theorem\", render: it =\u003e it.render)\n// 2. Restate all theorems with custom render function\n// #theorion-restate(\n//   filter: it =\u003e it.outlined and it.identifier == \"theorem\",\n//   render: it =\u003e (prefix: none, title: \"\", full-title: auto, body) =\u003e block[#strong[#full-title.]#sym.space#emph(body)],\n// )\n// 3. Restate a specific theorem\n// #theorion-restate(filter: it =\u003e it.label == \u003cthm:euclid\u003e)\n```\n\n## All Cosmos\n\n### 📄Simple\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.simple: *\n#show: show-theorion\n```\n\n[Customize from source code](cosmos/simple.typ)\n\n![image](https://github.com/user-attachments/assets/f1876cfb-1bc9-4edb-a19a-a1922a8babc0)\n\n### 🌈Rainbow\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.rainbow: *\n#show: show-theorion\n```\n\n[Customize from source code](cosmos/rainbow.typ)\n\n```typst\n/// Custom color\n#let (theorem-counter, theorem-box, theorem, show-theorem) = make-frame(\n  \"theorem\",\n  theorion-i18n-map.at(\"theorem\"),\n  counter: theorem-counter,\n  render: render-fn.with(fill: blue.darken(10%)),\n)\n#show: show-theorem\n```\n\n![image](https://github.com/user-attachments/assets/5e6e29f9-c493-4e21-b14a-347f3ca83b99)\n\n### ☁️Clouds\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.clouds: *\n#show: show-theorion\n```\n\n[Customize from source code](cosmos/clouds.typ)\n\n```typst\n/// Custom color\n#let (theorem-counter, theorem-box, theorem, show-theorem) = make-frame(\n  \"theorem\",\n  theorion-i18n-map.at(\"theorem\"),\n  counter: theorem-counter,\n  render: render-fn.with(fill: blue.lighten(85%)),\n)\n#show: show-theorem\n```\n\n![image](https://github.com/user-attachments/assets/1f0f280b-94f5-43b7-b685-d2998d867b58)\n\n### ✨Fancy\n\n```typst\n#import \"@preview/theorion:0.3.2\": *\n#import cosmos.fancy: *\n#show: show-theorion\n```\n\n[Customize from source code](cosmos/fancy.typ)\n\n```typst\n/// Custom color\n#set-primary-border-color(red)\n#set-primary-body-color(red.lighten(95%))\n#set-primary-symbol[#sym.suit.diamond.filled]\n```\n\n![image](https://github.com/user-attachments/assets/a8938339-9510-4371-ae23-7f73a828c17d)\n\n### Contributing your cosmos\n\nWelcome to [open a pull request](htps://github.com/OrangeX4/typst-theorion/pulls) and contribute your beautiful cosmos to Theorion!\n\n\n## Acknowledgements\n\n- Thanks [Johann Birnick](https://github.com/jbirnick) for [rich-counters](https://github.com/jbirnick/typst-rich-counters)\n- Thanks [Satvik Saha](https://github.com/sahasatvik) for [ctheorems](https://github.com/sahasatvik/typst-theorems)\n- Thanks [s15n](https://github.com/s15n) for [typst-thmbox](https://github.com/s15n/typst-thmbox)\n- Thanks [0x6b](https://github.com/0x6b) for [octique](https://github.com/0x6b/typst-octique)\n- Thanks [Pablo González Calderón](https://github.com/Pablo-Gonzalez-Calderon) for [showybox](https://github.com/Pablo-Gonzalez-Calderon/showybox-package)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrangeX4%2Ftypst-theorion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FOrangeX4%2Ftypst-theorion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FOrangeX4%2Ftypst-theorion/lists"}