[plt-scheme] An improvement on tex2im

From: 喻钢 (wuhanyugang at gmail.com)
Date: Tue Nov 28 08:50:13 EST 2006

The original version is from:

http://list.cs.brown.edu/pipermail/plt-scheme/2006-November/015277.html

I improve the model:

all command parameters are parameterized variables

1. those generated png file are cached, when tex2im is called, it
searches the cache first!

2. A pop up window can tell where is wrong when compiling latex file failed

Sample code:
  (define math-fg-color "MidnightBlue")
  (define math-bg-color "white")
  (define code-fg-color "PineGreen")
  (define code-bg-color "white")
  (define question-text-color "red")
  (define bigger-resolution "200x200")

  (define (math-picture file)
    (size-in-pixels (bitmap (parameterize ([tex2im::fgcolor
math-fg-color] [tex2im::bgcolor math-bg-color]) (tex2im file )))))
  (define (big-math-picture file)
    (size-in-pixels (bitmap (parameterize ([tex2im::fgcolor
math-fg-color] [tex2im::bgcolor math-bg-color] [tex2im::res
bigger-resolution]) (tex2im file )))))
  (define (code-picture file)
     (size-in-pixels (page-para (bitmap
                                 (parameterize
                                  ([tex2im::fgcolor math-fg-color]
[tex2im::bgcolor math-bg-color])
                                  (tex2im file ))))))

(math-picture tex-file6)

(math-picture " \\begin{eqnarray*}
    eval(let \\; x=4\\;in\\;(add1\\; x))&=&5\\\\
    eval(fun\\;x.(add1\\;x))&=&procedure\\\\
    eval((fun\\;x.(x\\;x))(fun\\;x.(x\\;x)))&=&undefined\\\\
  \\end{eqnarray*}"))

Any problems please let me know

Suggestions are very welcome.

thanks

YuGang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20061128/c02072c2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tex2im.scm
Type: text/x-scheme
Size: 12262 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20061128/c02072c2/attachment.bin>

Posted on the users mailing list.