Manual:Mathoid

Mathoid is an application used by Extension:Math to convert various forms of math input to MathML + SVG or PNG output.

Getting started
Mathoid is a web service implemented using Node.js, often referred to simply as node.

MediaWiki-vagrant
Install MediaWiki vagrant and run

NPM package (Debian Jessie)
Debian Jessie has been superseded by Debian Stretch. Jessie by default uses PHP 5.6 which is no longer supported as of MediaWiki 1.31+.

If you want to run  you'll need to install the   package.

NPM package (Debian Stretch)
Note: npm is not in the Debian Stretch repositories. Mathoid has been tested under nodejs version 10. It fails in the latest nodejs version (v12)

If you want to run  you'll need to install the   package.

To setup mathoid to run as a standalone daemon and start automatically, move the folder to a system folder, and create a "mathoid" user to run the daemon as:

Create a  file with the following content:

And then enable and start the service with the following commands:

Trouble shooting with CentOS 6.

 * If you have  related error, install upgraded gcc.
 * use new gcc. (you can back to old gcc with .)
 * If you got error about, edit   in   like below.

Scientific Linux 7.2
Instructions based on SL 7.2 minimal install. Should be the same for Red Hat Enterprise Linux (RHEL), CentOS and clones. Important install latest Mathoid version, at time of writing 0.6.3 and corresponding node.js version, at time of writing 4.x LTS branch. Especially VM/Server needs direct internet connection during installation. Internet access via proxy did not work. Using node.js from repository did not work for Debian 8.5, Ubuntu 16.4, Ubuntu 14.4, Fedora 24 alpha and SL7 + EPEL.

First install prerequisites
Run the following as root. Disable SL7 fastbug repo (optional).

Install Node.js and Mathoid
Run the following as root. Get node.js repo from nodesource. Note one may want to first save and inspect the script before executing it as root.

Switch to user account

Test
To test run Mathoid as user with

Update firewall, setup security (e.g. SELINUX), setup to run as service, proxy server to access internet, etc... One should be able to install mocha through npm, if one wants.

LocalSettings.php
Config of LocalSettings.php in MediaWiki root directory.

Configuring
Check if the symlink config.yaml points either to config.prod.yaml or config.dev.yaml The settings should be self-explaining. Important is the port. Note that the port is different depending if you use config.prod.yaml (10042) or config.dev.yaml (10044).

Check the  section and change the   parameter to point to your api endpoint.

Check the  section and change the   parameter to point to your RESTBase endpoint.

Performance
With speech support, performance may be terrible, if there are many complex equations. you can turn off speech support.

Testing
After installation you can test your installation via

the expected output is:

you can use the option type=mml for mathml input.

Credits for


 * Gabriel Wicke
 * Frédéric Wang
 * Anton Grbin
 * Davide P. Cervone
 * Marko Obrovac

Troubleshooting

 * app.js is not found

in the config file change services->mathoid->module from app.js to mathoid/app.js

Development
Code review happens in Gerrit. See Gerrit/Getting started and ping the parsoid team in.

The most recent development version is available from https://gitlab.wikimedia.org/repos/mediawiki/services/mathoid