Generate LaTeX from Maxima input

latex, maxima

Solution

Try this.

tex (''%i2);

or

apply (tex, [%i2]);

Problem

I want to use Maxima to evaluate documents. It's easy to convert Maxima output into TeX: ``` (%i1) tex(5*x^2+sin(x)+c)$ $$\sin x+5\,x^2+c$$ ``` However, it doesn't work for previously input lines: ``` (%i2) 5*x^2+sin(x)+c; 2 (%o2) sin(x) + 5 x + c (%i3) tex(%i2); \begin{verbatim} (%i2)sin(x)+5*x^2+c; \end{verbatim} (%o3) (%i2) ``` After much research (including here which is close but no cigar) I've come up empty. Any insights?

Original source