Features / Usability

Features / Usability

Math Equations / Formulae in TikiWiki?

posts: 10

On the basis of WikiMatrix I selected Tikiwiki for the website I am trying to build for my students. I teach physics and philosophy, and for the former I really NEED to have editable equations in the wiki pages. The promise was that there was a plugin that would allow the use of LaTeX math markup to produce equations in TikiWiki pages.

Now it appears I made a mistake and this plugin has been pulled a couple of years ago for security issues that were never patched? Am I wrong and just not finding the plug in (or ANY plugin that will allow decently readable formulas)... or is this irreparable? Is it possible with PhpWiki (the other wiki supported by the host I chose because they had TikiWiki)? Or in some other way?

We don't need a lot... superscripts and subscripts, roots, quotients. But we do need such to make the wiki work for the classes. Any advice / help / suggestions / sympathy would be greatly appreciated! I'm rather a neophyte with all this, so very simple and obvious advice is probably just as necessary as more sophisticated :-)

Philip Freeman

posts: 1817 Catalan Countries

Hi Philip, and welcome to Tikiwiki community! :-)

Have you tried already using the Plugin Formula?:

I haven't tried myself, but it's listed in the Mods repository. As far as I know, there is not any more documentation about this plugin, but there is plenty about Mods install, plugin usage in general, etc.
See Documentation for the whole documentation reference.

And report back if it worked for you!



posts: 10

> Hi Philip, and welcome to Tikiwiki community! :-)
> Have you tried already using the Plugin Formula?:
> http://mods.tikiwiki.org/details.php?type=wikiplugins&mod=formula
> I haven't tried myself, but it's listed in the Mods repository.

I really appreciate the help, but unhappily I will probably not be able to use the Formula plug in. First, my host does not have Latex loaded and is reluctant to do so. Second, probably related, the plugin has a known security problem which has apparently never been resolved.

Is it possible that there are other alternatives that I'm missing? Surely some people out there are running technical Wikis?

Any other suggestions would be tremendously appreciated!


posts: 10

An update and a plea for help!

I think I have a solution, but I won't know until I try it and I need some advice before proceeding. My possible solution is an mathml support package called ASCIIMath

To implement it, however, I need to insert some java scripts in each output page from my wiki. It looks like I should be able to do that by modifying the header.tpl files, for example duplicating the like that includes the tiki-js.js script and modifying appropriately. I am reluctant to do that without having some clue what I may mess up though, or if there is a more appropriate way to do this. So I need to know:

  1. What is the correct place to mess with things in order to insert a script at the beginning of each page.
  2. Is output in html or xhtml? The files used seem to be slightly different depending (in the case of xml there are two scripts to include instead of one, I am not sure why)

Forgive my ignorance... I did search the documentation but am perhaps too clueless to narrow down things to the point that I can answer these questions on my own. I will post any success so that others can try this (at least until something better comes along). Searching found several queries a bit like mine, but no solutions.

Many thanks... (I hope someone is still looking at this thread!)

> > Hi Philip, and welcome to Tikiwiki community! :-)
> >
> > Have you tried already using the Plugin Formula?:
> > http://mods.tikiwiki.org/details.php?type=wikiplugins&mod=formula

> I really appreciate the help, but unhappily I will probably not be able to use the Formula plug in. First, my host does not have Latex loaded and is reluctant to do so. ...

posts: 10

I have a working, if kludgy, solution for use of formulae in my TikiWiki.

For benefit of any other or future users doing the same searches on the forums and documentation that I did I thought I'd pass on my inelegant but apparently functional solution.

I needed a way for my students (and myself) to work with mathematical formulas on the Wiki, but could not use the FORMULA plugin (or variations on it that are out there) because those require the host to have LaTeX installed, and mine does not.

I found a way to do this using MathML.
In future this may be the definative way to do it as MathML may (and should) be part of the standard Wiki support, but at the moment I had to mess about a bit. The key was a lovely script called ASCIIMath, available and described at http://www1.chapman.edu/~jipsen/mathml/asciimath.xml

This is probably not the right way to do this, but this is what I did and it does work.

The script is provided in a file called "ASCIIMathML.js" which I uploaded to the "lib" directory in my directory. This script must be called on each page that uses math, so I put it into a tpl that is called for every page, the "header.tpl" file. This calls a number of scripts, so I simply added this to the set.
I looked for "tiki-js.js" which is used on all pages. Then added a call after it, replacing the tiki-js file with the ASCIIMathML.js one. I'd include code but it seems to be crashing the forum post. I also included a second line to set the equation colour to black as described in the ASCIIMath FAQ.

Now the ASCIIMath syntax can be used on any page by enclosing text in appropriate bracketing (the accent grave). It works well, though the font size is a bit small for the equations (I added a "big" quicktag, though I'm sure if I knew what I was doing there would be a way to ask for the font size to be made one or two points larger).

Anyway... I hope this is of some use to others, and maybe that those who actually know what they are doing will leap in and correct the Quick and Dirty solution here.

All the best to all in the community.

posts: 1

Thank you a thousand times. I had the same problem - wanting to use TikiWiki as a site for teaching physics and needed to use mathML or similar. I was just about to dump TikiWiki for Moodle but not I have followed your advice and am working happily.


As for changing the size of the font (or the colour for that matter) it appears that this can be done quite easily by editing the ASCIImathML.js file directly - the instructions are even included as comments in this file.


posts: 2

Hi Philip,
This solution works great. But when I have two superscript (^) symbols in my equations, TikiWiki puts it in a box. How did you get around that?


posts: 2
Did you ever figure out the ^ problem? I'm running into the same thing, even tho the code works correctly on the ASCIIMAthML demo webpage.

posts: 1


I too am interested in this feature and followed your directions. Unfortunately, I can't get the js file to work when I put it in the header.tpl file. I can get it to work if I call it on a specific page using the js plugin but not in the header file. Could you please post exactly what you put in that file and exactly where you put it? Tiki seems to suggest that it will sanitize any javascript put into that file but it seemed to work for you. I used ftp to d/l the file, change it, and reupload it. Any suggestions?

Thanks in advance!

posts: 5

Hi there

I've been reading this post regarding the math formula solution using ASCIIMathML.
I tried the steps which are describedt but I can't get it working..

- I've placed the ASCIIMathML.js file under tikiwiki/lib/
- I've edited the header.tpl by adding the following line:

- And then type in a wiki page something like `a = b^2`

Am I missing something?

Thanking you in advance


posts: 5

Hi Marc

thanks for adding this.
Have you tried this method yourself?
Looks really easy to configure and use.
But for some reason it doesn't seem to work for me..

Any ideas?


posts: 1633 Canada
jdeme wrote:
Have you tried this method yourself?

Hi Joanna!

I haven't yet come across the need for Math, but I do think it's useful and important. I was just putting a link to the wiki page so we start more & more converging on recipes/documentation in wiki pages instead of forum posts.

It's likely I'll soon be starting on a rather large e-learning community. I suspect I may dig into this...

M ;-)

posts: 3

So I will make a short update how to incorporate the ASCIIMath package into a tiki:

  • Download the ASCIIMathML.js file from http://www1.chapman.edu/~jipsen/mathml/asciimathdownload.html and place it to the directory tikiwiki/lib/
  • Log as admin in your tiki installation
  • Go to the "Look & Feel" menu in the admin area
  • In the "Customization" tab enter in the "Custom HTML Content" field: < script type="text/javascript" src="lib/ASCIIMathML.js">< /script> (remove the two spaces in the code)
  • Apply the change

Now you can enter on each page a formula using ``
e.g. `a=b^4`

Have fun

posts: 2

I followed your installation instructions but am still running into problems. Don't know if you can help but maybe someone who's reading this thread may have an idea.

I input the following equations on a page:

2+b=c` `x

The first equation displays correctly (in blue) while the next two don't (they display as they do on this page).

I've tried the same code at ASCIIMathML.js demo page and they displayed correctly there.

If anyone can point me in the right direction I would really appreciate it.

posts: 6 United States

The reason it is not working is because the ^
character since it is rendered by the tiki first.
To prevent that use 'no-op' like:

It works on mine with ASCIIMathML148.js installed.
It does not work here since ASCIIMathML.js is not installed here.

posts: 6 United States

Many years later.
v15 and up support HTML plug-in. With that, you can use MathML

posts: 126886 United Kingdom

Hi Dr D

I approved your html plugin but it just says:


I expect something else was suppose to happen?

Nice to see an ancient thread like this resurrected! mrgreen

posts: 6 United States

@Jonny, Thanks for approving the message.
Interesting. I guess it may caused by version or some kind of format filtering.

Attached, please find my code and results and hope that can be of use to someone.

Page: 1/2  [Next]