pdf-engine-fallback
하는 일
이 스킬은 기본 엔진이 실패할 때 pandoc PDF 생성을 다른 엔진으로 다시 시도하는 계획입니다. 악센트나 라틴 문자가 아닌 글자가 있는 문서, 또는 자동화된 파이프라인에서 PDF를 만드는 사람에게 맞습니다.
사용하는 경우
- ✓pandoc PDF 생성이 오류와 함께 실패할 때.
- ✓문서에 악센트 글자나 라틴 문자가 아닌 글자 같은 특수한 텍스트가 있는 경우.
- ✓서로 다른 설정의 컴퓨터에서 문서 파이프라인으로 PDF를 만들어야 할 때.
스킬 링크
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pdf-engine-fallback/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 문서에 악센트 글자와 중국어가 있어서 pandoc이 PDF를 만들지 못합니다. 설치된 엔진을 확인하고, 이런 문자를 다룰 수 있는 엔진으로 다시 시도해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
AI는 먼저 기본 변환을 시도하고, 실패하면 설치된 PDF 엔진을 확인한 뒤, 내용에 맞는 엔진으로 다시 시도합니다. 유니코드에는 xelatex, 웹 스타일 레이아웃에는 wkhtmltopdf를 씁니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
PDF Engine Fallback
This skill provides a diagnostic-retry workflow for PDF generation when Pandoc's default PDF engine fails. It systematically checks available engines and retries with alternatives optimized for different content types (e.g., xelatex for Unicode).
When to Use
- Pandoc PDF generation fails with errors
- Document contains non-ASCII characters (Unicode, CJK, etc.)
- Need robust PDF generation across different system configurations
- Working in CI/CD or automated document pipelines
Steps
1. Attempt Initial PDF Generation
First, try generating with pandoc's default engine:
pandoc input.md -o output.pdf
2. Diagnose on Failure
If the initial attempt fails, check which PDF engines are available:
# Check for pdflatex
which pdflatex && echo "pdflatex: available" || echo "pdflatex: not found"
# Check for xelatex (better Unicode support)
which xelatex && echo "xelatex: available" || echo "xelatex: not found"
# Check for wkhtmltopdf (HTML-based rendering)
which wkhtmltopdf && echo "wkhtmltopdf: available" || echo "wkhtmltopdf: not found"
3. Retry with Alternative Engine
Based on available engines and document content, retry with an appropriate engine:
# For documents with Unicode/special characters - prefer xelatex
pandoc input.md -o output.pdf --pdf-engine=xelatex
# Alternative: use pdflatex for simple Latin documents
pandoc input.md -o output.pdf --pdf-engine=pdflatex
# For HTML-heavy content or complex layouts
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf
4. Handle Missing Engines
If no PDF engines are available, install one:
# Ubuntu/Debian - install texlive with xelatex
sudo apt-get install texlive-xetex
# Or install minimal teTeX
sudo apt-get install texlive-latex-base texlive-latex-extra
# macOS with Homebrew
brew install basictex
Complete Fallback Script
#!/bin/bash
# pdf-fallback.sh - Robust PDF generation with engine fallback
INPUT_FILE="${1:-input.md}"
OUTPUT_FILE="${2:-output.pdf}"
echo "Attempting PDF generation: $INPUT_FILE -> $OUTPUT_FILE"
# Try default engine first
if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" 2>/dev/null; then
echo "SUCCESS: PDF generated with default engine"
exit 0
fi
echo "Default engine failed. Checking available engines..."
# Check and try engines in priority order
if command -v xelatex &>/dev/null; then
echo "Retrying with xelatex (Unicode support)..."
if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=xelatex; then
echo "SUCCESS: PDF generated with xelatex"
exit 0
fi
fi
if command -v pdflatex &>/dev/null; then
echo "Retrying with pdflatex..."
if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=pdflatex; then
echo "SUCCESS: PDF generated with pdflatex"
exit 0
fi
fi
if command -v wkhtmltopdf &>/dev/null; then
echo "Retrying with wkhtmltopdf..."
if pandoc "$INPUT_FILE" -o "$OUTPUT_FILE" --pdf-engine=wkhtmltopdf; then
echo "SUCCESS: PDF generated with wkhtmltopdf"
exit 0
fi
fi
echo "FAILURE: No available PDF engine succeeded"
echo "Install a PDF engine (texlive-xetex recommended) and retry"
exit 1
Usage
# Make executable
chmod +x pdf-fallback.sh
# Run with defaults (input.md -> output.pdf)
./pdf-fallback.sh
# Run with custom files
./pdf-fallback.sh report.md report.pdf
Engine Selection Guide
| Engine | Best For | Unicode | Speed |
|---|---|---|---|
| xelatex | Non-Latin scripts, modern fonts | Excellent | Moderate |
| pdflatex | Simple Latin documents | Limited | Fast |
| wkhtmltopdf | HTML/CSS styling | Good | Fast |
Troubleshooting
- Font errors: Install required fonts or use xelatex with system fonts
- Package errors: Install missing LaTeX packages via
tlmgr - Large documents: Try pdflatex for speed, xelatex for compatibility
- Citation issues: Ensure pandoc-citeproc or citeproc is installed
자주 묻는 질문
유니코드에 xelatex를 쓰는 이유는 무엇인가요?
가이드는 xelatex가 완전한 유니코드 지원을 갖춰 악센트와 라틴 문자가 아닌 글자에 맞는다고 말합니다.
엔진은 어떻게 확인하나요?
AI는 각 엔진마다 which 명령을 실행해 설치 여부를 확인합니다.
pdflatex는 언제 쓰나요?
가이드는 일반 라틴 문자로 된 간단한 문서에 pdflatex를 추천합니다.
상세 정보
인기도
- GitHub 스타
- 7.8k
- 순위
- #12920
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
agentpilot
7.8k작업을 준비하고 AgentPilot 루프를 실행해 변경을 제안, 테스트, 점수화하면서 프로젝트를 단계적으로 개선하도록 돕습니다.
openspace
7.8k에이전트 스킬을 저장하고 가져오는 도구인 OpenSpace를 설정하고, MCP를 통해 AI 앱에 연결하도록 돕습니다.
rsi-arena
7.8kAIME나 Terminal-Bench 같은 표준 AI 벤치마크 테스트를 설정하고 실행해 서로 다른 개선 방법을 비교하도록 돕습니다.
experiment-guide
7.8k프로그램을 개선하는 방법을 조사하면서 작은 실험을 계획하고, 결과를 읽고, 발견 사항을 기록하도록 돕습니다.
비슷한 스킬
feishu-doc
394k에이전트가 문서 도구를 사용해 텍스트, 이미지, 표를 포함한 Feishu 클라우드 문서를 읽고, 만들고, 편집하도록 돕습니다.
feishu-drive
394k에이전트가 봇과 공유된 Feishu 클라우드 폴더의 파일을 찾아보고, 정리하고, 댓글을 달도록 돕습니다.
feishu-perm
394k에이전트가 요청을 충족하는 가장 작은 권한을 골라, Feishu 파일에 누가 접근할 수 있는지 확인하고 바꾸도록 돕습니다.