- Copy the ASCIIMathML.js into your TikiWiki installation directory under /path/to/tiki/lib to make it available for TikiWiki
- Now open up the header template in your favourite text editor. The header template is under /path/to/tiki/templates/header.tpl
- Edit the header file and add the following line:
header.tpl Copy to clipboard {* --- tikiwiki block --- *}
{include file="bidi.tpl"}
The line which adds the javascript lib/ASCIIMathML.js right under the one for the tiki-js.js is the one you want to add. And than your are done and you can write latex right into your tiki 😛
Now you can go and try it out, edit any wiki entry and write a latex formula in between $ $ like inline latex style. Here is an example
latex example Copy to clipboard $\int_0^{\pi/2} \sin x\,dx=1$
$\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho v) = 0$
I checked for the above security issue and this is not a problem with this implementation, since the javascript directly converts the latex to MathML. Also this should work on all major platforms: *nix, Linux, MacOS and Windows.
Have fun with this and please give feedback.
Feedback
xavi: Impressive! Thanks! Comments/concerns:
- I'm concerned about the 150 kb default size of that additional js that will be loaded locally by each new visitor to the site. Isn't it too much footprint?
- your link points to the version 1.4.7, which is GPL'd. However, I've just seen that there s a newer version (2.0.2 by the time of this writing), which moreover, it's LGPL'd, which makes it compatible with Tiki. Interesting....
Issues
- xavi: using version 1.4.7 I get many popups from firefox (3.0.x under GNU/Linux, in case it matters) reporting that there is a slow script underway in the page, showing also this line:
Copy to clipboard Script: http://localhost/tiki3svn/lib/ASCIIMathML.js:1486
After some time, the ascii from the example above gets converted into nice equations:
however, the popup requesting to stop the slow js seems to show up forever (I stopped the js after 5 times I saw the popup, a couple of minutes in total or so after the equations were parsed on the page.
- xavi: using version 2.0.2, I get the popup messages saying no responding script at several lines: 472 (several times), 276, 1565, 1452, 1474, .... Moreover, the code inside the Plugin CODE tags gets parsed also:
|