目的
pandoc で markdown から PDF ファイルを出力する検証をしたかっただけなのですが、
環境構築が結構手間だったので備忘のため記録します。
環境
- Windows 10 64bit
Chocolately インストール
パッケージ管理の Chocolately をインストール、管理者権限で PowerShell を起動
必要に応じてプロキシ設定
認証proxyを使う環境設定(PowerShell) - Qiita
> Set-ExecutionPolicy RemoteSigned
> set ChocolateyInstall=C:\ProgramData\chocolatey
> Invoke-Expression ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
> choco list -lo
Chocolatey v0.10.3
pandoc インストール
引き続きPowerSehll からインストール。インストール後に pandoc コマンドを認識しなかったら、PowerShell を起動しなおす。
> cinst pandoc
> pandoc -v
pandoc.exe 2.0
Compiled with pandoc-types 1.17.0.4, texmath 0.9, skylighting 0.1.1.4
Default user data directory: C:\Users\saitotak\AppData\Roaming\pandoc
Copyright (C) 2006-2016 John MacFarlane
Web: http://pandoc.org
This is free software; see the source for copying conditions.
There is no warranty, not even for merchantability or fitness
for a particular purpose.
TeX インストール
TeXのインストールと設定めんどくさすぎる。
プロキシの都合で TeXインストーラ 3 がうまくいかなかったので、
ISO フィアルをダウンロード(texlive2017.iso)
Daemon Tools Lite にマウントしてインストール
Powershell を立ち上げなおして確認
> tex -v
TeX 3.14159265 (TeX Live 2017/W32TeX)
kpathsea version 6.2.3
Copyright 2017 D.E. Knuth.
There is NO warranty. Redistribution of this software is
covered by the terms of both the TeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the TeX source.
Primary author of TeX: D.E. Knuth.
変換
UTF-8 の Markdown テキスト(日本語含むもの)を用意
# ほげ
- FUGA
- ピヨ
日本語を PDF 変換するため、h-luatexja.tex というファイルを同フォルダに用意
\usepackage{luatexja}
\hypersetup{unicode=true}
変換
pandoc .\SAMPLE.md -o .\SAMPLE.pdf --latex-engine=lualatex -H .\h-luatexja.tex
できた
TeX つらい。
参考
markdownで書いた文書をbeamerに変換するときのメモ · GitHub
多様なフォーマットに対応!ドキュメント変換ツールPandocを知ろう - Qiita
markdownの原稿を、pandocを使って、Texのbeamerを利用して、プレゼンスライドPDFに変換 - Qiita
認証proxyを使う環境設定(PowerShell) - Qiita
Pandocの比較的簡単なインストール方法 - Qiita