mathlive
mathlive copied to clipboard
[Question] Automatically add case when Shift + Enter pressed?
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 🤦🏻♂️
You can save/restore the position of the cursor using mf.position (where mf is the mathfield element).
Pressing alt/option+enter now inserts a new line.