MathJax v4 with v2-compatibility (original) (raw)

The API in MathJax v3 and v4 differs substantially from that in v2. This file demonstrates how to simulate some of the v2 API in v4.

Color:

Testing color: \(\color{red}{x} + y\)

Require:

Testing AMScd: \(\require{AMScd} \begin{CD} A @>f>> B\end{CD}\)

Testing HTML: \(\require{HTML} \href{https://www.mathjax.org/}{\\text{a link}}\)

MathJax.Hub:

Hub calls Failed!

This example shows how to set up MathJax version 3 to act somewhat more like MathJax version 2. The main actions are to return the\color macro to the non-standard version-2 behavior, and to allow the \require macro to use the version-2 TeX extension names. In addition, this example also defines versions of

that you may be able to use to keep custom code that uses these version 2 features working. It also defines

to generate error messages, and looks for<script type="text/x-mathjax-config"> blocks, which are no longer supported, in order to alert you to the need to convert these to version 4 by hand. You should use the configuration converter to help convert your version 2 configuration to a comparable version 4 configuration.

The script in the last section of the body uses the MathJax.Hub.Queue() to typeset the page, and then insert a success message that verifies that the queue is working.