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.
Infinity in the Expression, we get:
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.
Thanks for reporting. It turns out that a SymbolNode having the value "Infinity" or "Inf" is correctly turned into tex \\infty, but a ConstantNode with the number Infinity not. Fixed via 6038d12e291bb30c3b1d9d7c91447b233e8f2968 (not yet published).
Fixed now in v6.6.5
You are very quick.
Thank you.