arnog / mathlive

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

Subscripts should be grouped with base #2541

Open gunnarmein-ts opened 4 weeks ago

gunnarmein-ts commented 4 weeks ago

Description

Today, Mathlive internally arranges the latex construct "x_i^2" in this way:

position n: x n+1: ^2 n+3: _i

This makes it impossible to select "x_i", instead, the smallest selection unit bigger than just "x" is "x^2". As per discussion in Discord, changing the order to have the subscript go first after the base, would fix this issue.

Steps to Reproduce

write x_i^2 (in latex box) in mathfield, position cursor before x, press shift-right-arrow to extend selection press shift-right-arrow again (twice), trying to extend over the subscript

Actual Behavior

base and superscript are selected, but not subscript

Expected Behavior

base and subscript should be selected, but not superscript

Environment

Repros on Mathlive demo website 0.101.1, macOS Sonoma, Chrome