79588786

Date: 2025-04-23 14:02:53
Score: 2
Natty:
Report link

The missing part seems to be the show: conf or show: customEq in the main document to "activate" the show and set rules.

I've tried your code and could make it work, so to me, it is only a question of how you import and declare your code in the two typ files.

//template.typ
#let conf(body) = {
  // set and show rules
  body
}
//main.typ
#import "template.typ":*

#show: conf

$ x + y $ <test>

If you want some ideas on how to reduce your code to something simpler, depending on what you need, you could use: (credit to Typst forum post)

//template.typ
#let customEq(body) = [
  #show math.equation: it => {
    if it.numbering == none and it.has("label") {
      math.equation(it.body, numbering: "(1)", block: true)
    } else { it }
  }
  #body
]

//main.typ
#import "template.typ": *

#show: customEq

$ x + y $
$ a + b $ <xyz>
$ c + d $ <abc>

Also, have you had a look at the Typst package equate?

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (1):
Posted by: vmartel08