I have formula that I converted to LaTeX by Ryacas::TeXForm
. I can`t get from the result character sting that contains LaTeX code, without doing it by hand.
I tryed:
y<-"Sqrt(x^2/(z^2+1))"
Sym(y)
z<-TeXForm(y)
I got:
"$\sqrt{\frac{x ^{2}}{z ^{2} + 1} }$";
But class(z)
gives both "Sym" and "character"
Then I tried force it to something like
w<-"$\sqrt{\frac{x ^{2}}{z ^{2} + 1} }$"
such that:
class(w)
[1] "character"
Of course, I can do in just by copying and pasting, but how to do it automatically?