Theoretic 0.3.0 -- Big Styling Update

I have released an update to my package https://typst.app/universe/package/theoretic/0.3.0

The package allows for creation of theorems and similar environment, with a bunch of other features that seem useful to me (automatic qed placement even if the proof ends with a block equation, multiple reference styles than can be chosen on-the-fly, integration into main outline, sorted list of theorems/definitions/…, restating, automatic theorem numbers, …)

Styling Changes

There are now styled presets: basic, corners, columns, fancy, bar. These can be controlled by a variant parameter on the theorem (e.g. variant: "important" adds a frame around the theorem in most presets), and a fine-grained options dictionary.

The basic style closely mimics the “amsthm” style, and there is similar options available: e.g. remove the . after the title by using options: (head-punct: none).

For full control and defining custom styles, there is a show-theorem parameter which allows for completely custom rendering.

The old fmt-prefix and fmt-body have been removed, instead there is now more fine-grained control available using the above.

Preset Styles:




Other Changes

  • title and label arguments can now be passed as positional or named arguments
  • solution is now a named argument
  • It now takes a piece of content as suffix (qed), instead of a function (fmt-suffix)
  • Nested proofs are now supported (with correct QED placement)
  • There is a new qed-in-equation() helper function to help with manually placed QEDs after block equations.
  • Restated theorems now use the same style as the original automatically.
  • Solutions section: You can now customize what environment/style to use for the solutions.

Please see the manual for full documentation.

Why this package

(Given that I never introduced this package here before, let me show off some of the features that made me make it:)

  • One of the motivating reasons to crate my own theorem-package was the ability to integrate theorems into the main table of contents. Theoretic allows for creating outlines that look like this:

  • However, I don’t want all theorem-like environments to show up in the main outline. For some, such as definitions, I prefer an alphabetically sorted list at the end of the document: (And definitions can also have multiple entries in this list!)

  • Sometimes I want to reference a theorem by name, sometimes by number, depending on sentence context and stuff. Theoretic makes this easy:

  • A point of pride is that QED symbols get automatically placed where they are supposed to go, even if the proof ends with e.g. a block equation. And it is always properly aligned to the baseline!

  • Also, on a technical note – because I think its neat – is that thereotic manages to do this without using any figures. It is indeed possible to reference metadata if you know how to write the show ref: rule.

Go check it out: theoretic 0.3.0 – Typst Universe

7 Likes

This looks really cool! I’m excited to try to use this for creating a TyX setup that mimics what LyX provides with LaTeX :slight_smile:

Couldn’t find it quickly in the documentation, can you change the actual “Theorem” string for other languages?

1 Like

Yay

It is possible to change the supplement, yes:

#let theorem = theorem.with(supplement: "Théorème")

#theorem[abc] // Théorème 1. abc
1 Like