Created
April 7, 2012 15:53
-
-
Save vaiorabbit/2329890 to your computer and use it in GitHub Desktop.
Converts math formula (written in TeX language) into PNG file via Google Chart API.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript"> | |
function reload_formula(tex_math) | |
{ | |
// Ref.: Comparing escape(), encodeURI(), and encodeURIComponent() | |
// http://xkr.us/articles/javascript/encode-compare/ | |
document.getElementById("formula_image").src = "https://chart.googleapis.com/chart?cht=tx&chl=" + encodeURIComponent(tex_math); | |
} | |
</script> | |
</head> | |
<body onload="reload_formula(this.form.formula.value)"> | |
<form id="form"> | |
TeX Formula: <input type="text" name="formula" size="80" onkeyup="reload_formula(this.value)" value="x = \frac{-b\pm\sqrt{b^2-4ac}}{2a}"/> | |
</form> | |
<p> | |
Result: <br /> | |
<img src="" id="formula_image"/> | |
</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment