Gap in the numbering of my equations

There is a gap in the numbering of my equations.

let mine = counter("equation counter")

mine.step()

let unary(.., last) = "(" + mine.step() + counter(heading.where(level:1)).display()+ "." + mine.display() + ")"

set math.equation(numbering: unary, number-align: top)

Result:


Can someone help me, please?

The numbering function is called both in equations and their references. Therefore, mine.step() is executed even in references.

Solution:

#show: body => {
  set heading(numbering: "1.1")
  set math.equation(
    numbering: n => {
      // Add the chapter number
      let chap = counter(heading).get().first()
      [(#chap.#n)]
    },
    number-align: top,
  )
  show heading.where(level: 1): it => {
    // Reset the equation counter at chapters
    counter(math.equation).update((0,))
    it
  }

  body
}

= Heading

$ F(x) $ <f>

See @f

$ G(x) $

= The next chapter

@f also works

kindly thank you

Glad to know.
You can :white_check_mark: mark my reply as the solution, so that others will know this question has been answered.