{"id":26430548,"url":"https://github.com/s15n/typst-thmbox","last_synced_at":"2026-02-02T18:40:51.373Z","repository":{"id":275327776,"uuid":"925763404","full_name":"s15n/typst-thmbox","owner":"s15n","description":"Modern, Friendly, and Customizable Theorem Environments for Typst","archived":false,"fork":false,"pushed_at":"2025-06-15T11:44:36.000Z","size":355,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T12:28:34.086Z","etag":null,"topics":["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/s15n.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-01T17:31:50.000Z","updated_at":"2025-06-15T11:44:39.000Z","dependencies_parsed_at":"2025-03-18T05:42:05.101Z","dependency_job_id":null,"html_url":"https://github.com/s15n/typst-thmbox","commit_stats":null,"previous_names":["s15n/typst-thmbox"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/s15n/typst-thmbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s15n%2Ftypst-thmbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s15n%2Ftypst-thmbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s15n%2Ftypst-thmbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s15n%2Ftypst-thmbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/s15n","download_url":"https://codeload.github.com/s15n/typst-thmbox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/s15n%2Ftypst-thmbox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262598140,"owners_count":23334667,"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":["typst","typst-package"],"created_at":"2025-03-18T05:31:50.331Z","updated_at":"2026-02-02T18:40:51.367Z","avatar_url":"https://github.com/s15n.png","language":"Typst","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Typst Thmbox\n\nA typst package providing modern environments for theorems and proofs;\nequipped with predefined variants for all common use cases but also\nthe flexibility to create custom ones with ease.\nBuilt to easily write lecture notes with minimal setup.\n\n## Usage\n\nBefore using any of the features this package has to offer, add the following lines to the top of your document:\n\n```typ\n#import \"@preview/thmbox:0.3.1\": *\n\n#show: thmbox-init()\n```\n\nNow, the basic building block for thmbox environments is `thmbox`:\n\n```typ\n#thmbox[\n    This is a basic Thmbox\n] \u003cbasic-box\u003e\n\nIt can be referenced (see @basic-box).\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d1.svg\"\u003e\n  \u003cimg src=\"gallery/l1.svg\"\u003e\n\u003c/picture\u003e\n\nUsing the `color`, `variant`, and `title` parameters, we can style this box:\n```typ\n#thmbox(\n    variant: \"Important Theorem\", \n    title: \"Fundamental Theorem of Math\", \n    color: red\n)[\n    A statement can only be believed if it is proven. \n]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d2.svg\"\u003e\n  \u003cimg src=\"gallery/l2.svg\"\u003e\n\u003c/picture\u003e\n\nTo prove this statement, we can follow up with a `proof`:\n```typ\n#proof[\n    Proven by obviousness.\n]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d3.svg\"\u003e\n  \u003cimg src=\"gallery/l3.svg\"\u003e\n\u003c/picture\u003e\n\n---\n\nFor your environments, Thmbox actually ships with a variety of predefined ones, for theorems, corollaries, definitions, examples, etc:\n\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d4.svg\"\u003e\n  \u003cimg src=\"gallery/l4.svg\"\u003e\n\u003c/picture\u003e\n\nNote that you don't need to specify the title parameter by name:\n```typ\n#definition[Typst][\n    Let Typst be the coolest typesetting system.\n]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d5.svg\"\u003e\n  \u003cimg src=\"gallery/l5.svg\"\u003e\n\u003c/picture\u003e\n\n## Usage Notes\n\nThe recommended way of implementing new types of thmboxes is like this:\n```typ\n// derive from some predefined function\n#let important = note.with(\n    fill: rgb(\"#ffdcdc\"), \n    variant: \"Important\", \n    color: red,\n)\n\n#important[\n    This is in fact very important!\n]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d6.svg\"\u003e\n  \u003cimg src=\"gallery/l6.svg\"\u003e\n\u003c/picture\u003e\n\nOf course, deriving from `thmbox` is just as good, but the predefined environments have some other parameters already set as well.\n\n---\n\nBy default, the counter for thmboxes has two levels where the first one marks the chapter and the second gets reset at the start of each chapter.\nTo change that, use the `counter-level` parameter of `thmbox-init`. The default is 2, but for example, 1 will be one number counting in the entire document, 3 will count per section, and so on.\n\nYou can also use custom counters. Those must be registered with `sectioned-counter(\u003ccounter\u003e, level: \u003clevel\u003e)` where level works just like `counter-level` mentioned above.\n\n```typ\n// Just some arbitrary custom counter\n#let exercise-counter = counter(\"exercise\")\n\n// Register the counter for thmbox\n#show: sectioned-counter(exercise-counter, level: 1)\n\n// Use the counter\n#let my-exercise = exercise.with(counter: exercise-counter)\n\n#my-exercise[The first exercise!]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d7.svg\"\u003e\n  \u003cimg src=\"gallery/l7.svg\"\u003e\n\u003c/picture\u003e\n\n---\n\nAs set rules don't work with user-defined functions, a similar effect can be achieved the following way:\n```typ\n// Define your custom thmbox args\n#let my-thmbox-rules = (\n    fill: rgb(\"#fffdd3\")\n)\n\n// redefine predefined environments\n#let my-definition = definition.with(..my-thmbox-rules)\n\n// use\n#my-definition[\n    This definition has a yellow background!\n]\n```\n\u003cpicture\u003e\n  \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"gallery/d8.svg\"\u003e\n  \u003cimg src=\"gallery/l8.svg\"\u003e\n\u003c/picture\u003e\n\n---\n\nThe recommended font for documents using this package is New Computer Modern (shipped with Typst).\n\nThe recommended sans-serif font (can be changed with the `sans-fonts` and `title-fonts` parameter) is New Computer Modern Sans (download at [CTAN](https://ctan.org/pkg/newcomputermodern))\n\nBy default, thmboxes don't break across pages. To enable that, you can use the rule `#show figure.where(kind: \"thmbox\"): set block(breakable: true)`. Other `set` and `show` rules for figures can be used with thmboxes as well, as figures are used under the hood.\n\n## Installation\n\nNo steps are required when installing from `@preview`. To install this package [locally](https://github.com/typst/packages?tab=readme-ov-file#local-packages), do\n\n```sh\ncd \u003cdata-dir\u003e/typst/packages/local/thmbox\ngit clone https://github.com/s15n/typst-thmbox.git 0.3.1\n```\nwhere `\u003cdata-dir\u003e` is\n- `$XDG_DATA_HOME` or `~/.local/share` on Linux\n- `~/Library/Application Support` on macOS\n- `%APPDATA%` on Windows\n\nYou might have to create the folder in the first line first.\n\n## Translations\n\nThmbox automatically translates to the language of your document (if translations are available for it).\n\nTranslations are found in [src/translations.typ](https://github.com/s15n/typst-thmbox/blob/main/src/translations.typ). You are welcome to contribute for languages you speak.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs15n%2Ftypst-thmbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs15n%2Ftypst-thmbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs15n%2Ftypst-thmbox/lists"}