Skip to main content

The PreTeXt Guide

Section F.2 MathJax and Speech Rule Engine

MathJax is packaged as a node.js program. A component of MathJax is Speech Rule Engine (SRE), which converts to text that represents a spoken version of the mathematics, and to Nemeth braille, a braille code for expressing mathematics.
Follow the directions here exactly. Do not free-style and think some modification will have a better or identical result. In a terminal, set your working directory with
cd /path/to/mathbook/script/mjsre
Install both packages at the same time with a single command:
./update-sre
It is possible you will need to make this simple script executable. On Unix-style systems (Linux, Mac OS) this can be done with the chmod command. As this is a bash script, Windows users must use Window’s Sybsystem for Linux or examine the contents of the script to run the commands manually.
The update-sre script is supplied by PreTeXt. It will create a file and a directory:
/path/to/mathbook/script/mjsre/package-lock.json
/path/to/mathbook/script/mjsre/node_modules
Neither will be tracked by git. Since SRE changes faster than MathJax, this will replace MathJax’s expectation for a version of SRE with a potentially newer version. So do not be alarmed if it appears MathJax is missing a dependency, that is intentional.
Now you have copies of MathJax and SRE that can be used by the pretext/pretext script to process mathematics offline into useful formats for conversions to EPUB, Kindle, and braille.