You can use the 'tex' command
(1) -> (1+w)^2
2
(1) w + 2 w + 1
Type: Polynomial(Integer)
(2) -> tex(%)
(2) ["{{w} \sp {2}}+{2 \ w}+1"]
Type: List(String)
OTOH I see no problem to parse the multiline output betwenn $$..$$.
There's another method to catch the whole tex string via lisp, though I would
not recommend that for everyday use ;)
On 27.01.2018 13:36, 'Nasser M. Abbasi' via FriCAS - computer algebra system
wrote:
> I can generate Latex output of a single result in Fricas. I can also write it
> to
> a file.
>
> But what I really need to write the Latex output as one long string to the
> file.
>
> This is what I do in Maple and Mathematica for example. But I do not
> know how to do it in Fricas.
>
> For example:
>
> (25) -> )set output algebra off
> (25) -> )set output tex on
> (25) -> ii:= integrate(sin(x),x)
>
> $$
> -{\cos
> \left(
> {x}
> \right)}
> \leqno(25)
> $$
>
> If I write the above to a file, by writing )set output tex fileName before,
> then the file will just contain the above, on multiple lines as is.
> It is not even string quoted.
>
> What I want is to have in the file the following.
>
> "$$-{\cos \left({x} \right)}\leqno(25)$$"
>
> So I can read this later from another program as string. This is how I do
> this
> in Maple:
>
> ii:=int(sin(x),x);
> ii := -cos(x)
>
> latex(ii);
> -\cos \left( x \right)
>
> r:=latex(ii,output=string);
> "-\cos \left( x \right) "
>
> It has the useful option of "output=string". Now I write this latex as
> string to a file using
>
> fprintf(file_handle, "\"%s\"",r)
>
> As quoted string.
>
> Is it possible to do something like this in Fricas? If not, I can always
> write separate function later to try to read the Latex as it is written and
> convert it to long string.
>
> Thanks
> --Nasser
>
> --
> You received this message because you are subscribed to the Google Groups
> "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email
> to [email protected]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at https://groups.google.com/group/fricas-devel.
> For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.