Last active
December 20, 2015 00:49
-
-
Save alexchinco/6045074 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<meta name="viewport" content="width=device-width"> | |
<head> | |
<script type="text/javascript" src="http://d3js.org/d3.v3.js"></script> | |
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/2.1-latest/MathJax.js?config=TeX-AMS-MML_SVG-full"></script> | |
<style type="text/css"> | |
body { | |
font: 12px serif; | |
} | |
</style> | |
</head> | |
<body> | |
<title>MathJax Test</title> | |
<script type="text/javascript"> | |
var canvas = d3.select("body").append("svg").attr("width", 700).attr("height",400); | |
var normal = canvas.append("g").attr("id", "normal"); | |
var LaTeX = canvas.append("g").attr("id", "LaTeX"); | |
normal.append("text").text("y = x + 1 (at x = 1)").attr("x", 0).attr("y", 0).attr("transform", "translate(200,100)rotate(30)"); | |
LaTeX.append("foreignObject").attr("x", 400).attr("y", 100).append("xhtml:svg").attr("id", "MathDiv").text("\\[ y = x^2 - \\log(1) \\ : \\ x = \\sqrt{2} \\]"); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment