Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Error while parsing latex #660

Open
magicaltoast opened this issue Mar 9, 2022 · 2 comments
Open

Error while parsing latex #660

magicaltoast opened this issue Mar 9, 2022 · 2 comments

Comments

@magicaltoast
Copy link

magicaltoast commented Mar 9, 2022

/ a\cdot3 is parsed as variable not as multiplication.

buildFunction method returns a function that looks like this

anonymous(acdot3) {
 return acdot3;
}

If you input
/ 3\cdot2 it generates something like this

anonymous(cdot2) {
 return 3*cdot2;
}

Also, I am unable to parse any kind of sum. Throws ```Cannot read property 'column' of undefined: undefined: undefined: undefined`` exception.

Example:
/ \sum_{n=1}^{10}n

@magicaltoast
Copy link
Author

The multiplication error can be fixed with following regex replace(/\\cdot(\S)/g, '\\cdot $1').

@magicaltoast
Copy link
Author

magicaltoast commented Mar 9, 2022

Also weird behavior after an assignment in another equation
Every equation is compiled to return 20

const nerdamer = require("nerdamer");

nerdamer.convertFromLaTeX("x=20");

const weird = [
  "x+20",
  "x*20",
  "x-20",
  "x^{20}",
  "\\frac{x}{2}",
]

weird.forEach(eq=>console.log(nerdamer.convertFromLaTeX(eq).buildFunction().toString()))

The trigonometric function, log works fine. clearVars fix this issue but it's still strange behavior.

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

No branches or pull requests

1 participant