doc.txt

# MrTex2IM : A port to DrScheme of the tex2im utility

MrTex2IM : A port to DrScheme of the tex2im utility
========

Author:
Paulo J. Matos <pocm@soton.ac.uk>
http://www.personal.soton.ac.uk/pocm

Usage: (require (planet "mrtex2im.ss" ("pjmatos" "mrtex2im.plt" 1 2)))
------

This package provides the following:

> (tex2im str-or-path #:resolution             "150x150"
#:bgcolor                "white"
#:fgcolor                "black"
#:transparency           #f
#:noformula              #f
#:anti-aliasing          #t
#:debug-latex-on?        #f
)

tex2im is a function of one argument (a string of a path) and with 8
keyword arguments. If str-or-path is a string it should contain latex
code to render the mathematics. On the other hand if it is a path, it
should point to a file containing latex code to render.
The function returns a bitmap% object.

- #:resolution is a string of the form "<n>x<m>" where <n> and
<m> are integers specifying the resolution of the final bitmap
(default is "150x150").
- #:bgcolor is a string which determines the background color you want
for your final bitmap (default is "white").
- #:fgcolor is a string which determines the foreground color you want
for your final bitmap (default is "black").
- #:transparency is a boolean which determines is the background
should be transparent [not really sure if DrScheme supports bitmap%s
with transparent backgrounds] (default is #f).
- #:noformula is a boolean which determines if the code should be
rendered into a mathematical formula or not (default if #f).
- #:anti-aliasing is a boolean which determines is the rendered code
should be anti-aliased (default is #t).
- #:extra-header is a string with a path to a file containing extra
- #:debug-latex-on? is a boolean which determines if, upon latex
failure, the latex log should be displayed. Useful for debugging since
sometimes simple problems with latex code turn the result completely
useless and you end up not knowing where the problem is. (default is #f).

Usage Examples: (What I use it for)
---------------

You might imagine other uses for this but I use it mainly for
displaying equation in slideshows:

(module hello-world (lib "slideshow.ss" "slideshow")

(require (planet "mrtex2im.ss" ("pjmatos" "mrtex2im.plt" 1 0)))

(slide/title
"How to Say Hello in Mathematics"
(bitmap (tex2im #<<$\int_0^\lambda \frac{x^2}{\lambda-2} \textrm{d}x$
))))

Note the use of here strings. If you don't use them you end up having
to escape all '\' characters and as you know, there might be a lot of
them in LaTeX code.

Another use is just to display fancy output (and this is something
I'm using for another project and is quite handy) in the interactions
of DrScheme.
Try this:

(require (lib "utils.ss" "texpict"))
(bitmap (tex2im #<<$\int_0^\lambda \frac{x^2}{\lambda-2} \textrm{d}x$
))

You'll see DrScheme render it in the interactions window. It's really
nice output and a lot of nifty pretty printing of whatever might be
achieved using this technique. :-)

Have fun! If you find another use for this please let me know, as well
as, of course, BUGS!

--
Paulo J. Matos <pocm@soton.ac.uk>