Hi all!
I am trying to call #sym.dash in a private module but I get no character (long dash is desired) as output (no error either). The same code runs no problem if it is in the typ document.
Should I import sym somehow explicitly when calling it from modules?
Is there a workaround to do the desired replacement?
let atoms = "C"
let re = regex("(" + atoms + ")-(" + atoms + ")")
show re : it => {
let (atom1, atom2) = it.text.match(re).captures
[#atom1;#sym.dash;#atom2]
}
If you try to copy and paste the code from your post yourself, you will see that it can’t compile. Could you please try to edit your post and format it accordingly?
this works fine for me (an en dash shows up). you shouldn’t need to do any stuff with imports; sym is a global module and should be available anywhere. i doubt it, but perhaps you’re shadowing it with a local variable of the same name? in that case, you can try writing std.sym.dash (std is a global module that includes all of the other modules as children)
Thanks @cAtte , yes this works for me fine. The problem is when I put the let and show statements in a private module and try to style a document with it. Thanks for the suggestion on std.sym.dash, I tried it but it doesn´t work either
I’m not quite sure what you mean by this breaking when you use a private module. Is the issue related to the show rules not working at all? See Making a Template – Typst Documentation in the tutorial