[pmwiki-users] jsMath - scalable mathematics

Ben Woodruff bmwoodruff+pmwiki at gmail.com
Tue Dec 26 16:29:31 CST 2006


The following code should get jsMath to work in PMWiki.

I'm not a PHP expert, nor do I know if what I have written is the best
way of getting jsMath into the wiki, but it works, and it is rather
short.  I believe some who have been using MimeTeX will find this
addon rather nice.

If there is interest, I will take some time to upload this as a
cookbook recipe.  If there is not interest, then it can stay in the
pmwiki-users database.

If anyone has code improvement suggestions, please help me out.

Ben Woodruff

The main code is:

//This line gives you LaTeX $$ $$ display equations in the center

Markup('{$$', '<{$',
  '/\\{\\$\$(.*?)\\$\$\\}/e',
  "Keep('<DIV CLASS=math>'.'\${1}'.'</DIV>')");


//This line gives you $ $ equations in line.  You can then use
\displaystyle as normal to get pretty print equations inline.

Markup('{$', 'directives',
  '/\\{\\$(.*?)\\$\\}/e',
  "Keep('<SPAN CLASS=math>'.'\${1}'.'</SPAN>')");


$HTMLHeaderFmt['jsMathstuff'] =
  '
<SCRIPT> jsMath = {Controls: {cookie: {scale: 120}}} </SCRIPT>
<SCRIPT SRC="http://path-to-jsMath/plugins/autoload.js"></SCRIPT>
    <SCRIPT>
      window.onload = function () {
        jsMath.Autoload.Check();
        jsMath.Process(document);
      }
    </SCRIPT>
';
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsMath.php
Type: application/octet-stream
Size: 2833 bytes
Desc: not available
Url : /pipermail/pmwiki-users/attachments/20061226/1dbd72b4/attachment.obj 


More information about the pmwiki-users mailing list