LoginSignup
3
3

More than 5 years have passed since last update.

pandoc使い方まとめ

Last updated at Posted at 2019-01-31

概要

pandocの使い方をまとめる。

Install pandoc

Ubuntu

ちょっと古いけど標準のapt-repositoryでインストール可能。

sudo apt install pandoc

Windows

  1. オフィシャルサイトからzipファイルをダウンロード
  2. 環境変数のPATHにpandocディレクトリを追加

Install LaTeX

pandocでpdf出力するにはLaTeXが必要だが、めんどすぎて諦めるべき。

Usage

基本的にはコマンドラインベース。昨今流行りのconfig.jsonはないらしい。

HTML

Generate Template

以下のコマンドでHTML5のテンプレートを作成する。

pandoc -D html5 > html5_template.html

by https://qiita.com/TEVASAKI/items/c97815f5fb6542bbeb2c

PDF

PDFはLaTeXがないと生成できない。しかも日本語だとLuaLaTeXとかいろんな縛りがある。残念!

Word

wordは比較的簡単に作れるが

Generate Template

以下のコマンドでWordのテンプレートを作成する。

pandoc --print-default-data-file reference.docx > reference.docx

by http://www.minimalab.com/blog/2016/08/16/convert-md-to-docx/

Customize Template

Wordのテンプレートをカスタマイズする。公式サイトによると、

For best results, do not make changes to this file other than modifying the styles used by pandoc: [paragraph] Normal, Body Text, First Paragraph, Compact, Title, Subtitle, Author, Date, Abstract, Bibliography, Heading 1, Heading 2, Heading 3, Heading 4, Heading 5, Heading 6, Heading 7, Heading 8, Heading 9, Block Text, Footnote Text, Definition Term, Definition, Caption, Table Caption, Image Caption, Figure, Captioned Figure, TOC Heading; [character] Default Paragraph Font, Body Text Char, Verbatim Char, Footnote Reference, Hyperlink; [table] Table.

by https://pandoc.org/MANUAL.html

とのこと。いじり過ぎたらダメダメ。変えていいのは以下。

  • [段落]
    • 標準
    • 本文
    • 最初の段落
    • コンパクト
    • タイトル、サブタイトル
    • 著者
    • 日付
    • アブストラクト
    • 参考文献
    • 見出し1、見出し2 、見出し3、見出し4、見出し5、見出し6、見出し7、見出し8、見出し9
    • ブロックテキスト
    • 脚注テキスト
    • 定義用語
    • 定義
    • キャプション、表キャプション、図表キャプション、図、キャプション図
    • 目次見出し
  • [文字]
    • デフォルト段落フォント
    • 本文文字
    • 逐語文字
    • 脚注参照
    • ハイパーリンク
  • [表]

Generate docx

pandoc new.md --reference-doc=reference.docx -s -o --toc --highlight-style=tango temp.docx

by http://www.minimalab.com/blog/2016/08/16/convert-md-to-docx/

3
3
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
3
3