asnunes / mathml-to-latex

A JavaScript tool to convert mathml string to LaTeX equation string.
MIT License
55 stars 14 forks source link

Adding unnecessary   and commas. #31

Open devraj112 opened 1 week ago

devraj112 commented 1 week ago

Adding unnecessary &nbsb; and comma(",") while rendering big math equations.

Example 1: mathml:

<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><msub><mi>C</mi><mrow><mtext>Component&nbsp;</mtext><mi>j</mi></mrow></msub><mo>=</mo><mfenced close=")" open="(" separators=""><munderover><mstyle displaystyle="true" mathsize="140%"><mo>∑</mo></mstyle><mrow><mi>i</mi><mo>=</mo><mn>1</mn></mrow><mi>n</mi></munderover><mspace width="0.167em"></mspace><mspace width="0.167em"></mspace><msub><mi>x</mi><mi>i</mi></msub></mfenced><mo>*</mo><mi>C</mi><mi>f</mi><mo>;</mo><mtext>&nbsp;</mtext><mn>1</mn><mo>≥</mo><msub><mi>x</mi><mi>i</mi></msub><mo>≥</mo><mn>5</mn><mo>;</mo><mo>∀</mo><mi>i</mi></mrow></math>

Expectation:

big euation

codepen: bigeqn1output

Output: output

Example 2: mathml:

<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><msub><mi>A</mi><mrow><mi>i</mi><mi>j</mi></mrow></msub><mo>=</mo><mfenced close="}" open="{" separators=""><mtable columnalign="rightright" class="matrix"><mtr><mtd><mn>1</mn></mtd><mtd><mo>∀</mo><mfenced close="]" open="[" separators=""><mfenced close=")" open="(" separators=""><mi>i</mi><mo>,</mo><mi>j</mi></mfenced><mo>∣</mo><mfenced close=")" open="(" separators=""><mi>i</mi><mo>≠</mo><mi>j</mi></mfenced><mtext> </mtext><mi>a</mi><mi>n</mi><mi>d</mi><mi> </mi><mspace width="0.2em"/><mfenced close=")" open="(" separators=""><mi>i</mi><mo>,</mo><mi>j</mi></mfenced><mo>∈</mo><mi>A</mi></mfenced></mtd></mtr><mtr><mtd><mn>0</mn></mtd><mtd><mtext> </mtext><mi>o</mi><mi>t</mi><mi>h</mi><mi>e</mi><mi>r</mi><mi>w</mi><mi>i</mi><mi>s</mi><mi>e</mi><mtext> </mtext></mtd></mtr></mtable></mfenced></mrow></math>

bigEqn2

codepen: outputbigEqn2

renderedOutputeqn2

I have updated to the latest version. Version: "mathml-to-latex": "^1.4.2",

devraj112 commented 4 days ago

Any leads would be helpful. @asnunes

Thanks.