Installing mathtex.cgi

In order to make and install mathtex.cgi, latex and dvipng are prerequisite. You need to install latex first and divpng will come along with it.

You can follow the instruction

  1. http://www.forkosh.dreamhost.com/source_mathtex.html#install

Following will show how I have done with it for example.

# wget http://www.forkosh.com/mathtex.zip
# mkdir mathtex
# cd mathtex
# unzip ../mathtex.zip
# cc mathtex.c –DLATEX=\\"$(which latex)\\" \\
–DDVIPNG=\\"$(which dvipng)\\" –o mathtex.cgi
# cp mathtex.cgi /public_html/xxx.../cgi-bin/

For test of mathtex.cgi, in your web browser, you can do it by

www.example.com/cgi-bin/mathtex.cgi?x^2+y^2

It will give you the gif image showing equation by latex syntax.

Installing Latex

The latex can be installed by following instruction:

Followings are showing how I installed for example.

# wget http://carroll.aset.psu.edu/pub/CTAN/systems/texlive/tlnet/install-tl-unx.tar.gz
# tar -xvzf install-tl-unx.tar.gz
# cd install-tl-20091126
# ./install-tl

While running “install-tl”, I used ‘D’ option to change the directory to be installed, and ‘O’ to select ‘use letter size instead of A4 by default’ option.

It took around 1 hour to be installed. I have installed it in “~/texlive/” and latex and divpng are installed in “~/texlive/bin/x86_64-linux”

If you want to test the latex, please do

# latex small2e

It will give small2e.dvi in your directory. Using dvipng tool, you can make it gif or png image file.