How to render $1+$ as a symbol instead of an unfinished equation?

In LaTeX, the following happens when I write $1+$ or $1+1$
Screenshot_20260424_135827

In the first case, 1+ is rendered without space and can be read as a single symbol. In the second case, it is rendered with spaces, like usual for an equation.

In typst however, the first case ($1+$) is rendered as follows
Screenshot_20260424_140133

There is now a space between 1 and +. How can I get the behaviour from LaTeX in typst?

I tried writing $1$$+$ in typst. That works, but feels hacky.

Is there a better way to write $1+$ in math mode and get it rendered without space between the 1 and the +?

I’m not an expert on math rendering, but that sounds like you need to customize the math class:

$1 class("normal", +)$

+ ordinarily is a vary operator, meaning it can be a unary prefix or binary infix operator. In suffix position, it seems to be treated as binary with the second operand missing; manually making it normal overrides this.

If this 1+ now behaves strangely in other circumstances, maybe one of the other match classes works better, but normal sounds like a good bet.

2 Likes

Thanks for providing a canonical solution! I’ll file a bug report then, because treating + as binary infix if it is a postfix does not seem to make sense.

Edit: here is the bug report for anyone interested.