-
Notifications
You must be signed in to change notification settings - Fork 97
Configuration options
Peter Krautzberger edited this page Jun 3, 2016
·
5 revisions
The MathJax-node API has two sets of configuration options.
The config
method is used to set global configuration options.
{
displayMessages: false, // determines whether Message.Set() calls are logged
displayErrors: true, // determines whether error messages are shown on the console
undefinedCharError: false, // determines whether unknown characters are saved in the error array
extensions: '', // a convenience option to add MathJax extensions
fontURL: 'https://cdn.mathjax.org/mathjax/latest/fonts/HTML-CSS', // for webfont urls in the CSS for HTML output
MathJax: { } // options MathJax configuration, see https://docs.mathjax.org
}
Changes to these options require a restart of the API using the start()
method.
The typeset
method expects a configuration object and a callback the following configuration options.
{
ex: 6, // ex-size in pixels
width: 100, // width of container (in ex) for linebreaking and tags
useFontCache: true, // use <defs> and <use> in svg output?
useGlobalCache: false, // use common <defs> for all equations?
linebreaks: false, // do linebreaking?
equationNumbers: "none", // or "AMS" or "all"
math: "", // the math to typeset
format: "TeX", // the input format (TeX, inline-TeX, AsciiMath, or MathML)
xmlns: "mml", // the namespace to use for MathML
html: false, // generate HTML output?
css: false, // generate CSS for HTML output?
mml: false, // generate mml output?
svg: false, // generate svg output?
speakText: false, // add spoken annotations to svg output?
speakRuleset: "mathspeak", // set speech ruleset (default (chromevox rules), mathspeak)
speakStyle: "default", // set speech style (mathspeak: default, brief, sbrief)
timeout: 10 * 1000, // 10 second timeout before restarting MathJax
}
MathJax-node returns an object in the callback with (at most) the following structure:
{
mml: // a string of MathML markup if requested
svg: // a string of SVG markup if requested
state: { // if useGlobalCache is set
glyphs: // a collection of glyph data
defs : // a string containing SVG def elements
}
style: // a string of CSS inline style if SVG requested
html: // a string of HTML markup if requested
css: // a string of CSS if HTML was requested
speakText: // a string of speech text if requested
}