Okay, Mahara 15.10 now supports MathJax! Thanks for the patch, Geoffrey.

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask 
on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1464858

Title:
  Add MathJax and mhchem support to Mahara

Status in Mahara ePortfolio:
  Fix Committed

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/admin/site/options.php:

  Around line 113 add:

                  'mathjax' => array(
                      'type'         => 'checkbox',
                      'title'        => get_string('mathjax', 'admin'),
                      'description'  => get_string('mathjaxdescription', 
'admin'),
                      'defaultvalue' => get_config('mathjax'),
                      'help'         => true,
                      'disabled'     => in_array('mathjax', $OVERRIDDEN),
                  ),

  Around line 763 add mathjax to the $fields array to give:

      $fields = array(
          'sitename','lang','theme', 'dropdownmenu',
          'defaultaccountlifetime', 'defaultregistrationexpirylifetime', 
'defaultaccountinactiveexpire', 'defaultaccountinactivewarn',
          'defaultaccountlifetimeupdate', 'allowpublicviews', 
'allowpublicprofiles', 'allowanonymouspages', 'generatesitemap',
          'registration_sendweeklyupdates', 'mathjax', 
'institutionexpirynotification', 'institutionautosuspend', 
'requireregistrationconfirm',
          'showselfsearchsideblock', 'searchusernames', 'searchplugin', 
'showtagssideblock',
          'tagssideblockmaxtags', 'country', 'viewmicroheaders', 
'userscanchooseviewthemes',
          'remoteavatars', 'userscanhiderealnames', 'antispam', 'spamhaus', 
'surbl', 'anonymouscomments',
          'recaptchaonregisterform', 'recaptchapublickey', 
'recaptchaprivatekey', 'loggedinprofileviewaccess', 'disableexternalresources',
          'proxyaddress', 'proxyauthmodel', 'proxyauthcredentials', 
'smtphosts', 'smtpport', 'smtpuser', 'smtppass', 'smtpsecure',
          'noreplyaddress', 'homepageinfo', 'showprogressbar', 
'showonlineuserssideblock', 'onlineuserssideblockmaxusers',
          'registerterms', 'licensemetadata', 'licenseallowcustom', 
'allowmobileuploads', 'creategroups', 'createpublicgroups', 
'allowgroupcategories', 'wysiwyg',
          'staffreports', 'staffstats', 'userscandisabledevicedetection', 
'watchlistnotification_delay',
          'masqueradingreasonrequired', 'masqueradingnotified', 
'searchuserspublic',
          'eventloglevel', 'eventlogexpiry', 'sitefilesaccess', 'exporttoqueue',
      );

  2 Add  $CFG->mathjaxpath and $CFG->mathjaxconfig to the end of 
/lib/config-default.php:
     
   /**
   * @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.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML&delayStartupUntil=configured';

  /**
   * @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.Hub.Config({
  TeX:{extensions: ["mhchem.js"]}
  });
  MathJax.Hub.Configured();
  ';

  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('mathjax')) {
          $headers[] = '<script>'.get_config('mathjaxconfig').'</script>';
      }

  and just after $javascript_array[] = $jsroot .
  'keyboardNavigation.js'; around line 280 add:

      if (get_config('mathjax')) {
          $javascript_array[] = get_config('mathjaxpath');
      }

  4. To /lang/en.utf8/admin.php add:

  $string['mathjax'] = 'Enable MathJax';
  $string['mathjaxdescription'] = 'MathJax enables mathematical and science 
equations to be displayed';
  $string['mathjaxconfig'] = 'MathJax configuration';

  5 Create /lang/en.utf8/help/forms/siteoptions.mathjax.html with the
  content:

  <!-- @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later 
-->
  <!-- @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://docs.mathjax.org/en/latest/installation.html";>http://docs.mathjax.org/en/latest/installation.html</a></p>
  <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->mathjaxconfig. 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.</p>
  <p>By default, includes the mhchem extension which adds the \ce macro for 
chemical formulae. See <a 
href="http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions";>http://docs.mathjax.org/en/latest/tex.html#tex-and-latex-extensions</a>.</p>

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1464858/+subscriptions

_______________________________________________
Mailing list: https://launchpad.net/~mahara-contributors
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~mahara-contributors
More help   : https://help.launchpad.net/ListHelp

Reply via email to