Skip to content

Instantly share code, notes, and snippets.

@satomacoto
Created December 27, 2011 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save satomacoto/1523083 to your computer and use it in GitHub Desktop.
Save satomacoto/1523083 to your computer and use it in GitHub Desktop.
LaTeX for Blogger, requires jQuery
<!--
LaTeX for Blogger, requires jQuery
1. Add a HTML/Javascript gadget in the Layout mode and write this code.
2. In the HTML edit mode, write equations as follows:
<div class="equation">
ax^2 + bx + c = 0
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
</div>
http://code.google.com/apis/chart/infographics/docs/formulas.html
-->
<script type="text/javascript">
$('.equation').each(function(i,e) {
var arr = new Array();
var lines = $(this).html().replace(/\r\n|\r|\n/g,'').split(/<br>/i);
for (var j = 0; j < lines.length; j++) {
var chl = lines[j].replace(/&gt;/g, ">").replace(/&lt;/g, "<").replace(/&quot;/g, '"').replace(/&amp;/g, "&");
if (chl)
arr[j] = '<img src="http://chart.googleapis.com/chart?cht=tx&chl=' + encodeURIComponent(chl) + '" \/>'
}
$(this).html(arr.join('<br \/>'));
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment