rekka
November 12, 2025, 2:58am
1
How does one force - to be interpreted as unary in $"if" -x$ ?
The solution I came up with is $"if " #h(0em) -x$.
See example here https://typst.app/project/rxngGTGMnj4UAEVrMj7WNu
Is there a simpler way to do this?
In LaTeX I would just use {-x}. But trying similar things in Typst does not seem to work: $"if" #($-x$)$ $"if" #{$-x$}$
1 Like
cAtte
November 12, 2025, 7:32am
2
try math.class :
$ "if" class("unary", -) x $
maybe
#let umin = math.class("unary", $-$)
$ "if" umin x $
perhaps even
#show sym.minus: math.class.with("unary")
$ "if" -x $
2 Likes
sitandr
November 12, 2025, 7:36am
3
It’s also possible to use a container for your second approach to work:
$"if" #box[$-x$]$
2 Likes
DNF
November 12, 2025, 3:10pm
4
This seems pretty complicated. I’m surprised that $-x$ doesn’t always render as unary minus and $- x$ as regular minus. Or perhaps any instance of -x (that is space, then minus, then symbol).
2 Likes