[Wikipedia-l] Parsing TeX

Toby Bartels toby+wikipedia-l at math.ucr.edu
Fri Aug 2 07:56:07 UTC 2002


Jens Frank wrote:

>I've hacked the phpwiki code to add a new namespace
>[[math: ]] so you can write formulas like [[math:a^2+b^2=c^2]] or
>[[math:\sum_{n=0}^{\infty}\frac{1}{n}=\infty]].

>The code will make TeX create an image (PNG) of the formula. Those
>images will be cached, they will be created only once and will be
>shared between articles. ( [[math:E=m c^2]] might be used on many
>pages ).

I really like this idea!  Some comments:

Be sure to include the TeX source as ALT text in images.

We only need to implement math mode, since everything else is already covered.
I'd look at LaTeX2HTML, with renders math formulas differently from the rest.
We should be able to get by with copying just what is used to make its GIFs
(except that we would render them as PNGs instead, of course).
LaTeX2HTML doesn't process TeX (or even LaTeX) in full generality,
yet it seems to be very popular for putting math papers on the web.
This suggests that we can get a fast program that handles limited markup
but which is sufficient for everything that we need to do.

It might be nice to have something to implement simple <var> tags still,
for the case of an isolated variable name floating among some text.
$$...$$ will still work for that, or any similar idea.

Some will suggest using $$...$$ for the general math formulas.
Aside from the fact that this looks funny to TeXers
(since TeX properly uses $...$ inline, which we can't do),
I think that using explicit namespace syntax is a good idea,
assuming that we really do store the gifs in such a namespace.
The syntax is just as easy to use, and it's best to let
the workings of the system be transparent when this is user friendly.
The only thing that $$...$$ has over [[math:...]] is
in the situation of a very short formula like a single letter,
and there it's better to use <var> instead of a gif *anyway*.

(Contrary to popular opinion, I've never suggested $$x \leq y$$.
What I suggested was $$x$$ &leq; $$y$$, which won't fool any TeXer
into thinking that it's actual TeX; the markup is merely *inspired* by TeX.


More information about the Wikipedia-l mailing list