The math.parse feature is very helpful in converting a math expression or a matrix into TeX.
I have one suggestion and one doubt regarding this feature.
Scenario: I want to perform some math operation and display the output in TeX.
let a = math.matrix([1,2,3,4]);
let b = math.divide(a,0);
let c = b.toString();
let d = math.parse(c);
let texOut = d.toTex();
Suggestion:
The output is "\begin{bmatrix}Infinity\\Infinity\\Infinity\\Infinity\\\end{bmatrix}". However replacing Infinity with \infty is more appropriate.
Doubt:
Also, I am not sure if I am correctly using the last step. Because: math variable b is converted to string and then math.parse is applied. Is there any command to obtain TeX directly from b instead of converting it into a string and then back into a math.js object?
PS: In the math.js example here.
- If we place
Infinity in the Expression, we get:

- If we place
Inf in the Expression, we get:

So, I think math.evaluate and math.parse part their ways here in understanding the input string.
Thank you.
The
math.parsefeature is very helpful in converting a math expression or a matrix into TeX.I have one suggestion and one doubt regarding this feature.
Scenario: I want to perform some math operation and display the output in TeX.
Suggestion:
The output is
"\begin{bmatrix}Infinity\\Infinity\\Infinity\\Infinity\\\end{bmatrix}". However replacing Infinity with\inftyis more appropriate.Doubt:
Also, I am not sure if I am correctly using the last step. Because: math variable
bis converted to string and thenmath.parseis applied. Is there any command to obtain TeX directly frombinstead of converting it into a string and then back into a math.js object?PS: In the math.js example here.
Infinityin the Expression, we get:Infin the Expression, we get:So, I think
math.evaluateandmath.parsepart their ways here in understanding the input string.Thank you.