Skip to content

Applying exponent to an already superscripted base produces invalid LaTeX #3099

Open

Description

@davidsusu

Steps to reproduce

  1. Type 2 in a mathfield and select it.
  2. Open the virtual keyboard and click the square button.
  3. Select only the base 2, excluding its exponent.
  4. Click the square button again.

Actual behavior

Before export, the expression visually resembles {2^2}^2.
However, getValue() returns 2^2^2, while errors is empty.
Reloading this value displays it like 2^{22}.
The exported LaTeX is invalid: TeX/KaTeX reject it with “Double superscript”.

Expected behavior

The operation should preserve a valid expression whose appearance and structure survive export/reload.

Reproduced with MathLive 0.111.0 in all major browsers using a standalone mathfield.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions