Closed3

WSL2でpandoc(md -> pdf)

11-1010-10011-1010-100

インストール

apt installでは古いバージョンがくるので、githubからダウンロードしてインストールする

https://github.com/jgm/pandoc/releases

Debianベースの場合
wget <最新のリンク>.deb
sudo dpkg -i pandoc-2.9-1-amd64.deb
11-1010-10011-1010-100

そのままだとPDF変換できない

Error producing PDF.
! LaTeX Error: Missing \begin{document}.
Error producing PDF.
! LaTeX Error: File `ltjsarticle.cls' not found.

LuaLaTexを経由しないといけないので、LuaLaTexを入れる

必要ライブラリを入れる

sudo apt update
sudo apt install texlive-lang-japanese texlive-luatex texlive-latex-extra texlive-latex-recommended

https://qiita.com/YuH25/items/76f056bf691855e420e0

11-1010-10011-1010-100

変換

pandoc \
    --standalone \
    --output=out.pdf \
    --pdf-engine=lualatex \
    -V documentclass=bxjsarticle \
    -V classoption=pandoc \
    ./yourdocument.md
このスクラップは2023/11/27にクローズされました