Download scripts/_fix_refrule.py from m-rui001/physics-typst-corpus: direct link, hf CLI and curl.
- Browser
- Download file 448 Bytes
-
https://huggingface.co/datasets/m-rui001/physics-typst-corpus/resolve/main/scripts/_fix_refrule.py
- Command line
-
hf download hf://datasets/m-rui001/physics-typst-corpus/scripts/_fix_refrule.py
-
curl -L -o _fix_refrule.py https://huggingface.co/datasets/m-rui001/physics-typst-corpus/resolve/main/scripts/_fix_refrule.py
448 Bytes
| 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') | |