レンダリングには Infographics / Google Chart API の Mathematical Formulas を利用しています.
以下のコードを貼付けます.使い方はコード中のコメントの通りです.クラス名が他とバッティングするようならば,変更したほうが良いかもしれません.
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
<!-- | |
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(/>/g, ">").replace(/</g, "<").replace(/"/g, '"').replace(/&/g, "&"); | |
if (chl) | |
arr[j] = '<img src="http://chart.googleapis.com/chart?cht=tx&chl=' + encodeURIComponent(chl) + '" \/>' | |
} | |
$(this).html(arr.join('<br \/>')); | |
}); | |
</script> |
ax^2 + bx + c = 0
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
とても魅力的な記事でした!!
ReplyDeleteまた遊びに来ます!!
ありがとうございます。。