edemaine / cocreate

Cocreate Shared Whiteboard/Drawing
MIT License
209 stars 27 forks source link

Cursor in LaTeX equations #191

Open diomidov opened 3 years ago

diomidov commented 3 years ago

When the text cursor is inside an equation, it is shown before the equation: image It would be nice if the cursor was shown correctly inside the equation.

Related: when you hover your mouse over an equation in VS Code, it renders it with the cursor: image It does this by inserting {\color{...}\!|\!} at the cursor position before calling the LaTeX renderer (source). Unfortunately this approach can occasionally fail: image

I'm not sure if this is better or worse than what we currently have in Cocreate...

edemaine commented 3 years ago

As the LaTeX rendering is expensive in Cocreate (as it uses MathJax instead of KaTeX like VSCode does), I'd rather not rerender as the cursor moves. I think the current behavior is best, unless you think an underline of or box around the formula would be better?

diomidov commented 3 years ago

Maybe the cursor shouldn't render at all when it's inside the formula? That'd still be better than what we have now.