<pre>The original version is from:<br><br><a class="moz-txt-link-freetext" href="http://list.cs.brown.edu/pipermail/plt-scheme/2006-November/015277.html">http://list.cs.brown.edu/pipermail/plt-scheme/2006-November/015277.html
</a><br><br>I improve the model:<br><br>all command parameters are parameterized variables<br><br>1. those generated png file are cached, when tex2im is called, it searches the cache first!<br><br>2. A pop up window can tell where is wrong when compiling latex file failed
<br><br>Sample code:<br>  (define math-fg-color &quot;MidnightBlue&quot;)<br>  (define math-bg-color &quot;white&quot;)<br>  (define code-fg-color &quot;PineGreen&quot;)<br>  (define code-bg-color &quot;white&quot;)<br>  (define question-text-color &quot;red&quot;)
<br>  (define bigger-resolution &quot;200x200&quot;)<br>  <br>  (define (math-picture file)<br>    (size-in-pixels (bitmap (parameterize ([tex2im::fgcolor math-fg-color] [tex2im::bgcolor math-bg-color]) (tex2im file )))))
<br>  (define (big-math-picture file)<br>    (size-in-pixels (bitmap (parameterize ([tex2im::fgcolor math-fg-color] [tex2im::bgcolor math-bg-color] [tex2im::res bigger-resolution]) (tex2im file )))))<br>  (define (code-picture file)
<br>     (size-in-pixels (page-para (bitmap <br>                                 (parameterize <br>                                  ([tex2im::fgcolor math-fg-color] [tex2im::bgcolor math-bg-color])<br>                                  (tex2im file ))))))
<br><br>(math-picture tex-file6)<br><br>(math-picture &quot; \\begin{eqnarray*}<br>    eval(let \\; x=4\\;in\\;(add1\\; x))&amp;=&amp;5\\\\<br>    eval(fun\\;x.(add1\\;x))&amp;=&amp;procedure\\\\<br>    eval((fun\\;x.(x\\;x))(fun\\;x.(x\\;x)))&amp;=&amp;undefined\\\\
<br>  \\end{eqnarray*}&quot;))<br><br>Any problems please let me know<br><br>Suggestions are very welcome.<br><br>thanks<br><br>YuGang<br><br></pre>