Add MathJax and mhchem support to Mahara
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
MathJax has become the de facto standard for displaying mathematical equations on the Web. The mhchem extension to MathJax provides additional support for chemical equations. The addition of these would allow Mahara to better support STEM subjects. MathJax is already supported by recent versions of Moodle where it provides an alternative to server-side TeX filters.
The following is a fairly minimalist implementation. More sophisticated admin/configuration could be added.
1. Add a checkbox to /htdocs/
Around line 113 add:
),
Around line 763 add mathjax to the $fields array to give:
$fields = array(
);
2 Add $CFG->mathjaxpath and $CFG->mathjaxconfig to the end of /lib/config-
/**
* @global string $cfg->mathjaxpath Determines the path to CDN or server-local installation of MathJax.js.
* If MathJax is enabled, use to configure path to MathJax.
*/
$cfg->mathjaxpath = '//cdn.
/**
* @global string $cfg->mathjaxconfig Determines MathJax configuration options.
* The default MathJax configuration should be appropriate for most users, but MathJax is highly configurable
* and any of the standard MathJax configuration options can be added here.
*/
$cfg->mathjaxconfig = '
MathJax.
TeX:{extensions: ["mhchem.js"]}
});
MathJax.
';
NB the protocol-neutral MathJax URL should work with either http: or https: Mahara sites.
3. Add the following to htdocs/lib/web.php immediately before TinyMCE is first included around line 111:
if (get_config(
$headers[] = '<script>
}
and just after $javascript_array[] = $jsroot . 'keyboardNaviga
if (get_config(
}
4. To /lang/en.
$string['mathjax'] = 'Enable MathJax';
$string[
$string[
5 Create /lang/en.
<!-- @license http://
<!-- @copyright For copyright information on Mahara, please see the README file distributed with this software. -->
<h3>MathJax</h3>
MathJax is a JavaScript display engine for TeX, LaTeX, AsciiMath and MathMl notation which allows mathematics and science equations to be displayed in Mahara pages.
<p>MathJax allows the display of equations throughout your Mahara installation.</p>
<h4>MathJax URL</h4>
<p>The default configuration uses the latest stable version on the MathJax Content Distribution Network (CDN). http and https protocols may be used, as appopriate.</p>
<p>Alternatively, $cfg->mathjaxpath may use a local server installation of MathJax. See <a href="http://
<p>The default includes a commonly used configuration allowing input of MathML, AsciiMath, TeX or LaTeX and processing to MathML or HTML-CSS</p>
<h4>MathJax additional configuration</h4>
<p>Additional MathJax configuration can be added to $cfg->mathjaxco
<p>By default, includes the mhchem extension which adds the \ce macro for chemical formulae. See <a href="http://
Changed in mahara: | |
status: | New → In Progress |
importance: | Undecided → Wishlist |
tags: | added: mathjax mhchem tinymce |
tags: | added: no-behat-needed |
Changed in mahara: | |
milestone: | none → 15.10.0 |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
no longer affects: | mahara/15.10 |
Duplicates and extends (additional mhchem support) https:/ /bugs.launchpad .net/mahara/ +bug/730373 Mathematical notation in Mahara with MathJax
See also this discussion: https:/ /mahara. org/interaction /forum/ topic.php? id=3759 Developers - Math on Mahara
Would also work nicely alongside the TinyMCE4 MathSlate plugin https:/ /github. com/dthies/ tinymce4- mathslate