LoginSignup
19
21

More than 5 years have passed since last update.

org-mode でプレゼンのスライドを作る

Last updated at Posted at 2015-12-08

org-mode でプレゼンのスライドを作る。HTMLスライドの中でも reveal.js が良さそう。自分の会社のブラウザはモダンじゃないものばかりだけど、PDFにも対応しているので問題無い。また会社のPCはWindowsなので、その対応も含めている。

ox-reveal を使用して実現してみた。

準備

プレゼンライブラリの reveal.js と org-mode ファイルを reveal.js 形式にする ox-reveal を用意する。

reveal.js のダウンロード

公式ページ、あるいはGithubのページからライブラリ一式をダウンロード。

ox-reveal のインストール

M-x package-install ox-reveal

init.el に追加

;; ox-reveal の読み込み
(load-library "ox-reveal")

ox-reveal 使用方法

reveal.jsディレクトリは書き出し先に配置してある必要が有る。
org-mode ファイルを開いた状態で

  • C-c C-e R R でプレゼンファイル書き出し
  • C-c C-e R B でプレゼンファイル書き出して開く

...と思いきや C-c C-e R B が効かない。
ファイルの書き出しはされるが、開くタイミングで下記のエラーが発生している。
browse-url-default-windows-browser: ShellExecute failed: 指定されたファイルが見つかりません。

どうやら ./hoge.html というパスで開こうとしていて、
会社のWindows では ./ の解釈が出来ない様子。

ox-reveal (on Windows) 問題点

  • Windows でもC-c C-e R B を動作させたい
  • reveal.js ディレクトリをいちいち配置するのが結構面倒

ox-reveal にモンキーパッチ

(setq my-reveal-src-dir "/path/to/reveal.js-dir")

;; Windows だと C-c C-e R B でファイルを開くのに失敗するので,修正モンキーパッチ
;; ついでにエクスポート先に reveal.js ディレクトリが無ければ、ソースディレクトリからコピーする処理を追加
(defun org-reveal-export-to-html-and-browse
  (&optional async subtreep visible-only body-only ext-plist)
  "Export current buffer to a reveal.js and browse HTML file."
  (interactive)
  (let ((reveal-src-dir my-reveal-src-dir)
        (export-dir (file-name-directory buffer-file-name))
        (export-file (org-reveal-export-to-html async subtreep visible-only body-only ext-plist)))
    (unless (file-directory-p (concat export-dir "reveal.js"))
      (copy-directory reveal-src-dir export-dir))
    (browse-url-of-file (expand-file-name export-file))))

まとめ

Windowsで開くようになったし、いちいちreveal.jsの配置を意識しなくても良くなった。
これでプレゼン資料が捗る。
快適。

19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21