title: Generate LaTeX from Maxima input
body: <p>I want to use Maxima to evaluate documents. It's easy to convert Maxima output into TeX:</p>
  
  <pre><code>(%i1) tex(5*x^2+sin(x)+c)$
  $$\sin x+5\,x^2+c$$
  </code></pre>
  
  <p>However, it doesn't work for previously input lines:</p>
  
  <pre><code>(%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)
  </code></pre>
  
  <p>After much research (including <a href="http://www.ma.utexas.edu/pipermail/maxima/2008/012549.html" rel="noreferrer">here</a> which is close but no cigar) I've come up empty. Any insights?</p>