Error while parsing latex
magicaltoast opened this issue · 2 comments
magicaltoast commented
/ 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.
magicaltoast commented
The multiplication error can be fixed with following regex replace(/\\cdot(\S)/g, '\\cdot $1')
.
magicaltoast commented
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.