Startup Options

The startup component is responsible for creating the objects needed by MathJax to perform the mathematical typesetting of your pages, and for setting up the methods you may need to call in order to do that. It is configured using the startup block in your configuration object.


The Configuration Block

In the example below, Startup represents the MathJax.startup object, for brevity.

MathJax = {
  loader: {
    elements: null,          // The elements to typeset (default is document body)
    typeset: true,           // Perform initial typeset?
    ready: Startup.defaultReady.bind(Startup),          // Called when components are loaded
    pageReady: Startup.defaultPageReady.bind(Startup),  // Called when MathJax and page are ready
    document: document,      // The document (or fragment or string) to work in
    input: [],               // The names of the input jax to use from among those loaded
    output: null,            // The name for the output jax to use from among those loaded
    handler: null,           // The name of the handler to register from among those loaded
    adaptor: null            // The name for the DOM adaptor to use from among those loaded
  }
};

Option Descriptions

elements: null

This is either null or an array of DOM elements whose contents should be typeset. The elements can either be actual DOM elements, or strings that give CSS selectors for the elements to typeset.

typeset: true

This determines whether the initial typesetting action should be performed when the page is ready.

ready: Startup.defaultReady.bind(Startup)

This is a function that is called when MathJax is loaded and ready to go. It is called by the loader when all the components are loaded. The default action is to create all the objects needed for MathJax, and set up the call to the pageReady() function below. You can override this function if you want to modify the setup process; see Performing Actions During Startup for more details. Note that this function may be called before the page is complete, so unless you are modifying the objects created by the startup module, replacing pageReady() may be the better choice.

pageReady: Startup.defaultPageReady.bind(Startup)

This is a function that is called when MathJax is ready to go and the page is ready to be processed. The default action is to perform the initial typesetting of the page, but you can override it to do whatever you would like. See Performing Actions During Startup for more details and examples of how to do this.

document: document

This is the document (or fragment or string of serialized HTML) that you want to process. By default (for in-browser use) it is the browser document. When there is no global document variable, it is an empty HTML document.

input: []

This is an array of names of input processors that you want to use, from among the ones that have been loaded. So if you have loaded the code for several input jax, but only want to use the tex input jax, for example, set this to ['tex']. If set to an empty array, then all loaded input jax are used.

output: null

This is the name of the output processor that you want to use, from among the ones that have been loaded. So if you have loaded the code for several output jax, but only want to use the svg output jax, for example, set this to 'svg'. If set to null or an empty string, then the first output jax that is loaded will be used.

handler: null

This is the name of the document handler that you want to use, from among the ones that have been loaded. Currently, there is only one handler, the HTML handler, so unless you are creating your own handlers, leave this as null.

adaptor: null

This is the name of the DOM adaptor that you want to use, from among the ones that have been loaded. By default the components load the browser adaptor, but you can load the liteDOM adaptor for use in node applications; if you do, it will set this value so that it will be used automatically.