l2p - create PNG images from LaTeX expressions
l2p [options...] -i '$latex_expression$'
or
l2p [options...] [expression_file]
expression_file contains an expression or expressions in (La)TeX format - one per line. If neither expression_file nor an -i option is given, the expression is read from standard input.
Convert expressions in LaTeX format into PNGs
Produce a PNG image, named 'eqn4.png', of the equation described by the LaTeX expression '$4x^2 - 7 = \cos{2 \pi x}$'.
Produce a PNG image, called big_equation.png, from the LaTeX expression contained in the file big_hairy_equation (specifically, it contains '$x=2$'.) Note that this file is NOT a full LaTeX document - see the -F option for that.
Produce a PNG image from the LaTeX code given with the -i argument (which happens to be one of Maxwell's equations), at 250 dots per inch. Since we did not specify an output file name with the -o option, the image will be 'eqn.png' (the default).
Produce a PNG image of the Mho symbol (an upside-down capital omega), saving the image in the file 'mho.png'. We include the amssymb package, which defines that symbol.
An image with a DPI of 600 will have twice as many pixels in each of the x and y directions than an image with a DPI of 300. The effect is different in the normal context of printing, where a higher DPI will leave the text with the same physical size, but with a finer resolution. This is because the physical size of a pixel is not really variable; so to have double the resolution, a symbol in an image must be double the size.
Note: l2p currently only converts full LaTeX documents that are relatively simple: only one page in length, and with no external dependencies (such as included graphics). If you need to convert a more complex document, you can generate a DVI file with latex like normal, then convert the DVI into a series of PNG images using convert from the ImageMagick distribution. See convert(1), or http://imagemagick.org/script/convert.php for more information.
Some options, such as -b and -f, take an argument specifying a color in RGB format. l2p will decipher most representations, such as:
Error handling is imperfect. Among other things, If a needed LaTeX package is not included, l2p will silently produce a broken image.
With the -T option (transparent background), pixels at the edges of symbols may be a mixture of the text color and some background color. This may not look good if the resulting image is put on a differently colored background. A workaround is to give a background color hint with the -b option; the edge pixels will then be a mixture of specified foreground and background colors.
Aaron Maxwell (amax@redsymbol.net) Comments, feature requests, and patches are welcome.
This software is in the public domain.