****************************
The MathJax Processing Model
****************************
The purpose of MathJax is to bring the ability to include mathematics
easily in web pages to as wide a range of browsers as possible.
Authors can specify mathematics in a variety of formats (e.g.,
:term:`MathML` or :term:`LaTeX`), and MathJax provides high-quality
mathematical typesetting even in those browsers that do not have
native MathML support. This all happens without the need for special
downloads or plugins, but rendering will be enhanced if high-quality
math fonts (e.g., :term:`STIX`) are available to the browser.
MathJax is broken into several different kinds of components: page
preprocessors, input processors, output processors, and the MathJax
Hub that organizes and connects the others. The input and output
processors are called :term:`jax`, and are described in more detail
below.
When MathJax runs, it looks through the page for special tags that
hold mathematics; for each such tag, it locates an appropriate input
jax which it uses to convert the mathematics into an internal form
(called an element jax), and then calls an output jax to transform the
internal format into HTML content that displays the mathematics within
the page. The page author configures MathJax by indicating which
input and output jax are to be used.
Often, and especially with pages that are authored by hand, the
mathematics is not stored (initially) within the special tags needed
by MathJax, as that would require more notation than the average page
author is willing to type. Instead, it is entered in a form that is
more natural to the page author, for example, using the standard TeX
math delimiters ``$...$`` and ``$$...$$`` to indicate what part of the
document is to be typeset as mathematics. In this case, MathJax can
run a preprocessor to locate the math delimiters and replace them by
the special tags that it uses to mark the formulas. There are
preprocessors for :ref:`TeX notation `, :ref:`MathML
notation `, and the :ref:`jsMath notation
` that uses `span` and `div` tags.
For pages that are constructed programatically, such as HTML
pages that result from running a processor on text in some other
format (e.g., pages produced from Markdown documents, or via programs
like `tex4ht`), it would be best to use MathJax's special tags
directly, as described below, rather than having MathJax run
another preprocessor. This will speed up the final display of the
mathematics, since the extra preprocessing step would not be needed,
and it also avoids the conflict between the use of the less-than sign,
``<``, in mathematics and asn an HTML special character (that starts
an HTML tag).
How mathematics is stored in the page
=====================================
In order to identify mathematics in the page, MathJax uses special
``
represents an in-line equation in TeX notation, and
.. code-block:: html
is a displayed TeX equation.
Alternatively, using MathML notation, you could use
.. code-block:: html
for in-line math, or
.. code-block:: html
for displayed equations in MathML notation.
As other input jax are created, they will use other types to identify
the mathematics they can process.
Page authors can use one of MathJax's preprocessors to convert from
math delimiters that are more natural for the author to type (e.g.,
TeX math delimiters like ``$$...$$``) to MathJax's ``