Skip to content

Add extra-show and allow custom number-gap#22

Open
lordkekz wants to merge 3 commits intoEpicEricEE:masterfrom
lordkekz:master
Open

Add extra-show and allow custom number-gap#22
lordkekz wants to merge 3 commits intoEpicEricEE:masterfrom
lordkekz:master

Conversation

@lordkekz
Copy link

@lordkekz lordkekz commented Nov 28, 2025

Thank you for this package!

This PR contains two changes. First, it adds the extra-show parameter to the equate function which allows users to inject custom show rules or containers around each block equation handled by equate. Second, it adds the number-gap parameter of the equate function to allow users to customize the distance between the equation and the number. Both changes are backward compatible.

Why add extra-show?

In my case, I wanted to set up my documents so that they can be exported both as PDF and as HTML. In plain Typst (without the equate package), you can use the following show rule to embed equations as SVG images:

#import "@preview/bullseye:0.1.0"

#show math.equation.where(block: true): bullseye.show-target(
  html: it => html.frame(it),
  paged: it => it,
)

However, the above does not work when using equate, because equate breaks up the math.equation to create its layout. If you apply a show rule on inline equations, they show up, but their alignment is broken because equate's layout (spacing etc.) gets ignored during HTML export. So, I wanted to add some show rule that applies to the entire block equation even when using equate. With this PR, we can add this in the call to equate like so:

#import "@preview/bullseye:0.1.0"
#import "@preview/equate:0.3.2": equate

#show: equate.with(extra-show: it => bullseye.show-target(
  html: it => html.frame(it),
  paged: it => it,
))

I also considered adding HTML support directly to equate, but I think this is better because it is more flexible and allows even further customization. Also this means that the equate won't depend on any experimental HTML features of Typst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant