Mathoid-server is a service that uses MathJax to create SVGs and MathML on server side. Mathoid-server is a based on svgtex - https://github.com/agrbin/svgtex.
Install node 6.9.0 or a compatible node version.
In addition the prerequisites from librsvg are needed.
For Debian based systems installing the
librsvg2-dev should be sufficient.
sudo apt-get install librsvg2-dev
Thereafter, install mathoid by running
npm install mathoid node /node_modules/mathoid/server.js
To install mathoid as a unix service there is a script.
Running the tests
To run the tests you need to install mocha. After that you can run the tests from the mathoid folder.
The main entry point is '/' with one required POST parameter 'q'.
Additional entry points for individual formats are
- /texvcinfo does not do any rendering. Only displays information regarding the texvc input.
- /speech returns the speech output only
- /mml only MathML
- /svg only SVG
- /png only PNG
- /json (same as /)
- /complete (see below)
The 'complete' output format is equal to the 'json' one except that it also includes the headers for individual types in the response body as well. The output specification is identical, except that the 'mml', 'svg' and 'png' fields are now (JSON) objects containing the 'body' and 'headers' fields.
q (input to be converted)
- required parameter
- no $ for (La)TeX input
type (the input type)
- defalult 'tex'
- possible values
- tex (texvc input will be verified by texvccheck)
- inline-tex (texvc input will be rendered with small operators)
- mml (MathML input, used in latexml rendering mode)
- ascii (ascii mathml input, experimental)
- if speech output is enabled this switch suppresses speech output for one particular request
- svg: creates and svg image (turned on by default)
- img: creates a img element with dimension information about the svg image
- png: creates png images using java
- speech: creates speech output using speech rule engine
- texvcinfo: displays information regarding the texvc input (experimental)
- speechOn: default setting for speech output. 'true' is equivalent to the old speakText.
The performance tests can be run by executing the performance.sh script.
On our labs-vagrant test instance with 8 workers and 100 request the following results were obtained for the input $E = m c^2$:
|format (without speech support)||time||sd|
|The time, i.e. "Total Connection Times" were measured in unit ms.|
Create a new release
Checkout the latest version and switch to the master branch:
- git-dch -R -N version
- git-buildpackage --git-tag -S
publish as ppa
- dput ppa:physikerwelt/mathoid ../version.changes
Based on the Template for creating MediaWiki Services in Node.js The template also includes a test suite a small set of executable tests. To fire them up, simply run:
If you haven't changed anything in the code (and you have a working Internet connection), you should see all the tests passing. As testing most of the code is an important aspect of service development, there is also a bundled tool reporting the percentage of code covered. Start it with:
npm run-script coverage
In a lot of cases when there is an issue with node it helps to recreate the
rm -r node_modules npm install