Learning, Technology and Collaboration

How to add Mathematical Notation to Mahara 1.3.3

Posted on: March 6, 2011

I have tried other mathematical plugins for TinyMCE but none of them worked. Today I tried MathJax and it was so easy to integrate it to Mahara.

MathJax is an open source JavaScript display engine for mathematics that works in all modern browsers. You can use TeX, LaTeX, MathML and other formats.

I am going to show you how to add MathJax to Mahara.

First download MathJax from here. As of today, version is MathJax-v1.0.1a.zip.
Download MathJax-Font-Update.zip as well. You may not need this in future. This fonts are for Firefox 3.6.13.

You need to unzip it and transfer following directories to mahara/js directory.
– config
– extensions
– fonts
– jax
– MathJax.js

Open mahara/lib/web.php and around line 219 add $javascript_array[] = $jsroot . ‘MathJax.js’; as following.


else {
$javascript_array[] = $jsroot . 'MochiKit/Packed.js';
$javascript_array[] = $jsroot . 'MathJax.js';
}

That’s it.
In Mahara, create a view and drag a textbox and enter the following.

When \(a \ne 0\), there are two solutions to \(ax^2 + bx + c = 0\) and they are
$$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

You should be able to see mathematical notation!

Sample 1

Conclusion

MathJax is easy to install. Only drawback I can think of is that MathJax does not use flash nor graphical input, so you have to learn these formats to input. I am not so familiar with these notations and I have to learn them.

Advertisements
Tags:

7 Responses to "How to add Mathematical Notation to Mahara 1.3.3"

MathJax now has a script to link directly to their CDN so that a MathJax installation is always up to date. Do you know how to integrate that script into Mahara so that it anywhere text appears in Mahara mathjax will render it?

I haven’t done it yet, but according to the documentation, you just need to add the following to the head section of your template.

I looked at the theme folder and only see a themeconfig.php file

I get an error when I try to put the script in there:

Forgive me for being a novice, where exactly is the theme header? A special js file?

Have you tried lib/htmloutput.php?

Yes, that worked like a charm! Thanks, I really appreciate it. I just put it between a couple functions, and it works all through my mahara installation.

Thanks again!

Unfortunately, I was premature. It’s ended up being the same result as when I tried the themeconfig.php file. With the script in place, I get a ‘something really bad happened when getting headers’ error when try to save a view or forum update.

Maybe I’ll abandon this autoupdate script and try the way you did it.

Hi, the question has now been answered on mahara.org

The solution was to edit lib/web.php by adding: $javascript_array[] = ‘http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML’;

just above the line: $javascript_array[] = $jsroot . ‘keyboardNavigation.js’;
(line 221 in Mahara 1.3, 229 in Mahara 1.4)

Thanks to Iñaki for this solution.
Thanks for your help on this as well,
Malcolm

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


  • None
  • macdrew: Hi, the question has now been answered on mahara.org The solution was to edit lib/web.php by adding: $javascript_array[] = 'http://cdn.mathjax.org/
  • macdrew: Unfortunately, I was premature. It's ended up being the same result as when I tried the themeconfig.php file. With the script in place, I get a 'somet
  • macdrew: Yes, that worked like a charm! Thanks, I really appreciate it. I just put it between a couple functions, and it works all through my mahara installati

Categories

%d bloggers like this: