# Convert TeX fragments to PNG images

There are various embedded TeX-like formulas found on Wikipedia and other places such as:

\begin{array}{rcl} Y' &=& Y' + 16\\ U &=& U + 128\\ V &=& V + 128 \end{array}


They are not full .tex files, so pdflatex can't process them directly. Despite that the server converts them to PNG images and presents them in the browser.

How can I convert code like that into images from the command line?

-

mathTeX is usually run by your web server as a cgi program, obtaining its input expression from the query-string of an html tag. But you can also run mathTeX from your Unix shell, supplying all input on the command line. For example, ./mathtex.cgi "x^2+y^2" –o equation1 renders an image of x^2+y^2 in file equation1.gif.