Default for equation numbering should be: number only labelled equations

I want to propose that the default for equation numbering should be that things like $ a+b=c $<eq:abc> get a number but $ d + e = f $ (that does not have a label) does not. Now this is definitely a minor issue and Typst can of course be customized by adding the following to the preamble:

#show math.equation: it => {
if it.block and not it.has("label") and it.numbering != none \[
#counter(math.equation).update(v => v - 1)
#math.equation(it.body, block: true, numbering: none)
\] else { it }
}

I simply do not understand why this is not the default already and I think it should be changed. I cannot imagine that there are many people that want to number every single displayed equation in their papers. But maybe this is simply a lack of imagination on my part!

6 Likes

Yes, I agree that this shouldn’t be the default. I think the team is working towards a math update that contains an overhaul to the internals and addresses how ambiguous syntax is parsed (e.g. $f_n(x)$ currently parses as $f_(n(x))$ instead of $f_n (x)$ which is, in many people’s opinion, incorrect).

hopefully this update will address the open issues related to numbering aswell (like #380 and #3031). The team tends to prioritise issues with more attention, so if you have a github account make sure to like/contribute towards them! :grin:

Thank you! I see that this is in fact exactly #3031. It seems quite different than #380 to me (the “parent”?), but I understand that these are at least related issues.

1 Like

Yes, I’m not really up to date on the numbering discussion but reading the comments on #3031 it seems the team is aware of these issues and they were discussed, just perhaps not on the original thread.

Regarding Github, it seems the discussion on there was closed in April 2026, so it is pointless to write further text there, right?

Unless I missed something obvious, I don’t think either issue is closed, and if you can meaningfully contribute towards the design of the proposal i’d encourange you to participate!

Sorry, I am completely new to this and very easily get lost. I was referring to typst/typst · Discussions · GitHub - I now understand that this is only a part of what is happening on Github, and in particular is separate from the Issues section. In fact I came across another issue now, I guess I should make a post on Github about it then and not here?
I don’t think I am going to be able to help with the programming I’m afraid, I wouldn’t even know where to find THE design of THE proposal that you mentioned… never heard about either until now.

Ah, I didn’t even realise there was a separate discussion page on github! Indeed, it is not used any more and the forum/discord are where most conversations take place. Before posting about a new issue, you should first try to see if there has been any discussion about it to avoid duplicating known issues (though, sometimes finding these other issues can be somewhat difficult. Asking here or on the discord can be helpful, as many people will have a general idea on what is on the pipeline). If you can’t find anything, then it’s fine to post :)

And about helping with programming, that’s fine. I was mainly referring to comments that just ask for a progress update instead of being helpful. Proposing solutions, even from just a user perspective (like how it should behave, what the syntax could look like..) is helpful.

I am one of those people who prefer to number every displayed equation: the numbers are useful not only to the author but also to readers, who may want to cite an equation that the author does not reference. So whatever the default is, the other option should be easily available.

Honestly, I’m a bit mixed on this. I agree this behavior is one of the desirable ones, especially since, right now, Typst’s block equation environment doesn’t have nice numbered/un-numbered syntax similarity that LaTeX has with \begin{equation} vs. \begin{equation*}. However, I’m less certain on if this would be the most intuitive default. At least the current default behavior is almost impossible to misunderstand, but I could see people getting confused on conditional numbering based on labels (just because we find it intuitive doesn’t mean others will).

Typst’s native scripting already provides some good solutions, as has been demonstrated. I think a good middle ground would be to extend Typst’s Equation documentation with the code block:

#show math.equation: it => {
  if it.block and not it.has("label") and it.numbering != none [
    #counter(math.equation).update(v => v - 1)
    #math.equation(it.body, block: true, numbering: none)
  ] else {
    it
  }
}

so people can easily find it.

I could very well change my opinion on this. If the default is changed to only number labeled equations, I would at least want the built-in documentation for the equation environment (the one directly accessible through Tinymist) to clearly state how the default numbering works.

1 Like

My two cents as a professional mathematician.

Having only the referenced equations being labeled is one of technical prerequisites for paper to be published in a journal. So, having only labeled eqautions being tagged is a must-have feature for mathematicians.
Mathematicians, being used to LaTeX, would expect that there is some very simple way of achieving this. I was also annoyed when I found out that this behaviour is not available in Typst out of the box, or by simply setting a parameter through #show. Current solution, having to include a block of code for the desired effect, seems to me as sub-optimal, certainly making Typst a tougher sell to my colleagues and students.

6 Likes

Here is the solution I use in all the templates I develop (bookly, elsearticle, elspub):

#show selector(<nonum-eq>): set math.equation(numbering: none)

This locally deactivate the equation numbering. To use it, you just have to type:

$ y = f(x) $<nonum-eq>

There is value in keeping things simple: “all equations are numbered” is a simpler rule than “only equations referenced one or more times are numbered”.

I understand that people have different opinions on this issue and that is of course perfectly valid, but I do want to gently push back here. My suggestion is that Typst work by default as follows:

$ this is a non-labeled equation $

$ this is a labeled equation $<and-here-is-the-label>

I would argue that this is a pretty simple rule. And it is what mathematicians like me and Semi would expect.

regardless of defaults, I hope we can all agree that some easier way of customizing this behavior would be appreciated. Something like a parameter numbering-mode: none | "all" | "labeled" | "referenced", like what equate does (save for referenced equations).

4 Likes