<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 "MidnightBlue")<br> (define math-bg-color "white")<br> (define code-fg-color "PineGreen")<br> (define code-bg-color "white")<br> (define question-text-color "red")
<br> (define bigger-resolution "200x200")<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 " \\begin{eqnarray*}<br> eval(let \\; x=4\\;in\\;(add1\\; x))&=&5\\\\<br> eval(fun\\;x.(add1\\;x))&=&procedure\\\\<br> eval((fun\\;x.(x\\;x))(fun\\;x.(x\\;x)))&=&undefined\\\\
<br> \\end{eqnarray*}"))<br><br>Any problems please let me know<br><br>Suggestions are very welcome.<br><br>thanks<br><br>YuGang<br><br></pre>