sample-autoload.html 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Example of defining a macro that autoloads an extension</title>
  5. <!-- Copyright (c) 2012-2013 The MathJax Consortium -->
  6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  8. <!--
  9. |
  10. | This page shows how to define macros that autoloads an extension
  11. | where those macros are implemented.
  12. |
  13. | The \cancel, \bcancel, \xcancel, and \cancelto macros are
  14. | all defined within the cancel extension, so we tie these
  15. | macros to the function that loads an extension, passing it
  16. | the name of the extension to load.
  17. |
  18. |-->
  19. <script type="text/x-mathjax-config">
  20. MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
  21. MathJax.Hub.Insert(MathJax.InputJax.TeX.Definitions.macros,{
  22. cancel: ["Extension","cancel"],
  23. bcancel: ["Extension","cancel"],
  24. xcancel: ["Extension","cancel"],
  25. cancelto: ["Extension","cancel"]
  26. });
  27. });
  28. </script>
  29. <script type="text/javascript" src="../MathJax.js?config=TeX-AMS_HTML-full"></script>
  30. </head>
  31. <body>
  32. <p>
  33. This page makes <code>\cancel</code>, <code>\bcancel</code>,
  34. <code>\xcancel</code>, and <code>\cancelto</code> all be defined so that
  35. they will load the <code>cancel.js</code> extension when first used.
  36. </p>
  37. <p>
  38. Here is the first usage: \(\cancel{x+1}\). It will cause the cancel
  39. package to be loaded automatically.
  40. </p>
  41. </body>
  42. </html>