User:N3X15/rewrites/Manual:Mathoid

Mathoid is an application which takes various forms of math input and converts it 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)
If you want to run  you'll need to install the   package.

NPM package (Debian Stretch)
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
Mediawiki requires changes to LocalSettings.php to work with Mathoid, and also needs the Math extension installed.

Configuring
Configuration for Mathoid is done within YAML files that are loaded by the cli.js script, or by the service daemon (server.js). Examples of how WMF configures Mathoid for development (config.dev.yaml) and deployment (config.prod.yaml) are included within the repository for reference.

To configure Mathoid with the most basic settings, suitable for a small wiki or wiki farm:


 * 1) Remove the config.yaml symlink, if it exists (rm config.yaml)
 * 2) Copy config.dev.yaml to config.yaml.(cp config.dev.yaml config.yaml)
 * 3) Open config.yaml with your favorite text editor and change any of the default settings, as desired.

The default configuration in config.dev.yaml assumes that each wiki that accesses Mathoid uses /w as its $wgScriptPath

Settings
Make sure both mwapi_req and restbase_req are pointing to the correct URIs.

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 #mediawiki-parsoid.

The most recent development version is available from https://github.com/wikimedia/mathoid