sample-loader-config.html 1.5 KB

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