When I found out that option B was already merged [1] I got very excited because the current behavior is still very unintuitive to me and one of the few areas where I prefer the behavior from Latex. Unfortunately, the changes were reverted shortly after because they discovered deeper issues with the new old design [2]. As far as I can see, there hasn't been any further progress on this, sadly.
I find https://github.com/typst/typst/pull/7072#issuecomment-338580... more enlightening about what's going on. Specifically the difference between these three:
With a programming language background, that's just odd to reconcile. If 1/2 is treated as a rational integer literal, it's possible to explain the difference between the first two. (And apparently this difference is wildly expected, uncommon as fractions as literals are in programming languages.) But then the last one should turn into (½)ˣ(x+y) because the exponentiation should not slip inside the literal. (I expect the different outcome in the comment is not the result of an algebraic simplification in his case. I really wish they had used 2/3 as the fraction to clarify this.)It seems that TeX users struggled with this at one point, too. That's why LaTeX users generally write $\frac{a}{b}$ instead of $a \over x$. Copious use of braces not rendered in the output certainly avoids precedence issues.
It's also a cultural thing I suppose, as I would personally understand all these expressions having just one as the numerator and the rest below.
It may be related to the fact that "mixed numbers" were never part of my curriculum (Wikipedia¹ says they are more common in non-metric regions). Or it may be just me. In any case, I find this notation ambiguous, so I would not expect a compiler to resolve it correctly.
Edit: also, I would rather write (x + y)/2 if I wanted half the sum, that seems much more logical to me than moving non-integer factors around.
¹ https://en.wikipedia.org/wiki/Fraction#Mixed_numbers
> Edit: also, I would rather write (x + y)/2 if I wanted half the sum, that seems much more logical to me than moving non-integer factors around.
Based on what I recall, there's a bit of an aversion towards writing / or ÷ for division (or explicitly written multiplication). And $\frac{1}{2}(x+y)$ is more readable in inline text than $\frac{x+y}{2}$.
I agree, though I wish you had specified in what context that aversion was.
To give a specific example, I can cite units in the metric system, often written as kg.s⁻².J⁻¹ instead of the more ambiguous kg/s²/J; which could technically be read as kg/(s²/J), giving kg.J.s⁻¹.
The newest pull request is:
https://github.com/typst/typst/pull/7137
from what I can tell. The commits look two days old so work looks on going.
I do not understand the current set of preferences laid out in:
https://github.com/typst/typst/pull/7072#issuecomment-338580...
I do not understand 8, 9 'my preference' column and why they would make the similar syntax render differently.
(Author of the post and issue comment here.)
The preferences there were honestly rather ad-hoc w.r.t to the pull request and the approach the pull request took. And (as the author laid out), the PR was a rather ad-hoc solution for a problem we discovered literally one night before Typst 0.14 was supposed to be released.
The design thoughts there were a bit half-baked, which is why we've closed the PR and reverted the original change, to get more time to properly reconsider things.
The math syntax has seen little change since Typst's initial release (except for the infamous precedence change in 0.3 that triggered all this) and just has some quirks that haven't been properly ironed out yet. However, it will remain a focus now and we want to give it a proper cleanup.