[Pmwiki-users] OpenMathTag integration

Patrick R. Michaud pmichaud at pobox.com
Wed Jun 4 10:58:18 CDT 2003


On Wed, Jun 04, 2003 at 10:10:30AM -0400, Kirill Lapshin wrote:
> 
> I need your advice on plugging in LaTeX formula parsing. Suppose I want to
> support following syntax:
> \[ formula goes here \]
> It is a common LaTeX notation and it should not conflict with Wiki markup.
> 
> Now the problem is that I can't really use InlineReplacements or
> DoubleBrackets, because I have to call some special function which will
> parse formula and spit out MathML markup. 

Oh, you can use InlineReplacement and DoubleBrackets to call functions--
no problem.  Assuming that OpenMathTag returns a MathML string (as opposed
to outputing the MathML markup directly), you can do:

    $InlineReplacements["/\\\\\\[(.*?)\\\\\\]/e"] =
      "OpenMathTag(stripslashes('$1'))";

If OpenMathTag doesn't return a string, then you can call your own 
function that captures the output of OpenMathTag into a buffer and
returns it as a string.

> Also tricky part is that formulas might me quite long, so they gonna be
> multiline. 

This is indeed a tricky part.  One of the things I've been thinking of
adding is a mechanism similar to $DoubleBrackets/$InlineReplacements
that allows some markup to be processed before PmWiki does any conversion
or line splitting.  This would certainly work for OpenMathTag, and also
give sites the ability to allow HTML/XML tags.  It would probably
work just like what I wrote above, except use an array other than
InlineReplacements.

Pm




More information about the pmwiki-users mailing list