Help us understand the problem. What is going on with this article?

GoogleAPIでTexを使う。

More than 5 years have passed since last update.

<div class='tex'>なタグをすべて、GoogleAPIで数式画像を生成し、imgタグに置換するコードです。
<div class='tex'>なタグの中身はTexのコード。
jQueryのeachメソッド使うことで簡単に画像に置換できるのは便利ですね...。

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  </head>
  <body>

<div class='tex'>
f(x)=\int_0^{x}g(t)\,dt
</div>

<div class='tex'>
\frac{d^2\phi(x)}{dx^2} = 
\frac{2m}{\hbar^2} \bigl\{ \frac{1}{2}m\omega^2 x^2 - E \bigr\} \phi(x)
</div>

<script type='text/javascript'>
$('.tex').each(function(i,obj){
  var base = 'http://chart.apis.google.com/chart?cht=tx&chl=';
  var url = base + encodeURIComponent($(obj).html());
  $('<img>').attr('src',url).insertAfter(obj);
  $(obj).remove();
});
</script>

  </body>
</html>
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away