File size: 448 Bytes
e2cb4b5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | p = 'papers/2308.08546/main.typ'
s = open(p, encoding='utf-8').read()
anchor = '#set math.equation(numbering: "(1)", supplement: none)'
assert s.count(anchor) == 1
rule = anchor + '''
#show ref: it => {
let e = it.element
if e != none and e.func() == math.equation {
[(#context counter(math.equation).at(e.location()).first())]
} else { it }
}'''
s = s.replace(anchor, rule, 1)
open(p, 'w', encoding='utf-8').write(s)
print('rule added')
|