How to make identical equations appearing multiple times across different slides share the same equation numbers?

Hi guys! I’m currently using Touying 0.6.1 combined with Equate 0.3.0 to create slides. I noticed that when the same formula appears multiple times across different slides, it ends up being assigned different equation numbers. For example:

#import "@preview/touying:0.6.1": *
#import themes.metropolis: *
#import "@preview/equate:0.3.0": equate
#set math.equation(numbering:"(1)")
#show: equate.with(breakable: false, sub-numbering: false, number-mode: "label")

#import "@preview/numbly:0.1.0": numbly

#show ref: it => {
  let eq = math.equation
  let el = it.element
  if el != none and el.func() == eq {
    // Override equation references.
   
    numbering(
      el.numbering,
      ..counter(eq).at(el.location())
    )
  } else {
    // Other references as usual.
    it
  }
}



#show: metropolis-theme.with(
  aspect-ratio: "16-9",
  pagination: none,
  footer: [],
  footer-right: [],
  config-info(
    title: [$section 3$ Example],
    subtitle: [],
    author: [SpringFiled],
    date: datetime.today(),
    institution: [],
     lang: "zh",
  font: ("Linux Libertine", "Source Han Sans SC", "Source Han Sans")
  ),
  config-common(handout: true)
)

#set heading(numbering: numbly(none, default: none))

// Extract slide functions 
#set text(font: "Noto Sans CJK SC")



#title-slide()

= Example

== Formula

$
a=b
$ <AB>

== 

$
a=b
$ <AB>

Here, the formula a = b is labeled as equation (1) on the first slide, but as equation (2) on the next slide, even though it’s exactly the same equation.

How can I resolve this issue so that identical equations appearing multiple times across different slides share the same equation number? Many thanks!

PS: Additionally, I would like to number some (not all) equations in the form like (3.9A) rather than (3.9). How can I make it happen?

Hello @Shujun_Tan, I noticed you have handout enabled, so It’s unclear to me whether you are trying to repeat it because you can’t use animations, or because you want to re-use an equation.

In the first case, if you disable the handout mode, then you will be able to use animations with #pause and #meanwhile. You can follow the tutorial at Touying - Getting Started.

It retains only the last subslide of each slide.

tl;dr: you should write the equation once, followed by #pause, then the rest of your slide.

== Formula

$
a=b
$ <AB>

#pause

[...]

In the second case, if you want to reuse an existing equation then you should query it. Make sure you only have one label per equation, otherwise you will get multiple results from the query. This will prevent your equation from having different numbers.

== Formula

$
a=b
$ <AB>

[lots of slides...]

== Formula MK2

#context query(<AB>).first()

It would be best if you split the topic, can you create another one with this specific question?