stefnotch / aftermath-editor

A WYSIWYG mathematics editor that understands your formulas!
https://stefnotch.github.io/aftermath-editor
MIT License
13 stars 0 forks source link

Add integral symbol to math editor #24

Open stefnotch opened 1 year ago

stefnotch commented 1 year ago

$\displaystyle \int_a^3 x^2 dx$

$\displaystyle 2y \big|_a^3$

stefnotch commented 1 year ago

"Integral" should just insert the integral symbol and the renderer should hint at the fact that "sub" and "sup" are possible. Including with a point-and-click ability. Like click on the bottom of the lonely integral symbol and a sub automatically gets inserted. Note that those should not be rendered like normal placeholders. After all, you cannot move into them using arrow keys. Maybe those not-placeholders should even only be rendered when the caret is nearby?

(Writing a sum or a lim without any bounds is somewhat reasonable after all.)

That way, after inserting an integral symbol, you can hit backspace to remove it again. You don't have to backspace the sub and sup.

stefnotch commented 10 months ago

Those symbols don't have sub and superscripts. They have "under/over" tokens. Notice how you cannot put your caret between the subscript and the symbol. Like $a|^{x}$ is impossible with a sum.

stefnotch commented 10 months ago

And also forced autocorrect: // - / fraction // - ^ exponent // - subscript // \sum turns into a (under sum ...) // \sum^ turns into a (over sum ...) // \sum_^ turns into a (under over sum ...)

stefnotch commented 10 months ago

An alternative somewhat consistent way of handling it would be

  1. "sup-sub" can be merged into "supsub". (but when and how?)
  2. lim, sum, and so on all accept sup and subs. And they continue acting like operators.
  3. All operators accept sup and subs. So $1+x^2$ turns into $1+^2$. And it's up to the CAS to say "noooo, I report an error".