2011-06-17

By Xyne

tex2png

Meta

AUR:37294
Arch Forum Thread:97433
Binary Package:xyne-any/tex2png-2010.05.21.1-1-any.pkg.tar.xz
PKGBUILD:pkgbuilds/tex2png
Repos:[xyne-any]
Source Package:tex2png-2010.05.21.1.tar.gz
Taurball:tex2png.tar.gz
Version:2010.05.21.1

About

tex2png easily converts image generated by tex2png and image generated by tex2png to PNG images. It is a simple wrapper around "latex" and "divpng" that was originally written for the backend of this website to enable easy insertion of mathematical formulae. Using the options "-i" (inline) and "-T" (tight), images can be generated automatically and inserted into web pages using scripts to generate the correct HTML/CSS from the reported image depth and height.

When using the "-T" option, single-page images of arbitrary size can be created.

Examples

The equation image generated by tex2png, which was taken from Wikipedia's Math Markup page, was generated from

$\phi_n(\kappa) =
 \frac{1}{4\pi^2\kappa^2} \int_0^\infty
 \frac{\sin(\kappa R)}{\kappa R}
 \frac{\partial}{\partial R}
 \left[R^2\frac{\partial D_n(R)}{\partial R}\right]\,dR$

with tex2png and inserted automatically into this page using a script. As you can see, the image is vertically aligned to its context. Simpler examples include image generated by tex2png and image generated by tex2png.

Help Message

ABOUT
  tex2png - convert (La)TeX to PNG images

USAGE
  tex2png [options]

  A (La)Tex string can be passed either as a command-line parameter or via
  STDIN. When manually entered via STDIN, use ctrl+d to terminate input.

OPTIONS
  -c <string>
    The (La)TeX string.

  -d <path>
    The output directory. See below.

  -f
    Specify the full input document. By default, tex2png provides its own
    headers and wraps the input in document tags. This option enables the user
    to provide a full (La)TeX document with custom headers.

  -i
    Inline mode. This will include the height and depth in the output, which can
    be used for vertical alignment in web pages, e.g.

  -h
    Display this help message.

  -o <path>
    The image path. See below.

  -p <int>
    Page number to render. Default is 1.

  -s <int>
    The font size argument passed to "dvipng". Default is 1400.

  -t <path>
    The temporary working directory. A random directory is created with "mktemp"
    by default.

  -T
    Crop whitespace around the content (dvipng -T tight).


OUTPUT
  If the image path is set then it is the full path to the image. If it is not
  set then the image name will be the sha256 digest of the (La)Tex input string
  with the ".png" extension. If the output directory has been set then the image
  will be saved there, otherwise it will be saved in the current directory.