diff options
Diffstat (limited to 'src/page.html')
-rw-r--r-- | src/page.html | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/src/page.html b/src/page.html new file mode 100644 index 0000000..a0be105 --- /dev/null +++ b/src/page.html @@ -0,0 +1,101 @@ +<!DOCTYPE html> +<html> +<head> +<title>MathJax Dynamic Math Test Page</title> +<!-- Copyright (c) 2010-2013 The MathJax Consortium --> +<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> +<meta http-equiv="X-UA-Compatible" content="IE=edge" /> + +<script type="text/x-mathjax-config"> + MathJax.Hub.Config({ + extensions: ["tex2jax.js"], + jax: ["input/TeX", "output/HTML-CSS"], + displayAlign: "left", + tex2jax: { + displayMath: [ ['$$','$$'], ["\\[","\\]"] ], + processEscapes: true + }, + "SVG": { + availableFonts: ["TeX"], + linebreaks: { automatic: true } + }, + "HTML-CSS": { + linebreaks: { automatic: true } + } + + }); +</script> +<script type="text/javascript" src="file:///usr/share/javascript/mathjax/MathJax.js"></script> +<style> +.error { + background: #fff0f0; + border-radius: 2px; + padding: 8px; + color: red; +} +.text { + background: #f0f0ff; + border-radius: 2px; + padding: 8px; + color: blue; +} +.input { + background: #f0fff0; + border-radius: 2px; + padding: 8px; + color: blue; +} +</style> + +</head> +<body> + +<script> + // + // Use a closure to hide the local variables from the + // global namespace + // + (function () { + var QUEUE = MathJax.Hub.queue; // shorthand for the queue + + window.appendNode = function(node) { + document.getElementById("MathOutput").appendChild(node); + } + window.AddError = function (text) { + var pre = document.createElement("pre"); + var tnode = document.createTextNode(text); + pre.className = "error"; + pre.appendChild(tnode); + QUEUE.Push(["appendNode", window, pre]); + } + window.AddText = function (text) { + var pre = document.createElement("pre"); + var tnode = document.createTextNode(text); + pre.className = "text"; + pre.appendChild(tnode); + QUEUE.Push(["appendNode", window, pre]); + } + window.AddInput = function (text,title) { + var pre = document.createElement("pre"); + var tnode = document.createTextNode(text); + pre.title = title; + pre.className = "input"; + pre.appendChild(tnode); + QUEUE.Push(["appendNode", window, pre]); + } + window.AddMath = function (TeX,title) { + var math = document.getElementById("MathOutput"); + var div = document.createElement("div"); + var tnode = document.createTextNode(TeX); + div.title = title; + div.appendChild(tnode); + + QUEUE.Push(["appendNode", window, div]); + QUEUE.Push(["Typeset",MathJax.Hub, div]); + } + })(); +</script> + +<div id="MathOutput" class="output"></div> +</body> +</html> |