-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Here's a somewhat arbitrary example of an equation I just had to write using typst:
(I've added linebreaks for clarity)
$
kappa(lambda) := inf_(u in H_0^1(Omega), u equiv.not 0)
(display(integral_Omega (abs(nabla u)^2 - g(lambda abs(nabla H)) u^2) dif x))
/
(display(integral_Omega u^2 dif x))
$It's not terribly important what it looks like, but here you go anyway:

Even in an editor with bracket colorization, I find the code very hard to read, because they're all parentheses. For all its flaws, LaTeX actually does better here, because it uses braces for grouping code. This means that the delimiters for grouping code is different from the one (primarily) used in math.
I propose that we allow both ( ), [ ] and { } for grouping purposes for attachments and fractions. Then the above example could for instance read
$
kappa(lambda) := inf_{u in H_0^1(Omega), u equiv.not 0}
{display(integral_Omega (abs(nabla u)^2 - g(lambda abs(nabla H)) u^2) dif x)}
/
[display(integral_Omega u^2 dif x)]
$To me, this is already a lot more readable, because it removes one layer of parentheses. I can also have my own convention of for instance using {} for numerators and [] for denominators.
We could even consider the more radical move of allowing {} and [] for function calls, which would further improve readability in deeply nested scenarios (they can be much worse than the example I chose here).