Let us assume we have an expression in LaTeX form:
var latex =\frac{x}{\frac{y}{y}}
So output required is:
output= (x)/((y)/(y));
I tried out an example as stated in the link: Convert LaTeX to dynamic Javascript function but I am getting the output of the above latex as:
(x)/(\frac{y){y}}`
How can I get the expression converted properly? Thanks in advance!
solution of the above problem
var func = '\frac{x}{\frac{y}{y}}';
func = func.replace(/}{/g, ")/(").replace(/\frac{/g, "(").replace(/}/g, ")")
console.log(func);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With