[l2h] Converting math statements only into images...

Steve Mayer mayer at dial.pipex.com
Fri Dec 30 12:21:17 CET 2005


----- Original Message ----- 
From: "Ken Keefe" <kjkeefe at gmail.com>
To: <latex2html at tug.org>
Sent: Friday, December 30, 2005 6:15 AM
Subject: [l2h] Converting math statements only into images...


[snip]
> I'd like my students to write their equation in a basic latex file,
> like:
>
>  \documentclass{article}
>  \begin{document}
>  \[
>  test(\frac{2}{3})
>  \]
>  \end{document}
>
> and then have a simple script that does something like the following:
>
> $ latex2png test.tex
>
[snip]

A couple of possible approaches using ImageMagick:

1. A simple bash script:

/usr/bin/latex --interaction=batchmode temp.tex
/usr/bin/dvips -E temp.dvi -o temp.ps
/usr/bin/convert -density 120  -trim -transparent "#FFFFFF" temp.ps image.png

applied to temp.tex:

\documentclass[10pt]{article}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\pagestyle{empty}
\begin{document}
$formula goes here$
\end{document}

and the result is image.png containing whatever formula is put in temp.tex

2. Use a PHP page on the net where the students input the code and the image is then produced for copying. See
http://www.artofproblemsolving.com/LaTeX/AoPS_L_TeXer.php for an example and the demo folder of the LatexRender download
at http://www.mayer.dial.pipex.com/tex.htm for the code.

Steve Mayer



More information about the latex2html mailing list