MathJax TeX and LaTeX Support

The support for TeX and LaTeX in MathJax consists of two parts: the tex2jax preprocessor, and the TeX input processor. The first of these looks for mathematics within your web page (indicated by math delimiters like $$...$$) and marks the mathematics for later processing by MathJax. The TeX input processor is what converts the TeX notation into MathJax’s internal format, where one of MathJax’s output processors then displays it in the web page.

The tex2jax preprocessor can be configured to look for whatever markers you want to use for your math delimiters. See the tex2jax configuration options section for details on how to customize the action of tex2jax.

The TeX input processor handles conversion of your mathematical notation into MathJax’s internal format (which is essentially MathML), and so acts as a TeX to MathML converter. The TeX input processor has few configuration options (see the TeX options section for details), but it can also be customized through the use of extensions that define additional functionality (see the TeX and LaTeX extensions below).

Note that the TeX input processor implements only the math-mode macros of TeX and LaTeX, not the text-mode macros. MathJax expects that you will use standard HTML tags to handle formatting the text of your page; it only handles the mathematics. So, for example, MathJax does not implement \emph or \begin{enumerate}...\end{enumerate} or other text-mode macros or environments. You must use HTML to handle such formatting tasks. If you need a LaTeX-to-HTML converter, you should consider other options.

TeX and LaTeX math delimiters

By default, the tex2jax preprocesor defines the LaTeX math delimiters, which are \(...\) for in-line math, and \[...\] for displayed equations. It also defines the TeX delimiters $$...$$ for displayed equations, but it does not define $...$ as in-line math delimiters. That is because dollar signs appear too often in non-mathematical settings, which could cause some text to be treated as mathematics unexpectedly. For example, with single-dollar delimiters, ”... the cost is $2.50 for the first one, and $2.00 for each additional one ...” would cause the phrase “2.50 for the first one, and” to be treated as mathematics since it falls between dollar signs. For this reason, if you want to use single-dollars for in-line math mode, you must enable that explicitly in your configuration:

MathJax.Hub.Config({
  tex2jax: {
    inlineMath: [['$','$'], ['\\(','\\)']],
    processEscapes: true
  }
});

Note that if you do this, you may want to also set processEscapes to true, as in the example above, so that you can use \$ to prevent a dollar sign from being treated as a math delimiter within the text of your web page. (Note that within TeX mathematics, \$ always has this meaning; processEscapes only affects the treatment of the opening math delimiter.)

See the config/default.js file, or the tex2jax configuration options page, for additional configuration parameters that you can specify for the tex2jax preprocessor, which is the component of MathJax that identifies TeX notation within the page).

TeX and LaTeX in HTML documents

Keep in mind that your mathematics is part of an HTML document, so you n