Autoload MathJax - global and by element (v4)

VERSION 4: Here, we're autoloading MathJax after the value JXG.Options.text.useMathJax is set to true OR if any text element has useMathJax = true;.

You can test various scenarios in this script (by commenting out or not the following in the source code):

  1. User provides a MathJax configuration (or doesn't). If they haven't, the second and third expressions won't work because they're in $...$ delimiters.
  2. MathJax is already loaded before JSXGraph scripts run, so no need to autoload (or not)
  3. There is a window "load" eventListener (or not)
  4. User specifies useMathJax: true and parse: false (or not)

On this example page, we see SOME instances of JSXGraph's default "MathJax (not yet) loaded" in the console, since we are waiting until MathJax is loaded and ready before it typesets the math. When something like this code block is within JSXGraph, I believe those notifications will be gone.