mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

[Question] Automatically add case when Shift + Enter pressed?

Open Explosion-Scratch opened this issue 3 years ago • 1 comments

Some math editors do this when you press Shift + Enter:

https://user-images.githubusercontent.com/61319150/170836921-bb4b666b-ccf1-446b-9769-4152a9bee199.mp4

This allows users to easily write systems of equations, make things neater and more. Is there either 1) A built in way I can do this or 2) A way I can with onKeystroke?

I tried to do this with onKeystroke which was working ok but then it placed the cursor at the very end of the equation instead of at the previous point, and there's no way to save/restore the cursor position except for by viewport position. Viewport position doesn't work because the content changed 🤦🏻‍♂️

Explosion-Scratch avatar May 28 '22 17:05 Explosion-Scratch

You can save/restore the position of the cursor using mf.position (where mf is the mathfield element).

arnog avatar May 29 '22 14:05 arnog

Pressing alt/option+enter now inserts a new line.

arnog avatar Apr 19 '23 05:04 arnog