How to redefine the default frac behavior while avoiding circular references

One solution is a workaround for math.equation suggested by @frozolotl in this issue: https://github.com/typst/typst/discussions/2242

The modified show rule is

#show math.frac: it => {
  if it.has("label") and it.label == <stop-frac-recursion> {
    it
  } else {
    [#AddSpacefrac(it.num, it.denom) <stop-frac-recursion> ]
  }
}

Not sure if there is a better solution than this workaround.

1 Like