Closed Benjadahl closed 5 years ago
I think it's a great idea, and if I find the time, I will implement it. (You are of course welcome to send a PR, if you want)
In the mean time, algebra.js has a .toTex()
function that could help you, but that means that you'll have to parse it to a algebra.js object first.
new algebra.parse("2 * 3x / 43 + 3").toTex() // "\frac{6}{43}x + 3"
But algebra.js will automatically try to solve the equation, and you can't divide by variables, (nicolewhite/algebra.js#73).
@Benjadahl I have implemented this now! 😄 It is described in more details in the readme.
new AlgebraLatex().parseLatex('\\frac{1}{\\sqrt{2}}').toMath() // 1/sqrt(2)
Do you reckon it would be possible, to reverse the functions so that you could go from plain text string math, to latex? Would be greatly appreciated if possible :)