Skip to content

Instantly share code, notes, and snippets.

@pelletier
Created April 19, 2010 07:12
Show Gist options
  • Save pelletier/370811 to your computer and use it in GitHub Desktop.
Save pelletier/370811 to your computer and use it in GitHub Desktop.
Simple script which uses tex2png to convert latex <eq> into PNGs.
<!DOCTYPE>
<html>
<head>
<title>My math web page</title>
<meta charset="utf-8">
<style type="text/css" media="screen">
eq img {
position: relative;
top: 4px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("eq").each(function(index){
var tex = encodeURI($(this).html());
$(this).html('<img src="http://tex2png.tutorsbox.com/1/'+tex+'">');
});
});
</script>
</head>
<body>
Here is my beautiful function <eq>f(x)=2x+3- \theta ^2</eq> and it is nice, hu?
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment