[plt-scheme] LaTeX formulas in Slideshow

From: Paulo Jorge de Oliveira Cantante de Matos (pocm at sat.inesc-id.pt)
Date: Wed May 11 19:36:10 EDT 2005

Hi all,

While checking the code of a gaim plugin, namely gaim-latex, I
came to know the app tex2im[1] which is really nice. So I
quickly hacked a very simple way to add formulas to slides:
(module latex-formula mzscheme

  (require (lib "utils.ss" "texpict"))

  (define temp-dir (make-parameter (find-system-path 'temp-dir)))
  (define tex2im-path (make-parameter "/usr/bin/tex2im"))
  (define default-file (make-parameter "form.png"))

  (define (latex-formula text)
    (let-values ([(tex2im-proc stdout stdin stderr)
                  (subprocess #f #f #f (tex2im-path) "-z" "-a"
"-r" "500x500" "-o" (string-append
(path->string (temp-dir)) "/" (default-file))
text)])
      (subprocess-wait tex2im-proc)
      (string-append (path->string (temp-dir)) "/"
(default-file))))

  (provide latex-formula)
  )

Test module: (working with plt-299.105)

(module latex-formula-test (lib "slideshow.ss" "slideshow")

  (require "latex-formula.scm")

  (slide/center
   (vc-append
    (t "Formula")
    (scale (bitmap (latex-formula "x^2 + \\sum_{i=0}^{n}
i^{i^i}")) 0.5)))

  )

I didn't even checked to see if there is already a (better) way
to achieve the same results in DrScheme at the moment. However
nice, the results were not the best. Although I ask tex2im to
antialias, make transparent background and set higher
resolution  I don't really like the way it shows up in the
slide. Is there a way to improve this? Is this "extension"
worth it to be worked some more?


Refs.:

[1] - http://www.nought.de/tex2im.php


Cheers,
-- 
Paulo Jorge Matos - pocm at sat inesc-id pt
Web: http://sat.inesc-id.pt/~pocm
Computer and Software Engineering
INESC-ID - SAT Group



Posted on the users mailing list.