Question

I have javascipt string in LaTeX format. For example: \frac{y^2}{2}x-\frac{2}{\sqrt{y}}+2(x-y)^2

I want to be able evaluate it with defined variables. Does anyone know framework or lib for this purpose? I've tried to find it in google and stack but without success.

If you suggest to evaluate it using replace/eval - please answer without evaluating example above. Do not waste your strength =)

Sorry, if I duplicate someone question - I will be grateful for link.

Was it helpful?

Solution

I think you'd need to get hold of a LaTeX grammar and use a tool like PEGjs or Jison to create a parser/evaluator for the subset you're planning to use.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top