autoload-all.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* -*- Mode: Javascript; indent-tabs-mode:nil; js-indent-level: 2 -*- */
  2. /* vim: set ts=2 et sw=2 tw=80: */
  3. /*************************************************************
  4. *
  5. * MathJax/extensions/TeX/autoload-all.js
  6. *
  7. * Provides pre-defined macros to autoload all the extensions
  8. * so that all macros that MathJax knows about are available.
  9. *
  10. * ---------------------------------------------------------------------
  11. *
  12. * Copyright (c) 2013 The MathJax Consortium
  13. *
  14. * Licensed under the Apache License, Version 2.0 (the "License");
  15. * you may not use this file except in compliance with the License.
  16. * You may obtain a copy of the License at
  17. *
  18. * http://www.apache.org/licenses/LICENSE-2.0
  19. *
  20. * Unless required by applicable law or agreed to in writing, software
  21. * distributed under the License is distributed on an "AS IS" BASIS,
  22. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. * See the License for the specific language governing permissions and
  24. * limitations under the License.
  25. */
  26. MathJax.Extension["TeX/autoload-all"] = {
  27. version: "2.2"
  28. };
  29. MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
  30. var EXTENSIONS = {
  31. action: ["mathtip","texttip","toggle"],
  32. AMSmath: ["mathring","nobreakspace","negmedspace","negthickspace","intI",
  33. "iiiint","idotsint","dddot","ddddot","sideset","boxed",
  34. "substack","injlim","projlim","varliminf","varlimsup",
  35. "varinjlim","varprojlim","DeclareMathOperator","operatorname",
  36. "genfrac","tfrac","dfrac","binom","tbinom","dbinom","cfrac",
  37. "shoveleft","shoveright","xrightarrow","xleftarrow"],
  38. begingroup: ["begingroup","endgroup","gdef","global"],
  39. cancel: ["cancel","bcancel","xcancel","cancelto"],
  40. color: ["color","textcolor","colorbox","fcolorbox","DefineColor"],
  41. enclose: ["enclose"],
  42. extpfeil: ["Newextarrow","xlongequal","xmapsto","xtofrom",
  43. "xtwoheadleftarrow","xtwoheadrightarrow"],
  44. mhchem: ["ce","cee","cf"]
  45. };
  46. var ENVIRONMENTS = {
  47. AMSmath: ["subarray","smallmatrix","equation","equation*"],
  48. AMScd: ["CD"]
  49. };
  50. var name, i, m, defs = {macros:{}, environment:{}};
  51. for (name in EXTENSIONS) {if (EXTENSIONS.hasOwnProperty(name)) {
  52. if (!MathJax.Extension["TeX/"+name]) {
  53. var macros = EXTENSIONS[name];
  54. for (i = 0, m = macros.length; i < m; i++)
  55. {defs.macros[macros[i]] = ["Extension",name]}
  56. }
  57. }}
  58. for (name in ENVIRONMENTS) {if (ENVIRONMENTS.hasOwnProperty(name)) {
  59. if (!MathJax.Extension["TeX/"+name]) {
  60. var envs = ENVIRONMENTS[name];
  61. for (i = 0, m = envs.length; i < m; i++)
  62. {defs.environment[envs[i]] = ["ExtensionEnv",null,name]}
  63. }
  64. }}
  65. MathJax.InputJax.TeX.Definitions.Add(defs);
  66. MathJax.Hub.Startup.signal.Post("TeX autoload-all Ready");
  67. });
  68. MathJax.Callback.Queue(
  69. ["Require",MathJax.Ajax,"[MathJax]/extensions/TeX/AMSsymbols.js"],
  70. ["loadComplete",MathJax.Ajax,"[MathJax]/extensions/TeX/autoload-all.js"]
  71. );