本文へスキップ
Skillpedia
PDF・Word・スライド7.8k · #12903

pandoc-pdf-error-diagnosis

できること

このスキルは、単に不明なエラーと出るpandocのPDFエラーを診断する手順です。MarkdownなどをPDFに変換していて、本当の原因を知る必要がある人向けです。

使う場面

  • ✓PDFへの変換中に、pandocが不明なエラーを報告するとき。
  • ✓他の形式への変換はできるが、PDFの段階だけ失敗するとき。
  • ✓このパソコンにどのPDFエンジンが入っているかを知る必要があるとき。

スキルのリンク

https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-pdf-error-diagnosis/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-pdf-error-diagnosis/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“MarkdownからPDFを作ろうとすると、pandocが不明なエラーと言います。何が悪いのか見つけて、直してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

AIは、pandocがインストールされているかを確認し、利用可能なPDFエンジンを一覧にし、選んだエンジンで変換を試しながらエラーの出力全体を保存し、その出力を読んで原因を探します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Pandoc PDF Error Diagnosis Workflow

When pandoc reports an "unknown error" during PDF conversion, follow this systematic diagnostic workflow to identify and resolve the issue.

Step 1: Verify Pandoc Installation

First, confirm pandoc is installed and check its version:

pandoc --version

This verifies pandoc is available and shows which version and features are supported.

Step 2: Check Available PDF Engines

Identify which PDF rendering engines are installed on the system:

which pdflatex xelatex lualatex wkhtmltopdf

Common engines and their characteristics:

  • pdflatex: Fast, widely available, good for simple documents
  • xelatex: Better Unicode/font support, handles modern fonts well
  • lualatex: Advanced Lua scripting, modern TeX features
  • wkhtmltopdf: HTML-to-PDF via WebKit, good for web-styled content

Step 3: Attempt Conversion with Explicit Engine

Try conversion with an explicit engine specification, starting with xelatex (most forgiving):

pandoc input.md -o output.pdf --pdf-engine=xelatex

Important: Capture the full stderr output for diagnosis:

pandoc input.md -o output.pdf --pdf-engine=xelatex 2>&1 | tee conversion.log

Step 4: Analyze Error Output

Examine the captured stderr for common issues:

Error Pattern Likely Cause Solution
xelatex not found Engine not installed Install TeX Live or try different engine
Package xyz not found Missing LaTeX package Install missing package or remove feature
Font xyz not found Missing font Install font or change document fonts
LaTeX Error: File xyz.sty not found Missing style file Install texlive-extra or simplify document

Step 5: Fallback Strategy

If the primary engine fails, try alternatives in order:

# Try pdflatex (most basic)
pandoc input.md -o output.pdf --pdf-engine=pdflatex 2>&1

# Try lualatex (if xelatex failed)
pandoc input.md -o output.pdf --pdf-engine=lualatex 2>&1

# Try wkhtmltopdf (for HTML-heavy content)
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf 2>&1

Step 6: Install Missing Dependencies (if possible)

If a specific engine is needed but missing:

# Debian/Ubuntu
sudo apt-get install texlive-xetex texlive-fonts-recommended

# macOS with Homebrew
brew install --cask mactex-no-gui

# Check what's available
tlmgr install <package-name>

Step 7: Simplify and Retry

If all engines fail, simplify the source document:

  1. Remove complex tables or math
  2. Replace custom fonts with standard fonts
  3. Split large documents into sections
  4. Convert to intermediate format first (e.g., HTML then PDF)

Quick Reference Diagnostic Script

#!/bin/bash
# pandoc-pdf-diagnose.sh

INPUT="${1:-input.md}"
OUTPUT="${2:-output.pdf}"

echo "=== Pandoc PDF Conversion Diagnosis ==="
echo "Input: $INPUT"
echo "Output: $OUTPUT"
echo ""

echo "1. Pandoc version:"
pandoc --version | head -1
echo ""

echo "2. Available engines:"
for engine in pdflatex xelatex lualatex wkhtmltopdf; do
    if which $engine > /dev/null 2>&1; then
        echo "  ✓ $engine: $(which $engine)"
    else
        echo "  ✗ $engine: not found"
    fi
done
echo ""

echo "3. Attempting conversion with xelatex:"
pandoc "$INPUT" -o "$OUTPUT" --pdf-engine=xelatex 2>&1

if [ $? -eq 0 ]; then
    echo "✓ Conversion successful!"
else
    echo "✗ Conversion failed. Try alternative engines."
fi

When to Use This Skill

  • Pandoc reports "unknown error" during PDF conversion
  • PDF output is empty or corrupted
  • Need to determine which PDF engine works best for a document
  • Troubleshooting CI/CD pipeline document generation failures
よくある質問

pandocは自分でPDFを作りますか?

いいえ。pandocはPDFファイルを作るために、外部のPDFエンジンに作業を任せるとガイドは説明しています。

最初にどのエンジンを試すべきですか?

Unicodeとフォントをよく扱うので、まずxelatexを試すようガイドは勧めています。

エラーの出力をログに保存するのはなぜですか?

ログは完全なメッセージを保つので、画面に短いエラーしか出ていなくても本当の原因が見つかるからです。

詳細

作者による元の説明

Systematic diagnostic workflow for resolving pandoc PDF conversion errors

repo: HKUDS/AgentPilot

人気

GitHubのスター
7.8k
ランキング
#12903
ライセンス
MIT
更新日
2026/11/1

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル