pandoc-unicode-workaround
できること
このスキルは、特殊な文字でpandocが失敗するときに、MarkdownをPDFに変換する手順を説明します。チェックマーク、矢印、ダッシュなどの記号を含む文書の人向けです。
使う場面
- ✓UnicodeやLaTeXのエラーで、pandocのPDF作成が失敗するとき。
- ✓エラーがチェックマーク、矢印、エムダッシュなどの特殊な文字を名指ししているとき。
- ✓PDFが必要で、記号のプレーンテキストの版でもよいとき。
スキルのリンク
https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-unicode-workaround/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“メモにあるチェックマークと矢印のせいで、PDFの書き出しが失敗します。プレーンテキストに置き換えて、PDFをもう一度作ってください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
AIは、まず通常のpandocのコマンドで変換を試し、失敗した場合にだけ、表にあるASCIIの同等のもので特殊な文字を置き換えてから、もう一度変換します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Pandoc Unicode Workaround
This skill provides a workflow for generating PDFs from Markdown using pandoc when LaTeX compilation fails due to Unicode character errors.
When to Use
Use this skill when:
pandoc document.md -o document.pdffails with LaTeX/Unicode errors- Error messages mention "Unicode character", "LaTeX Error", or specific characters like ✓, →, —, etc.
- You need to produce PDF output but pandoc's default LaTeX engine cannot handle special characters
Step-by-Step Procedure
Step 1: Attempt Initial PDF Generation
pandoc input.md -o output.pdf
If this succeeds, you're done. If it fails with Unicode/LaTeX errors, proceed to Step 2.
Step 2: Normalize Unicode Characters
Replace problematic Unicode characters with ASCII equivalents. Common replacements:
| Unicode Character | ASCII Replacement | Alternative |
|---|---|---|
| ✓ (checkmark) | [Y] or [X] | OK, ✓ removed |
| ✗ or ✘ (cross) | [N] | FAIL |
| → (arrow right) | -> | => |
| ← (arrow left) | <- | |
| — (em dash) | -- or - | --- |
| – (en dash) | - | |
| • (bullet) | - | * |
| © (copyright) | (c) | Copyright |
| ® (registered) | (R) | |
| ™ (trademark) | (TM) | |
| … (ellipsis) | ... | |
| " (smart quotes) | " or ' |
Step 3: Apply Replacements
Option A - Manual edit: Open the Markdown file and manually replace the characters using find/replace.
Option B - Automated with sed (Linux/Mac):
sed -i 's/✓/[Y]/g' input.md
sed -i 's/✗/[N]/g' input.md
sed -i 's/→/->/g' input.md
sed -i 's/—/--/g' input.md
Option C - Automated with Python:
replacements = {
'✓': '[Y]',
'✗': '[N]',
'→': '->',
'—': '--',
'–': '-',
'…': '...',
'"': '"',
'"': '"',
}
with open('input.md', 'r', encoding='utf-8') as f:
content = f.read()
for orig, repl in replacements.items():
content = content.replace(orig, repl)
with open('input.md', 'w', encoding='utf-8') as f:
f.write(content)
Step 4: Regenerate PDF
pandoc input.md -o output.pdf
Step 5: Verify Output
Check that the PDF was generated successfully and review the content to ensure character replacements are acceptable for your use case.
Alternative Approaches
If Unicode normalization is not acceptable:
Use a different PDF engine:
pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdfUse XeLaTeX (better Unicode support):
pandoc input.md -o output.pdf --pdf-engine=xelatexAdd LaTeX packages for Unicode:
pandoc input.md -o output.pdf -H header.texWhere header.tex contains:
\usepackage{fontspec} \usepackage{xunicode}
Tips
- Keep the original Markdown file before normalization if you need to preserve characters
- Document which characters were replaced for future reference
- Test with a small sample first if working with large documents
- For Word documents (.docx), Unicode issues are less common; this pattern is primarily for PDF generation
Error Indicators
Common LaTeX Unicode errors to watch for:
- ! LaTeX Error: Unicode character ... not set up for use with LaTeX
- Package inputenc Error: Unicode character ... not set up
- ! Missing character: There is no ... in font ...
よくある質問
まず通常の変換を試しますか?
はい。ガイドは、通常のpandocのコマンドから始め、失敗したときだけ文字を整えるよう述べています。
チェックマークは何に置き換えますか?
かっこ付きのYやXなどのプレーンな印を勧めるとガイドは述べています。
置き換えの一覧はありますか?
はい。ガイドには、各記号を平易な代替に対応づける表が含まれています。
詳細
作者による元の説明
Handle LaTeX Unicode errors in pandoc PDF generation by normalizing special characters to ASCII
repo: HKUDS/AgentPilot
人気
- GitHubのスター
- 7.8k
- ランキング
- #12907
- ライセンス
- MIT
- 更新日
- 2026/11/1
コメント
- …
このリポジトリの他のスキル
agentpilot
7.8kエージェントが、作業を準備し、変更案を提案してテストし、評価するAgentPilotのループを実行することで、プロジェクトを段階的に改善できるよう支援します。
openspace
7.8kエージェントが、スキルを保存し取り出すツールであるOpenSpaceをセットアップし、MCPを通じてAIアプリに接続できるよう支援します。
rsi-arena
7.8kエージェントが、AIMEやTerminal-Benchなどの標準的なAIベンチマークテストをセットアップして実行し、異なる改善方法を比較できるよう支援します。
experiment-guide
7.8kエージェントが、プログラムを改善する方法を調べる間に、小さな実験を計画し、その結果を読み、発見を記録できるよう支援します。
似ているスキル
feishu-doc
394kテキスト、画像、表を含むFeishuのクラウドドキュメントを、ドキュメントツールを使って読み、作成し、編集するようエージェントを支援します。
feishu-drive
394kボットと共有されたFeishuのクラウドフォルダ内のファイルを閲覧、整理、コメントできるようエージェントを支援します。
feishu-perm
394kFeishuのファイルにアクセスできる人を確認し、変更するようエージェントを支援します。依頼を満たす最小の権限を選びます。