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

pandoc-unicode-sanitize

하는 일

이 스킬은 LaTeX가 처리하지 못하는 기호를 평범한 문자로 바꿔 Markdown 파일을 PDF 변환에 맞게 준비합니다. 통화 기호, 장식된 따옴표, 화살표를 쓰는 문서 작성자에게 맞습니다.

사용하는 경우

  • ✓Markdown에 유로, 파운드, 루피 같은 통화 기호가 있고 PDF가 실패할 때.
  • ✓문서에 곡선 따옴표, 화살표 또는 글머리 기호가 있어 PDF 변환이 깨지는 경우.
  • ✓PDF 변환 전에 매번 쓸 수 있는 정리 단계가 필요할 때.

스킬 링크

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

AI에게 요청하는 예시

“제 Markdown에 루피와 유로 기호, 그리고 곡선 따옴표가 있어 PDF 변환이 실패합니다. 기호를 정리하고 PDF를 만들어 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 Markdown에 일련의 텍스트 치환을 실행해 기호를 Rs나 EUR 같은 평범한 텍스트로 바꾸고, 정리된 파일을 pandoc으로 변환합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Pandoc Unicode Sanitization for PDF Conversion

Problem

LaTeX (used by pandoc for PDF output) may fail or produce errors when encountering non-ASCII Unicode characters like currency symbols (₹, €, £), special quotes, or other Unicode characters not supported by the default LaTeX engine.

Solution

Pre-process Markdown files to replace problematic Unicode characters with ASCII equivalents before running pandoc PDF conversion.

Steps

1. Identify Problematic Characters

Common problematic characters include:

  • Currency symbols: ₹, €, £, ¥
  • Special quotes: " " ' '
  • Arrows: →, ←, ↑, ↓
  • Bullets: •, ◦
  • Other symbols: ©, ®, ™, ±, ×, ÷, —, –

2. Create a Sed Substitution Script

Create a shell script for reusable sanitization:

#!/bin/bash
# sanitize-for-pdf.sh

sed -e 's/₹/Rs/g' \
    -e 's/€/EUR/g' \
    -e 's/£/GBP/g' \
    -e 's/¥/JPY/g' \
    -e 's/"/"/g' \
    -e 's/"/"/g' \
    -e "s/'/'/g" \
    -e "s/'/'/g" \
    -e 's/→/->/g' \
    -e 's/←/<-/g' \
    -e 's/•/-/g' \
    -e 's/©/(c)/g' \
    -e 's/®/(R)/g' \
    -e 's/™/(TM)/g' \
    -e 's/±/+/ -/g' \
    -e 's/×/x/g' \
    -e 's/÷/\//g' \
    -e 's/—/--/g' \
    -e 's/–/-/g' \
    "$1"

3. Run Sanitization Before Pandoc

# Using the script
./sanitize-for-pdf.sh input.md > sanitized.md
pandoc sanitized.md -o output.pdf

# Or inline
cat input.md | sed 's/₹/Rs/g; s/€/EUR/g; s/£/GBP/g' | pandoc -o output.pdf

4. Alternative: Use iconv for Automatic Transliteration

For broader Unicode coverage:

iconv -f UTF-8 -t ASCII//TRANSLIT < input.md > sanitized.md
pandoc sanitized.md -o output.pdf

5. Alternative: Use XeLaTeX or LuaLaTeX Engine

If you want to preserve Unicode characters, use a Unicode-capable engine:

pandoc input.md -o output.pdf --pdf-engine=xelatex
# or
pandoc input.md -o output.pdf --pdf-engine=lualatex

Best Practices

  • Sanitize files before conversion rather than debugging LaTeX errors after
  • Keep a mapping of your organization's common symbols and preferred replacements
  • Test with a small sample before processing large documents
  • Consider using XeLaTeX/LuaLaTeX if Unicode preservation is required
  • Document which characters cause issues in your specific environment

Common Error Signs

Look for these LaTeX errors that indicate Unicode issues:

  • Package inputenc Error: Unicode character ... not set up
  • LaTeX Error: Unicode character ... cannot be used with pdflatex
  • Missing or garbled characters in the output PDF
자주 묻는 질문

어떤 기호가 바뀌나요?

가이드는 통화 기호, 곡선 따옴표, 화살표, 글머리 기호, 저작권 표시, 대시를 나열합니다.

원본 파일이 바뀌나요?

가이드는 정리된 텍스트를 새 파일에 쓰므로 원본은 그대로 남습니다.

정리 작업을 재사용할 수 있나요?

네, 가이드는 치환 항목을 작은 셸 스크립트에 저장하라고 제안합니다.

상세 정보

작성자의 원본 설명

Pre-process Markdown to replace non-ASCII characters before pandoc PDF conversion

repo: HKUDS/AgentPilot

인기도

GitHub 스타
7.8k
순위
#12906
라이선스
MIT
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬