pandoc-pdf-error-recovery
它能做什么
这项技能是针对 pandoc PDF 转换失败(提示模糊)的分步恢复方案。适合需要生成 PDF 却无法让 pandoc 完成转换的人。
适用场景
- ✓当 pandoc 生成 PDF 失败、且只给出模糊提示时。
- ✓当电脑上没有安装 pandoc 或找不到它时。
- ✓当我想用指定的引擎(例如 xelatex)生成 PDF 时。
技能链接
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-pdf-error-recovery/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我:我的 pandoc PDF 转换失败,只提示模糊的错误。请逐步带我恢复,并得到一个可用的 PDF。”
每周 5 个新技能,1 分钟读完。
工作原理
AI 确认 pandoc 已安装,查找哪些 PDF 引擎可用,记录全部输出的同时用 xelatex 重试,然后根据日志决定下一步修复。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Pandoc PDF Error Recovery
Overview
When pandoc fails to convert documents to PDF with an "unknown error" or similar vague message, follow this systematic diagnostic and recovery workflow.
Step-by-Step Procedure
1. Verify Pandoc Installation
First confirm pandoc is installed and accessible:
pandoc --version
If this fails, install pandoc before proceeding:
- macOS:
brew install pandoc - Linux:
sudo apt-get install pandocorsudo yum install pandoc - Windows: Download from https://pandoc.org/installing.html
2. Check Available PDF Engines
Identify which PDF rendering engines are available on the system:
which pdflatex xelatex lualatex wkhtmltopdf context
Common engines and their typical use cases:
- pdflatex: Standard LaTeX, fast but limited Unicode support
- xelatex: Full Unicode support, recommended for most modern documents
- lualatex: Lua scripting support, good for complex layouts
- wkhtmltopdf: HTML/CSS rendering, good for web-style documents
- context: ConTeXt typesetting system
3. Attempt Conversion with Explicit Engine
Try conversion with xelatex first (most versatile for general documents):
pandoc input.md -o output.pdf --pdf-engine=xelatex 2>&1 | tee conversion.log
The 2>&1 | tee pattern captures both stdout and stderr to a log file for analysis.
4. Analyze Error Output
If conversion fails, examine the captured log:
cat conversion.log
Common error patterns and solutions:
- Missing LaTeX packages: Install with
tlmgr install <package>or system package manager - Font issues: Specify fonts with
-V mainfont="Font Name" - Missing engine: Fall back to available engine (go to Step 5)
5. Try Alternative Engines
Systematically try other available engines:
# Fallback to pdflatex
pandoc input.md -o output.pdf --pdf-engine=pdflatex 2>&1 | tee conversion-pdflatex.log
# Or try wkhtmltopdf for HTML-rich content
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf 2>&1 | tee conversion-wkhtmltopdf.log
# Or try lualatex for complex documents
pandoc input.md -o output.pdf --pdf-engine=lualatex 2>&1 | tee conversion-lualatex.log
6. Install Missing Dependencies
If all engines fail or are missing, install required packages:
# Full TeX Live installation (comprehensive but large)
sudo apt-get install texlive-full
# Or minimal installation with common packages
sudo apt-get install texlive-latex-base texlive-fonts-recommended
# For xelatex font support
sudo apt-get install fonts-noto fonts-dejavu
7. Simplify and Retry
If errors persist, try conversion with minimal options:
pandoc input.md -o output.pdf --pdf-engine=xelatex --standalone
Remove complex formatting, custom headers, or advanced LaTeX features that may be causing issues.
Quick Reference Command
Complete diagnostic one-liner:
pandoc --version && which pdflatex xelatex wkhtmltopdf && pandoc input.md -o output.pdf --pdf-engine=xelatex -v
Tips
- Always capture stderr (
2>&1) to see the actual error message - Use
-v(verbose) flag for more detailed output during troubleshooting - For non-English documents, xelatex or lualatex are usually required
- HTML/CSS-heavy documents may work better with wkhtmltopdf
- Check system disk space - PDF generation can require significant temporary space
常见问题
pandoc 怎样安装?
指南列出了 macOS 下使用 brew、Linux 下使用 apt 或 yum 的安装命令,以及 Windows 的下载链接。
指南列出了哪些 PDF 引擎?
指南列出了 pdflatex、xelatex、lualatex、wkhtmltopdf 和 ConTeXt。
日志文件有什么用?
它保存完整的输出,便于找出失败的步骤。
详情
作者的原始描述
Systematic approach to diagnose and recover from pandoc PDF conversion unknown errors
repo: HKUDS/AgentPilot
热度
- GitHub 星标
- 7.8k
- 排名
- #12904
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
agentpilot
7.8k帮你的智能体准备任务并运行 AgentPilot 循环,逐步改进项目:循环会提出修改、测试修改并为其打分。
openspace
7.8k帮你的智能体设置 OpenSpace,这是一个用于存储和获取智能体技能的工具,并通过 MCP 将其连接到你的 AI 应用。
rsi-arena
7.8k帮你的智能体设置并运行标准 AI 基准测试,例如 AIME 和 Terminal-Bench,用来比较不同的改进方法。
experiment-guide
7.8k帮你的智能体规划小型实验、阅读实验结果并记录发现,同时研究如何改进一个程序。