본문으로 건너뛰기
Skillpedia
PDF, Word, 슬라이드7.8k · #12907

pandoc-unicode-workaround

하는 일

이 스킬은 특수 문자 때문에 pandoc이 실패할 때 Markdown을 PDF로 바꾸는 절차를 설명합니다. 문서에 체크 표시, 화살표, 대시 같은 기호가 있는 사람에게 맞습니다.

사용하는 경우

  • ✓유니코드나 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가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/HKUDS/AgentPilot/blob/main/openspace/benchmarks/gdpval/skills/pandoc-unicode-workaround/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

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.pdf fails 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:

  1. Use a different PDF engine:

    pandoc input.md -o output.pdf --pdf-engine=wkhtmltopdf
    
  2. Use XeLaTeX (better Unicode support):

    pandoc input.md -o output.pdf --pdf-engine=xelatex
    
  3. Add LaTeX packages for Unicode:

    pandoc input.md -o output.pdf -H header.tex
    

    Where 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.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬