arnog / mathlive

A web component for easy math input
https://cortexjs.io/mathlive
MIT License
1.57k stars 274 forks source link

Shortcuts breaking virtual keyboard functionality #817

Closed likeadeckofcards closed 3 years ago

likeadeckofcards commented 3 years ago

Description

If a user tries to enter something like 30cm^2, it causes some problems when using the virtual keyboard.

https://user-images.githubusercontent.com/6399755/106804035-e4536280-6632-11eb-863e-81f17489c7a4.mov

Steps to Reproduce

  1. Enter 30cm using a regular keyboard
  2. Open the virtual keyboard
  3. Click the x^2 keycap

Actual Behavior

The latex does not update.

Expected Behavior

I would expect it to update the latex to either 30\operatorname{cm}^2 or 30\operatorname{cm^2}

Environment

Reproducible with the demo tool: https://mathlive.io/examples/latex/index.html

Operating System MacOS

Browser tested both Chrome and Firefox

likeadeckofcards commented 3 years ago

Also, note that manually entering 30\operatorname{cm}^2 causes the exponent to pushed further away from the characters similar to #203.

arnog commented 3 years ago

The issue as reported is not reproducible in the main branch, however, the problem of the offset of the exponent still does (this is caused by the exponent being sometimes attached to the operator atom, sometimes to a msupsub. It should always be a msupsub)

arnog commented 3 years ago

This is now fixed in mathlive@0.0.60

Smef commented 3 years ago

I'm currently using 0.69.4 and this appears to still be an issue, including on the demo site

arnog commented 3 years ago

@Smef what do you mean by "the demo site"? What URL are you using?

Smef commented 3 years ago

The same URL as posted in the original issue posting:

https://mathlive.io/examples/latex/index.html

arnog commented 3 years ago

Ok, this URL was using a version of MathLive that did not have the fix,

if you’re sure you’re using the latest version and it still happens, I’ll reopen the bug and investigate. You can check the version you’re using with console.log(MathLive.version) or by importing version from the MathLive module.

Smef commented 3 years ago

I was incorrect and the newer packaged hadn't been properly installed. My mistake. Thanks for your attention to this issue!

arnog commented 3 years ago

OK, that's great to hear. Thanks for the update!