Live data from Hacker News

Typst's Math Mode Problem

laurmaedje.github.io

41–50 of 57 posts

Re: Typst's Math Mode Problem

#41
post #40

Earlier quoted context omitted.

MathML recommends using the invisible operators for invisible times or function application (&InvisibleIimes; [U+2062] and ⁡ [U+2061] respectively) to differentiate the two.

Unfortunately, they're... invisible. Though they can still be highlighted in an editor, so also helpful

You notate the operation with * and $ (in mathup I use .* and .$ to make the operator invisible). Literal π is used both as a constant and as a function identifier depending on context so π(1 + n) can either be e.g. the (n+1)th prime or pi times one plus n. It is usually clear from context which one the author meant but if it is a problem explicit notation could help for sure.

I have also heard that the invisible operators help with accessibility. I haven’t tested this on my screen reader, but I suppose π⁡... would read something like “Pi of ...” whereas π⁢... would read something like “Pi times ...” all the while π( would just read “Pi [open parenthesis] ...”.

Re: Typst's Math Mode Problem

#42
post #32

Earlier quoted context omitted.

I complained about this before and people dismissed me as an old timer. I did doubt myself as well to be honest. Its bittersweet to be correct.

I hate recurse to authority, but after a markup slash programming language has been written by Don Knuth and a macro system for it has been developed by Leslie Lamport, maybe one should take some notes so as to why things were done in a certain way?

They're not infailable, though. For example, TeX's primitive for fractions is actually {a \over b}, LaTeX's \frac is a macro on top of that. The consequence is that while typesetting a formula, the engine does not know the current text size, since an \over further down the line may put the entire thing into a numerator. Dealing with this can be quite a pain when writing math macros.

Re: Typst's Math Mode Problem

#43
post #19

It feels absurd to have this occur in the parser, as if you can somehow account for all the cases via guessing what people I mean. You absolutely must have a grouping operation like {} at least available as a fallback. I feel like this is a lesson people keep learning over and over across programming languages: don't let your syntax try to infer the intended meaning of what was typed, just do something simple and pre…

Typst has made some basic choices, which as someone who typsets a lot of math, makes it a no go. - The use of space character to also act as the escape character (latex use backslash) [1]. Not only does it cause confusion, I have to now escape everything $F=ma$ become $ F = m a $ in typst. Complex math equations will be complex no matter what - why make simple equations harder to type to make it slightly easier to ty…

> What I want from my typesetting language is "typsetting completeness". While there might be sane defaults, I want to be able to control every decision made by the typesetter by escaping and grouping things as needed. If the language doesn't have these features, by definition, it is not complete.

Then LaTeX is not complete. Macros don’t have to respect the grouping provided by curly braces in math mode, therefore you only have the illusion of control. Nobody in practice actually inspects the full package dependency chain needed to typeset a nontrivial document.

Here’s a proof of concept: https://tex.stackexchange.com/questions/748416/how-can-i-aut...

Re: Typst's Math Mode Problem

#44
post #32

Earlier quoted context omitted.

I complained about this before and people dismissed me as an old timer. I did doubt myself as well to be honest. Its bittersweet to be correct.

I hate recurse to authority, but after a markup slash programming language has been written by Don Knuth and a macro system for it has been developed by Leslie Lamport, maybe one should take some notes so as to why things were done in a certain way?

I actually think Typst should ignore the design of TeX and LaTeX more—and especially the well-meaning advice of LaTeX veterans who have only ever known one way of typesetting.

The situation reminds me of how Julia’s evolution was guided in some aspects by some opinionated and vocal {Python, R, MATLAB} developers who never had any intention of transitioning to Julia, whether or not their advice was implemented.

Re: Typst's Math Mode Problem

#45
post #8

I really don't see the problem with the current notation. I find that is very simple and intuitive: function calls bind tightly, use a space to change that. f_i(x) vs f_i (x) 1/x(a+b) vs 1/x (a+b) ab vs a b So simple. Being too "smart" invariably leads to more headaches and confusion than just having a simple, consistent rule.

[deleted]

Re: Typst's Math Mode Problem

#46

Earlier quoted context omitted.

Typst has made some basic choices, which as someone who typsets a lot of math, makes it a no go. - The use of space character to also act as the escape character (latex use backslash) [1]. Not only does it cause confusion, I have to now escape everything $F=ma$ become $ F = m a $ in typst. Complex math equations will be complex no matter what - why make simple equations harder to type to make it slightly easier to ty…

> What I want from my typesetting language is "typsetting completeness". While there might be sane defaults, I want to be able to control every decision made by the typesetter by escaping and grouping things as needed. If the language doesn't have these features, by definition, it is not complete. Then LaTeX is not complete. Macros don’t have to respect the grouping provided by curly braces in math mode, therefore yo…

Yes it is not. I think a replacement for latex is needed, but it needs to make better design choices than Typst.

That said, Typst has many good things, like easy to write methods, which this new language should adopt.

Re: Typst's Math Mode Problem

#47
post #19

It feels absurd to have this occur in the parser, as if you can somehow account for all the cases via guessing what people I mean. You absolutely must have a grouping operation like {} at least available as a fallback. I feel like this is a lesson people keep learning over and over across programming languages: don't let your syntax try to infer the intended meaning of what was typed, just do something simple and pre…

Typst has made some basic choices, which as someone who typsets a lot of math, makes it a no go. - The use of space character to also act as the escape character (latex use backslash) [1]. Not only does it cause confusion, I have to now escape everything $F=ma$ become $ F = m a $ in typst. Complex math equations will be complex no matter what - why make simple equations harder to type to make it slightly easier to ty…

> Typst has made some basic choices, which as someone who typsets a lot of math, makes it a no go.

For me, breaking from not just a 40-year-old history of mathematical typesetting but also from the American Mathematical Society recommendations is the dagger. Plus doubling work if you want to reuse what you wrote to render MathJax or KaTeX.

> $\alpha x$ is correct and $\alpha\beta$ is correct, but $\alphax$ is not.

Like you said, braces can be used so all of the following are valid: ${\alpha}x$, $\alpha{x}$ or the odd $\alpha{}x$.

Re: Typst's Math Mode Problem

#48
post #40

Earlier quoted context omitted.

Unfortunately, they're... invisible. Though they can still be highlighted in an editor, so also helpful

You notate the operation with * and $ (in mathup I use .* and .$ to make the operator invisible). Literal π is used both as a constant and as a function identifier depending on context so π(1 + n) can either be e.g. the (n+1)th prime or pi times one plus n. It is usually clear from context which one the author meant but if it is a problem explicit notation could help for sure. I have also heard that the invisible ope…

Good point about primes, not enough symbols for uniqueness, so just π isn't enough! Though using two symbols ( .* ) in place of nothing is too dirty, better use an invisible and color highlight the spacing between π and ( to indicate to the plain text reader the difference.

Win screenreaders understands 2.3 (pronounced two three) vs 23 (twenty three), though it doesn't pronounce the operator, neither in a.2 vs a2 (though pronounced differently). But this could be fixable, so also good point about accessibility

Re: Typst's Math Mode Problem

#49
post #32

Earlier quoted context omitted.

I hate recurse to authority, but after a markup slash programming language has been written by Don Knuth and a macro system for it has been developed by Leslie Lamport, maybe one should take some notes so as to why things were done in a certain way?

I actually think Typst should ignore the design of TeX and LaTeX more—and especially the well-meaning advice of LaTeX veterans who have only ever known one way of typesetting. The situation reminds me of how Julia’s evolution was guided in some aspects by some opinionated and vocal {Python, R, MATLAB} developers who never had any intention of transitioning to Julia, whether or not their advice was implemented.

agree, I'm fine with Typst throwing out the old ways and doing the new ones... just, do your research; do it right
Post reply on HN