Converting LaTeX expression to infix expression -


let assume have expression in latex form:

var latex =\frac{x}{\frac{y}{y}} 

so output required is:

output= (x)/((y)/(y)); 

i tried out example stated in link: convert latex dynamic javascript function getting output of above latex as:

(x)/(\frac{y){y}}` 

how can expression converted properly? in advance!

solution of above problem

var func = '\frac{x}{\frac{y}{y}}'; func = func.replace(/}{/g, ")/(").replace(/\frac{/g, "(").replace(/}/g, ")") console.log(func); 
  1. innput = \frac{x}{\frac{y}{y}}
  2. output = (x)/((y)/(y))

Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

Nuget pack csproj using nuspec -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -