- 公開日:
Google スライドで数式(Tex)を使う方法
こちらの記事では、Google スライドで数式(Tex)を使う方法についてお伝えします。
Google スライドでは、数式を入れる機能はデフォルトでありません。
しかしGAS(Google Apps Script)で計算処理を組み込むことで、画像としてGoogle スライドに挿入できます。
Google スライドで数式(Tex)を使う方法
GAS(Google Apps Script)で計算処理を組み込み、Google スライドで数式(Tex)を使う方法をご紹介します。手順は以下の通りです。

①画面上のメニューから「拡張機能」をクリックして、②「Apps Script」をクリックします。

「Apps Script」画面が開くので、①以下のスクリプトを入力し、②「保存」ボタンをクリックして、③「実行」をクリックします。
「ここにTex数式を入力します」と記載のある箇所に、数式を入力してください。
function insertTeXAsPNG() {
var slide = SlidesApp.getActivePresentation().getSlides()[0];
var texString = 'E = mc^2'; // ここにTeX数式を入力します
var response = UrlFetchApp.fetch('https://latex.codecogs.com/png.latex?' + encodeURIComponent(texString));
var blob = response.getBlob();
slide.insertImage(blob);
}

Google アカウントとの認証画面が表示されるので、現在ログイン中のGoogle アカウントをクリックします。

「このアプリはGoogleで確認されていません」という画面が表示されますので、「無題のプロジェクト(安全ではないページ)に移動」をクリックします。

こちらの確認画面が表示されるので、「許可」ボタンをクリックします。

スクリプトが実行されたら、操作は完了です。

Google スライドの編集画面に戻ると、数式が画像として入力されているので確認してみてください。