sample-loader-config.html 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Load MathJax with in-line configuration after the page is ready</title>
  5. <!-- Copyright (c) 2012-2017 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. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <script type="text/javascript">
  10. //
  11. // We wait for the onload function to show that MathJax is laoded after
  12. // the page is ready, and then use setTimeout to prove that MathJax is
  13. // definitely loaded after the page is displayed and active. MathJax is
  14. // loaded two seconds after the page is ready.
  15. //
  16. window.onload = function () {
  17. setTimeout(function () {
  18. var head = document.getElementsByTagName("head")[0], script;
  19. script = document.createElement("script");
  20. script.type = "text/x-mathjax-config";
  21. script[(window.opera ? "innerHTML" : "text")] =
  22. "MathJax.Hub.Config({\n" +
  23. " tex2jax: { inlineMath: [['$','$'], ['\\\\(','\\\\)']] }\n" +
  24. "});"
  25. head.appendChild(script);
  26. script = document.createElement("script");
  27. script.type = "text/javascript";
  28. script.src = "../MathJax.js?config=TeX-AMS-MML_HTMLorMML";
  29. head.appendChild(script);
  30. },2000)
  31. }
  32. </script>
  33. <style>
  34. h1 {
  35. text-align: center;
  36. background: #CCCCCC;
  37. padding: .2em 1em;
  38. border-top: 3px solid #666666;
  39. border-bottom: 3px solid #999999;
  40. }
  41. </style>
  42. </head>
  43. <body>
  44. <h1>Adding MathJax with In-Line Configuration</h1>
  45. <p>
  46. When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are
  47. $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$
  48. </p>
  49. </body>
  50. </html>