Mailing List Archive

Suggested mechanism for math formulas and other on-the-fly graphics
I thought I'd bring up this idea again since it might be easy to
implement with the new codebase.

If you put text such as [$\int_{x=0}^\infty x^2 dx$] in Wiki, upon
saving the article, TeX will be called and translate the formula into
an image, and store the image on the server and its name in a database
indexed with the formula text. When the Wiki page is presented, the
image is inlined (and an alt attribute containg the formula text
added). When the page is later edited and saved again, the system
first checks whether an up-to-date image of the formula already
exists; if not, TeX is called to regenerate it.

This would make mathematicians, computer scientists, physicists and
chemists happy. TeX includes a package for typesetting chemical
structure formulas and another one for quite general labeled diagrams
and trees. There's also a TeX package which allows to typeset musical
notes and another one for chess positions.

The concept could be expanded to other programs which can produce
graphics on-the-fly based on a textual description. This includes
gnuplot (graphs of functions) and maybe packages such as GD,
imagemagick or even GIMP.

Axel
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Thu, Jun 20, 2002 at 06:44:18AM +0200, Axel Boldt wrote:
> I thought I'd bring up this idea again since it might be easy to
> implement with the new codebase.
>
> If you put text such as [$\int_{x=0}^\infty x^2 dx$] in Wiki, upon
> saving the article, TeX will be called and translate the formula into
> an image, and store the image on the server and its name in a database
> indexed with the formula text. When the Wiki page is presented, the
> image is inlined (and an alt attribute containg the formula text
> added). When the page is later edited and saved again, the system
> first checks whether an up-to-date image of the formula already
> exists; if not, TeX is called to regenerate it.
>
> This would make mathematicians, computer scientists, physicists and
> chemists happy. TeX includes a package for typesetting chemical
> structure formulas and another one for quite general labeled diagrams
> and trees. There's also a TeX package which allows to typeset musical
> notes and another one for chess positions.
>
> The concept could be expanded to other programs which can produce
> graphics on-the-fly based on a textual description. This includes
> gnuplot (graphs of functions) and maybe packages such as GD,
> imagemagick or even GIMP.

Idea is good, but there should be some option to chose what size do
you want.
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
Doesn't this leave us open to potential malice? I don't know very
much about TeX, but it is my understanding that by blindly executing
TeX when someone edits a page, we are assuming that they haven't
included any malicious code in their TeX source.

Am I way off base here?

Jason

Axel Boldt wrote:

> I thought I'd bring up this idea again since it might be easy to
> implement with the new codebase.
>
> If you put text such as [$\int_{x=0}^\infty x^2 dx$] in Wiki, upon
> saving the article, TeX will be called and translate the formula into
> an image, and store the image on the server and its name in a database
> indexed with the formula text. When the Wiki page is presented, the
> image is inlined (and an alt attribute containg the formula text
> added). When the page is later edited and saved again, the system
> first checks whether an up-to-date image of the formula already
> exists; if not, TeX is called to regenerate it.
>
> This would make mathematicians, computer scientists, physicists and
> chemists happy. TeX includes a package for typesetting chemical
> structure formulas and another one for quite general labeled diagrams
> and trees. There's also a TeX package which allows to typeset musical
> notes and another one for chess positions.
>
> The concept could be expanded to other programs which can produce
> graphics on-the-fly based on a textual description. This includes
> gnuplot (graphs of functions) and maybe packages such as GD,
> imagemagick or even GIMP.
>
> Axel
> _______________________________________________
> Wikitech-l mailing list
> Wikitech-l@ross.bomis.com
> http://ross.bomis.com/mailman/listinfo/wikitech-l

--
"Jason C. Richey" <jasonr@bomis.com>
Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
> by blindly executing TeX when someone edits a page, we are assuming
> that they haven't included any malicious code in their TeX source.

TeX has two dangerous commands: shell escapes and writing to an
arbitrary file. Both can be globally disabled (and are disabled by
default in most TeX distributions). It is fairly easy however to write
TeX which eats memory like crazy (TeX allows recursion :-), so we
would have to somehow restrict the resources available to the TeX
process. But we are of course right now already wide open to all sorts
of denial-of-service attacks.

Axel
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Fri, Jun 21, 2002 at 07:07:38AM +0200, Axel Boldt wrote:
>
> > by blindly executing TeX when someone edits a page, we are assuming
> > that they haven't included any malicious code in their TeX source.
>
> TeX has two dangerous commands: shell escapes and writing to an
> arbitrary file. Both can be globally disabled (and are disabled by
> default in most TeX distributions). It is fairly easy however to write
> TeX which eats memory like crazy (TeX allows recursion :-), so we
> would have to somehow restrict the resources available to the TeX
> process. But we are of course right now already wide open to all sorts
> of denial-of-service attacks.

We don't need real TeX - we only need something that can parse limited
TeX math mode and renders that.
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Fri, Jun 21, 2002 at 07:07:38AM +0200, Axel Boldt wrote:
>
> > by blindly executing TeX when someone edits a page, we are assuming
> > that they haven't included any malicious code in their TeX source.
>
> TeX has two dangerous commands: shell escapes and writing to an
> arbitrary file. Both can be globally disabled (and are disabled by
> default in most TeX distributions). It is fairly easy however to write
> TeX which eats memory like crazy (TeX allows recursion :-), so we
> would have to somehow restrict the resources available to the TeX
> process. But we are of course right now already wide open to all sorts
> of denial-of-service attacks.

FWIW I'd like to remark that I would also like to have a LaTeX in Wikipedia.
If only to avoid that we would lose Alex to mathplanet.org. :-) But
seriously, it would make writing math in Wikipedia a lot more fun, and the
people at planetmath.org are probably more than willing to help us. In fact
I think that it is important for both Wiki's that the transfer of material
between Wikipedia and Planetmath should be as painless as possible.

-- Jan Hidders
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
Axel Boldt wrote:
>>by blindly executing TeX when someone edits a page, we are assuming
>>that they haven't included any malicious code in their TeX source.
>
>
> TeX has two dangerous commands: shell escapes and writing to an
> arbitrary file. Both can be globally disabled (and are disabled by
> default in most TeX distributions). It is fairly easy however to write
> TeX which eats memory like crazy (TeX allows recursion :-), so we
> would have to somehow restrict the resources available to the TeX
> process. But we are of course right now already wide open to all sorts
> of denial-of-service attacks.
>
> Axel


Hey guys,

would using MathML (an XML language for description of mathematic
formulas) be an option?

I am not part of the math community, but I could imagine that a good
part of the people who are either already use tools that produce MathML
or they know the syntax from the top of their hads.

There are probably also tools around that allow for automated rendering
of images from a MathML formulae.

Mozilla even provides an editor for MathML. See
http://www.newmexico.mackichan.com/MathML/mathmled.htm

Marian


--
Marian Steinbach
http://www.ds.fh-koeln.de/~marian/
ICQ# 9790691
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Sat, Jul 06, 2002 at 01:45:07AM +0200, Marian Steinbach wrote:
>
> would using MathML (an XML language for description of mathematic
> formulas) be an option?

That has been suggested before and there has been quite some debate over
that. As far as I remember most people were in the end in favour of
TeX/LaTeX because:
- it displays on a wider range of browsers
- its easier to read
- more people know it

-- Jan Hidders
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
Jan.Hidders wrote:

>On Sat, Jul 06, 2002 at 01:45:07AM +0200, Marian Steinbach wrote:
>
>
>>would using MathML (an XML language for description of mathematic
>>formulas) be an option?
>>
>>
>
>That has been suggested before and there has been quite some debate over
>that. As far as I remember most people were in the end in favour of
>TeX/LaTeX because:
>- it displays on a wider range of browsers
>- its easier to read
>- more people know it
>
>-- Jan Hidders
>_______________________________________________
>Wikitech-l mailing list
>Wikitech-l@ross.bomis.com
>http://ross.bomis.com/mailman/listinfo/wikitech-l
>
>
>
I've just had a look at the TeX to HTML convertor: the results are
horrible on my browser: mathML or rendered images from source is the way
to go, I think.

I suggest something like this:

0 Use TeX in the Wiki source (perhaps in <tex> </tex> delimiters?)
1 Convert TeX to MathML.
2 Serve MathML to modern browsers
3 Serve rendered images of MathML (eg, using the Gecko engine) to users
with old browsers.

Why not render TeX directly? Because the MathML "bottleneck" will ensure
that everyone sees the same thing,
and it also provides a way to move eventually to supporting native
MathML in the source, when MathML is a mature, editable, format in most
browsers. Even better would be if we could do a 2-way TeX <-> MathML
conversion, but that's probably asking too much.

Neil
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Sat, Jul 06, 2002 at 01:44:12AM +0100, Neil Harris wrote:
>
> Why not render TeX directly? Because the MathML "bottleneck" will ensure
> that everyone sees the same thing,
> and it also provides a way to move eventually to supporting native
> MathML in the source, when MathML is a mature, editable, format in most
> browsers.

Unless you plan to move to a MathML-only solution on the short term, say two
years or so, I don't see the point of such a dual system. It would make
things more complex than necessary. If you only render TeX then everything
also looks the same to everybody and you have the benefit of a notation that
is easier to read and write. The only drawback I see is that you need to
install TeX and that gif's don't scale when people use different font sizes
but if you look on www.planetmath.org you can see that it works even then
quite well.

Really, your enthousiasm is greatly appreciated but accesability is quite
important for Wikipedia, so even if Mozilla & IE would fully support MathML
then I doubt that it would switch to a MathML-only set up.

-- Jan Hidders
Re: Suggested mechanism for math formulas and other on-the-fly graphics [ In reply to ]
On Thu, 20 Jun 2002, Axel Boldt wrote:
> I thought I'd bring up this idea again since it might be easy to
> implement with the new codebase.
>
> If you put text such as [$\int_{x=0}^\infty x^2 dx$] in Wiki, upon
> saving the article, TeX will be called and translate the formula into

Excellent proposal. Write the implementation. Then wrap it in code that
monitors how often it gets called and how long each call takes, and
allows the entire thing to be switched off if it would become a
performance bottleneck.


--
Lars Aronsson (lars@aronsson.se)
tel +46-70-7891609
http://aronsson.se/ http://elektrosmog.nu/ http://susning.nu/