osanshouo / latex2mathml

Convert LaTeX to MathML in Rust
MIT License
51 stars 7 forks source link

Using superscript and subscript simultaneously #10

Open emmyoh opened 1 year ago

emmyoh commented 1 year ago

To replicate, try either:

  1. \alpha_{2}^{4}
  2. \alpha^{4}_{2}

You will observe that they don't render as they should. The subscripts and superscripts should both apply directly to \alpha, not to each other; the two expressions should render identically.

emmyoh commented 1 year ago

The resulting MathML should use the msubsup element.

ssokolow commented 4 months ago

According to the source, it's currently hard-coded to only consider using Node::SubSup in the context of Token::Integral, which is why these are the only two tests using <msubsup>.

(r"\int_0^1 dx",  r#"<msubsup><mo>∫</mo><mn>0</mn><mn>1</mn></msubsup><mi>d</mi><mi>x</mi>"#),
(r"\int^1_0 dx",  r#"<msubsup><mo>∫</mo><mn>0</mn><mn>1</mn></msubsup><mi>d</mi><mi>x</mi>"#),