Skip to content

Backspace Does Not Fully Remove Definite Integral Symbol ∫ in MathLive Demo #2690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andrea78 opened this issue Apr 9, 2025 · 2 comments

Comments

@andrea78
Copy link
Contributor

andrea78 commented Apr 9, 2025

Description:

When using the MathLive demo page https://cortexjs.io/mathfield/demo, I encountered an issue with the backspace key when trying to delete a definite integral symbol (\int_{lower}^{upper}). After typing a definite integral (e.g., \int_{a}^{b} f(x) ,dx) and using the backspace key to remove the integral operator, the integrand function, and the lower and upper bounds, the integral symbol remains in the expression. The expected behavior is that pressing backspace again should completely remove the remaining integral symbol , but it does not.

Steps to Reproduce:

  1. Go to the MathLive demo page https://cortexjs.io/mathfield/demo.
  2. Using the keyboard, type a definite integral, such as \int_{a}^{b} f(x) ,dx.
  3. Press the backspace key repeatedly to delete the differential dx, the integrand f(x), and the bounds a and b.
  4. Continue pressing backspace after the operator and bounds are removed.

Actual Behavior:

The differential, integrand and bounds are deleted as expected.
The integral symbol remains in the expression, and further backspace presses do not remove it.

Expected Behavior:

After deleting the differential, integrand and bounds, pressing backspace again should fully remove the integral symbol , leaving the expression empty.

@jgranick
Copy link
Contributor

When you create an integral in MathLive, the cursor positions appear to be as follows:

  1. before
  2. lower bound
  3. upper bound
  4. after

Using backspace, the upper and lower bound values can be removed, leaving only the following:

  1. before
  2. after

I think what you want is a special case on delete backward which detects that the last bound is being removed, and removes it without reducing the caret index. This would delete the bound value and place the caret after the integral sign or into the lower bound value.

@andrea78
Copy link
Contributor Author

Thank you @jgranick for your response and for clarifying how the cursor behaves when deleting an integral in MathLive. I understand that the current behavior leaves the integral symbol after removing the bounds and integrand, with the cursor positioned accordingly.

Your suggestion for a special backspace case sounds like a promising solution. Ideally, after deleting the last bound (or integrand if no bounds remain), a subsequent backspace could remove the integral symbol , placing the cursor either directly before or after the integral expression (e.g., in the "before" or "after" position, depending on context). This would make the deletion process more intuitive and align with the expectation of fully removing the integral expression.

Thank you for considering this suggestion!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants