# Math Wiki

The content of this page is outdated and should be refactored. While http://www.mathcircle.org/cgi-bin/mathwiki.pl was the first wiki that rendered TeX parts of a wiki page, this hadn't much impact, because this wiki was never opened to the public and the source was not published.

In the meantime, it showed that it is rather simple to implement TeX support. A number of wiki clones offer this as a plugin. It's little more than calling TeX to generate a DVI file, convert this to an nice image format and glue this into the wiki. Anyone should be able to do this in less than 50 LOC. You won't be able to use it on a typical webspace, because of the size of the TeX package (>60MB) and the performance you draw from the CPU to render the images. But if you own the server you have no problems.

Wiki engines supporting TeX:

My own aspirations to implement formulas in Java were in vain. Java support in browsers didn't improve (Mozilla has problems with multiple identical applets) and it showed very soon that math people just expect TeX.

Well, TeX is just the right thing to do in this space. But TeX->MathML might bit interesting....

(see MathWeb)

Do we want to start a public MathWiki?

Yes.

Definitely. Absolutely. The Universe NEEDS a MathWiki

As things stand, we'd maybe help reduce namespace pollution in this Wiki, by extracting a maths wiki and using interwiki. That in itself is not enough to justify a move. So do we just stay with what we've got?

Everything below this line should be about Mathematical Notation in a wiki.

I made a mockup of a MathWiki once. Basically, I ended up concluding that the best approach was
1. rewrite wiki so that the parser generates latex instead of html
2. when a page is edited, call pdflatex and cache the pdf file
3. when someone views a page, you give them the cached file (you don't want to be generating on every view, just every edit)

The result is a PDFWiki, and actually really pretty; pdflatex is also MUCH faster than latex2html. One reason I chose this approach is that I wanted people to be able to include large quotes from existing math papers within a discussion. If you do it this way, it's pretty easy, whereas if you try to splice latex into an existing wiki markup, well... good luck. The only trouble you have speedwise is the initial startup of reader on the client side. I would have to say that on Windows this is completely successful. On Linux, you have a few issues:

• Not everyone has their reader configured to work with Netscape properly. If you don't have it configured at all then you just get a request to download a file. If you have it configured wrong (I don't remember what wrong was, but their was a wrong way), it will open up a new reader window for every link. This is a massive pain. Now normally Linux on the client side isn't an issue. If you are using Linux, you should know how it works, and figure it out. However, in this instance this maxim doesn't hold. Your audience is mathematicians, many of whom are on university Unix systems and don't really know/care to configure it right. So it's an issue. However, it can be handled at the system admin level.

Now I suppose you would like to see it:) However, and don't laugh - this is true, I wrote over one of the files accidentally and I have never rewritten it. But it's pretty trivial to implement the above procedure, and I'm pretty sure - at least I thought for a long time - that the above is the best way to go. -- Joe Coffey

Take two dodgy programs into the shower? Expect lots of unexplained crashes. Reader on Linux is dodgy, but what's the second? Netscape.

TwikiClone has a plugin that allows LaTex markup. On edit, it's converted to GIF and cached. This avoids the browser/Acrobat reader configuration problem.

The original reason I tried the PDF version was that I wanted to allow discussion/ editing of extended selections from math papers. Latex2html is much slower than pdflatex, and not as pretty. However, for the general wiki, it's probably fine.

From Wish List: WikiEnginesWanted, WikiForumsWanted

We are looking for a MathWiki. We could use regular wiki authoring for the prose, but then we could transclude a math expression language:

!RowBox[{"(", RowBox[{"x", "+", " ", RowBox[{"\[Mu]", " ", "a"}]}], ")"}], "2"], " ", "+", " ", SuperscriptBox["y", "2"]}]

That would fetch to a math server (such as Mathematica or SciLab), and this would then pump out a GIF file that the wiki would include as an IMG tag.

There are two subsets we need to address:

• Converting math like "x / (y ^ 5)" to a typeset formula like a blackboard (with that / turned into a long horizontal ------ line).
• Plotting a math formula and rendering the manifold it covers as a pretty picture.

In actual practice, a wiki with a GIF upload system, and with good GIF tools on all the mathematicians' desktops, beats a fully collaborative online system for in-house research.

The options:
• GnuPlot - there's a CGI wrapper out there for this excellent critter's GIF output mode. Example: GnuPlotWiki.
• CernRoot? - this has a GIF output mode, so I don't think a CGI wrapper for it is such a stretch either.
• Mathematica - poor server mode; requires MathLink? and a lot of sweat before its UI will just shut up. They have recently sprung something with the promising name "webMathematica", but this WikiZen has not tried it yet.
• (La)TeX - can only do PostScript (translatable to PNG by command line tools such as NetPbm?, used by Latex2html and friends)
• Maple V - unknown
• Maxima - inscrutable
• MS Word's Equation Editor - limited powers, horrible in server mode.
• MathMl / ScalableVectorGraphics
• EQN of TroffTheProgram? fame
• EzMath
        * JOMA Wiki - http://www.joma.org
(Discussion at the MAA site. Click on The JOMA Developers' Area Wiki)
(nice math document writer that can be configured to be read/writeable)


We'd appreciate if anyone could continue that list, and possibly indicate some simple alternative we've overlooked. Thanks!

There's also the elusive and unsearchable HyTex system...

LatexWiki

If you don't care about performance and require a basic MathsWiki? that render latex formula, try either

      * TWiki  http://twiki.org/ (Twiki runs on Apache WebServer)
Plugin can be found at http://twiki.org/cgi-bin/view/Plugins/MathModePlugin
Needs also latex2html and Netpbm

* ZwiKi  http://zwiki.org/  (ZwiKi requires the ZopeApplicationServer WebServer)
Plugin can be found at http://zwiki.org/LatexWiki
Needs latex2pdf or dvips


I have managed to get the plugin to work on TWiki. Zwiki's plugin seems to have problem embeding the formula into the webpage and launches an external program to display the formula, for either acrobat or ghostview, depending whether you choose to save as pdf or ps respectively. (More testing is require for nerds)

-- WaiPang?

You could try Rebol/Command, available from: http://www.rebol.com. Your math expression language:

!RowBox[{"(", RowBox[{"x", "+", " ", RowBox[{"\[Mu]", " ", "a"}]}], ")"}], "2"], " ", "+", " ", SuperscriptBox["y", "2"]}]

could be implemented as a Rebol dialect, interpreted and a .gif written back to the caller. This could all be implemented in a CGI. If necessary, Rebol/Command could call a specialized math program to provide further processing.

-- AndrewMartin

MathML (see MathMl) was officially invented for this sort of things. But the only browser I'm aware of that handles MathML is AmayaBrowser. If standardizing on Amaya is an option, you can put its editing features to good use for the wiki.

In the mean time, I would go with TeX. Let TeX/dvips generate PostScript, then convert to GIF or PNG.

Thanks. We down-sized our requirements to letting the mathematicians render blackboard and graph art using their favorite desktop tools. Then we got the Browse button and inline graphics transclusion working on PikiPiki, so they can just upload screenshots.

But to complete the list, MozillaBrowser supports MathMl if you enable it at compile time. -- PhlIp

The MathPlayer plugin http://www.dessci.com/en/products/mathplayer/ supports MathML in Internet Explorer

But MathML seems pretty terrible (from http://www.w3.org/TR/REC-MathML/chapter2.html#sec2.2) -

produced by:
		<mrow>
<mrow>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
<mo>+</mo>
<mrow>
<mn>4</mn>
<mo>&InvisibleTimes?;</mo>
<mi>x</mi>
</mrow>
<mo>+</mo>
<mn>4</mn>
</mrow>
<mo>=</mo>
<mn>0</mn>
</mrow>

I'm thinking about implementing a MathWiki, but this needs a much simpler syntax that can be handled by the normal wiki author without HTML background. I would be grateful for any hint. -- HelmutLeitner

Have a look at EzMath -- JohnFletcher

 $x^2 + 4x + 4 = 0$

Any resemblance to an existing markup language is purely intentional.

-- StephanHouben

This is very interesting
  $$\sqrt{\pi} = \lim_{n \to \infty} {a_n^2 n^{2n} e^{-2n} n 2^{2n} \over a_{2n} 2^{2n} n^{2n} e^{-2n} \sqrt{2n} \sqrt{n}} = {A^2 \over A \sqrt{2}} = {A \over \sqrt{2}},$$


  .EQ
sqrt pi =
lim from { n -> inf } { a sub n sup 2  n sup 2n  e sup -2n  n 2 sup 2n } over
{ a sub 2n  2 sup 2n  n sup 2n  e sup -2n  sqrt 2n  sqrt n } =
A sup 2 over { A sqrt 2 } =
A over sqrt 2
.EN

if you are allergic to backslashes...

I'm thinking in a similar direction. I like your notation, esp.
• the special symbols like \sqrt \lim
• the use of curly brackets for grouping
Is this an existing syntax system or did you create this?

As StephanHouben hinted above, it's just TeX / LaTeX

Do you use it for your work? Do you like it? I suppose it would be easiest for many users if I implemented it just as it is? Is there a chance to find a TeX/Java formula viewer or parts of it? -- hl

I use it and like it, and I'd say it's especially popular in the academic and other research communities. I'm not aware of anything else that comes closer to producing professionally-formatted mathematics. But I don't know if there are any viewers that don't just run TeX and then preview the results. The algorithms behind TeX's mathematical formatting are discussed in detail in 'The TeXbook', by Donald Knuth, and of course, you can get the source code. But it gets somewhat complicated; I'd suggest reading chapters 16-19 of 'The TeXbook' just to see some of the sorts of examples people want to produce.

A wiki/Java/formula-module will never be able to produce the same typesetting quality as Knuth in his environment (where he controls every single bit) and I wouldn't try to. In the spirit of wiki, it should be enough if normal school and university mathematics is possible in medium quality. An intuitive syntax seems more important to me than complete coverage because teachers and students should be able to use it. I installed and tested a PC-Version of TeX/LateX about 10 years ago, bought a few books about it and looked at the source. I have no real experience. IIRC, it seemed so specialized and optimized to high quality and a low-ram situation that taking out a part of it, translating it to Java and refactoring would seem to be much work and little fun. But maybe I'm wrong.

My current syntax is similar in its "positional" attitude. I use special characters (like your "_", "^") for the typical positions around a symbol:
• top ~
• top-right ^
• right (default)
• bottom-right . (outside of numbers)
• bottom _
• strike through &
• (perhaps top-left )
• (perhaps bottom-left ;)

Merging the two systems could give something like this (includes final markup):
 [[Java][Code=Formula][width=400][height=60]
\sqrt_\pi = \lim_n\to\infty { a.n^2 n^2n e^-2n n 2^2n } /
{ a_2n 2^2n n^2n e^-2n \sqrt_2n \sqrt_n } =
A^2 / A\sqrt_2 =
A / \sqrt_2
]

The ProWikiEngine includes a java applet interface and I will implement such a feature as part of the wiki framework within n months. But syntax hasn't yet stabilized.

-- HelmutLeitner

Is there enough energy in this community to do so? A Math(s)Wiki could attract its own community. The question is one of resources to implement and to host it.

It's really too bad they took Eric offline - his was probably adequate for this sort of audience.

In the absence of a wiki with inbuilt Maths markup, how about using http://www.wikipedia.com/wiki/Mathematics?

Yes! Wikipedia's math section is actually getting pretty big. We need help, though, rewriting our code so that all the bells and whistles desired by mathematicians are included. We're rewriting our software and will install a CVS so that this will be possible. -- LarrySanger

Excuse me, but if the TeX syntax is deemed acceptable, why reinvent the wheel? Why not simple call TeX? After all, TeX only has to be run when the page is edited, not on every access. If plain TeX is used, the runtime is quite acceptable for a simple function such as $x^2+x+4$ - less than 0.1s on my Pentium III 700 MHz.

-- StephanHouben

Integration means to me:
• write the formulas anywhere you like in any number (typically 10-100 per page)
• formulas are rendered as normal parts of the HTML/wiki page
I don't see how to integrate TeX into a wiki.

-- HelmutLeitner

Well, you probably would make some special syntax to write the formula. Then, the WikiEngine would call TeX and generate the output in some nice picture format, which would be included with a graphic. You would probably need numbers, but they would be generated by the WikiEngine, not with TeX. TeX would only be used to typeset the formula. I think that would be one possibility, and I don't see problems which I can't solve now (which is as always, I only see them when I start a project).

-- ThomasHolenstein?

I don't know TeX (well, I played a little with it years ago). So the question is: can TeX be called to produce a rendered formula alone without the surrounding page? -- hl

I believe this is how latex2html does it; so in that case, yes :). Actually, I have recently been thinking about writing a latex->HTML+MathML (preferably by leveraging the latex2html system). Since MathML is now quite well supported in at least a couple of browsers. Do you think there would be much interest?

I don't know TeX (well, I played a little with it years ago). So the question is: can TeX be called to produce a rendered formula alone without the surrounding page? -- hl

I think MetaPost needs to do this.

I have experimented with running TeX to render formulas, written in the TeX notation in the body of a wiki page, into gifs: http://www.mathcircle.org/cgi-bin/mathwiki.pl. I'd be happy to discuss this or other simple approaches while we are all waiting for MathML to mature and/or proper tools to become accessible. -- Sergey

Sergey, that it is a very nicely done development. I particularly like the ability to set the size of formula to use. Is this going to become open to public editing or will it stay as a members-only editable wiki? (I notice even the sandbox needs a log in.) -- JamesCrook

Sergey, my respect and admiration for your implementation of MathWiki. I think this is a milestone for wikis with application-specific content. -- HelmutLeitner

One might also use tth http://hutchinson.belmont.ma.us/tth/ to do TeX to HTML conversion on the fly, it does a pretty good job using the symbol font. He also has written a TeX to MathML translator (ttm). This seems to do away with the problem of images not having the right fontsize or not aligning themselves correctly.

Some of you guys should look at PlanetMath - http://planetmath.org. It's more formal than a wiki, but their wiki-style LaTex -> HTML seems quite advanced.

PlanetMath [http://PlanetMath.org/] is like a wiki that lets me use LaTex markup. Can I write raw EPS as well? By the zeroth law of engineering ("If it happens, it must be possible") all the above arguments about how it's impossible to merge wiki with LaTex are all wrong. Should I just delete them?

This page could certainly do with some updating and refactoring, for example moving the discussion of notating mathematics to its own page.

I'd hate to lose a bunch of ironclad arguments demonstrating that wiki can't be merged with LaTeX (especially since I just did it with the Green Light Wiki at http://sbml.org/wiki/SandBox). Such arguments could be very instructive. -- BenKovitz

You could have a look to UniWakka. Math can be inserted as Latex,ASCIIMathML and MathML.

LatexWiki http://mcelrath.org/Notes/LatexWiki is maintained by BobMcelrath?, a UC Davis particle physicist. Available under GPL, it runs on Zwiki, the OpenSource Python wiki within the Zope framework.
See MathematicalNotation

CategoryMath

$E_c / N_0$

Like for example 1+1=2. Got me???

View edit of January 4, 2008 or FindPage with title or text search