cortex-js / compute-engine

An engine for symbolic manipulation and numeric evaluation of math formulas expressed with MathJSON
https://cortexjs.io
MIT License
356 stars 42 forks source link

MathJSON from Integral with `\limits` #153

Open kungfooman opened 5 months ago

kungfooman commented 5 months ago

Example TeX producing wrong output:

\int\limits_{-1}^{1}{\frac{1}{\sqrt{1-x^2}}\,{\mathrm{d}}x

Wrong output:

[
  "Sequence",
  ["Integrate", "Nothing", "Nothing"],
  [
    "Error",
    ["ErrorCode", "'unexpected-command'", "'\\limits'"],
    ["LatexString", "'\\limits'"]
  ]
]

This integral, which is basically the same without using \limits_ works however:

\int_{-1}^{1}\!{\frac{1}{\sqrt{1-x^2}}\,\mathrm{d}x

Output:

[
  "Integrate",
  ["Divide", 1, ["Sqrt", ["Subtract", 1, ["Square", "x"]]]],
  ["Triple", "x", -1, 1]
]