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