# WebTeX

## Introduction

NOTE: webtex used to be called webmath; however, I changed the name because now it does more than 'just' maths. In fact, it can do just about anything that TeX/LaTeX can. For example, while sitting in this sweaty little room in a Bangkok guesthouse, I implemented support for the beautiful Thai script.

WebTeX is a program to bring the beauty of TeX/LaTeX-rendered formulae and text to the web. It's not the first program which attempts to do so. There are many others (latex2html, tth, latexwiki, gladtex, ...) and they have influenced the design of webtex.

However, webtex offers a feature set (IMHO) not met by any of the others:

• HTML: webtex uses standard-compliant HTML, and does not change the HTML in any way; no special tags and preprocessing needed;
• images: the formulae are rendered as PNG-images from the TeX/LaTeX. IMHO, this is the esthetically most pleasing way to show them;
• syntax: for the writing of the formulae, you can use the standard TeX/LaTex syntax (the stuff between ), no illegable über-verbose MathML (which is not widely supported in browsers anyway).

Webtex was written by Dirk-Jan C. Binnema aka djcb. You can e-mail me. You can read my Advogato-blog. Or you can read my ChangeLog (in Dutch).

I am actively working on webtex, and the current versions are admittedly spartan. But fear not, I have some great ideas (and a little bit of free time...). However, webtex is useful right now! But please mail me if you have any difficulties.

## How does it work

### webtex-math

Now... how does it work. It's really simple. Really. In your webpage you put an img-element like this:
  <img src="abc.png" class="webtex-math" name="x_1,x_2={\frac {-b\pm{\sqrt{b^2-4ac}}}{2a}}">

So... you include an img-element of class 'webtex-math', and you put the TeX/LaTeX formula in the name-attribute. Then, process your page with webtex:
% webtex index.html

which will process the formula with TeX/LaTex and put the result in abc.png. (Therefore, the src should refer to a local filesystem location). Really easy, and your index.html is not changed in any way...

Now, this is the result:

### webtex-thai

I have also implemented support for the Thai language. This requires you to have the thai-latex package, as well as a Thai word-separator (such as swath).

  <img src="abc.png" class="webtex-thai" name="¡Ë´ÒäÓÊÒ¾äË¡´ÊÒ»Â¨¨µ¢">


Now, this is the result:

## Editor support

If that's still too much typing, I have also written an emacs-minor-mode, which makes it even easier. If you write something similar for your favourite editor, please let me know...

Optimization note: webtex stores the formula in a comment field in the resulting PNG-file and uses this to determine whether an image needs updating.

## What do you need

webtex requires you to have a number of programs to be able to run...
• A Unix/Linux system; well, Windows might work as well, if you have the required tools. I have only tested this on Debian GNU/Linux though;
• TeX/LaTeX/dvips (no - tetex is not included in the tarball ;-)
• ImageMagick;
• perl.

### installation

Well, the installation is a bit sub-optimal right now. Unpack the tarball and copy LaTeXImage.pm to somewhere in your Perl include path (@INC). You can check your include path with:
% perl -e "print \"@INC\\n\";"

You might want to check the locations of various execubles in LaTeXImage.pm as well, and change them if needed. They should be OK though. Now webtex should be ready for use!