Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

You can use (and I have used) mathTeX:

MathTeX, licensed under the gpl, is a cgi program that lets you easily embed LaTeX math in your own html pages, blogs, wikis, etc. It parses a LaTeX math expression and immediately emits the corresponding gif (or png) image, rather than the usual TeX dvi. So just place an html tag in your document wherever you want to see the corresponding LaTeX expression.

It can either be used as a CGI script on the server and linked directly from the <img> tag, or run on the command-line to generate standalone image files. From the homepage:

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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .