code: function GetState(state) {
    var SVG = MathJax.OutputJax.SVG,
        TEX = MathJax.InputJax.TeX,
        MML = MathJax.ElementJax.mml,
        AMS = MathJax.Extension["TeX/AMSmath"],
        HUB = MathJax.Hub, HTML = MathJax.HTML,
        GLYPH = (SVG.BBOX||{}).GLYPH;
  
    if (state && state.AMS) {
      AMS.startNumber = state.AMS.startNumber;
      AMS.labels = state.AMS.labels;
      AMS.IDs = state.AMS.IDs;
      MML.SUPER.ID = state.mmlID;
      GLYPH.glyphs = state.glyphs;
      GLYPH.defs = state.defs;
      GLYPH.n = state.n;
      ID = state.ID;
    } else {
      if (state) {state.AMS = {}}
      if (SVG.resetGlyphs) SVG.resetGlyphs(true);
      if (data.useGlobalCache) {
        state.glyphs = {};
        state.defs = HTML.Element("defs");
        state.n = 0;
      }
      if (TEX.resetEquationNumbers) TEX.resetEquationNumbers();
      MML.SUPER.ID = ID = 0;
      MathJax.OutputJax.CommonHTML.ID = 0;
    }
  }
docs: Update the MathJax values from the state, or clear them if there is no state.