Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Last active February 15, 2020 03:48
Show Gist options
  • Save bouzuya/5989695 to your computer and use it in GitHub Desktop.
Save bouzuya/5989695 to your computer and use it in GitHub Desktop.
Pandoc で Markdown から PDF へ変換
%\usepackage{luatexja}
\setmainfont{TakaoPMincho}
\setsansfont{TakaoPGothic}
\setmonofont{TakaoGothic}

% Pandoc で Markdown から PDF へ変換

はじまりの選択

はじまり

  • テキストとバイナリのふたりに告白されました
  • あなたはどちらと付き合いますか?

続きを読むべきか

  • あなたがテキストを選ぶなら、続きをどうぞ

テキストを選んだあなたは

テキストを選んだあなたは、きっと

  • PowerPoint や Impress にうんざりしている
  • テキストでプレゼンテーションの資料を作りたい
  • ぼくもそう、あなたもそう

Pandoc を試す

  • テキストでプレゼンテーション資料を作るため Pandoc を試す

Pandoc って何?

Pandoc とは

  • Pandoc はドキュメントを変換するソフトウェア

対応形式は

  • 入力例: Markdown / textile/ reStructuredText / HTML / LaTeX ...
  • 出力例: Markdown / HTML / LaTeX / docx / opt / PDF ...

今回は

  • Markdown から PDF (プレゼンテーション) へ変換

Pandoc で Markdown → PDF 変換するには

Pandoc は LaTeX Beamer を使う

  • Pandoc は LaTeX を使って PDF へ変換
  • 変換フォーマット (-T) に Beamer を指定

LaTeX Beamer とは

インストール

Ubuntu 13.04 の場合は apt-get で

  • インストールのためのコマンド

    $ apt-get install pandoc texlive-xetex latex-beamer

  • ぼくの Ubuntu 13.04 環境でこれで動作したけど、余計なものがあるかも...

コマンド例

$ pandoc --latex-engine=xelatex \
         -H header.tex \
         -f markdown -t beamer \
         -o out.pdf \
         in.markdown

オプションの説明

  • --latex-engine : 日本語対応のため LaTeX のかわりに XeLaTex を使う
  • -H : include-in-header 日本語対応のためフォントを指定
  • -f : from 元フォーマット
  • -t : to 先フォーマット
  • -o : 出力先ファイル名

結果は

詳細

結果

  • このプレゼンテーション資料ですよ
    • 説明めんどくさい

その他

  • 画像も使える

  • テーマ変更を試してみたい

  • Pandoc Markdown をやめたい

    • まあそのうちに

おしまい

またね

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment