Multi-engine document generation with cascading PDF fallbacks and robust Unicode handling
Use this skill when document generation tasks fail or when shell_agent returns unknown errors, especially for:
.docx, .pdf, .html)Split document generation into discrete, observable steps with cascading fallbacks for PDF generation:
write_file to create source MarkdownDifferent PDF engines have different Unicode support:
| Engine | Unicode Support | Best For | Fallback Position |
|---|---|---|---|
pdflatex | Limited (ASCII-focused) | Simple documents | 1st (fastest) |
xelatex | Full Unicode | Documents with non-ASCII | 2nd |
wkhtmltopdf | Good Unicode | Web-style documents | 3rd |
reportlab (Python) | Full control | Programmatic PDFs | 4th |
fpdf2 (Python) | Full control | Simple text PDFs | 5th (last resort) |
| Character | Issue | Safe Replacement |
|---|---|---|
— (em dash) | LaTeX incompatibility | -- |
– (en dash) | LaTeX incompatibility | - |
" " (curly quotes) | Encoding errors | " " (straight) |
' ' (curly apostrophe) | Encoding errors | ' (straight) |
… (ellipsis) | May not render | ... |
→ ← ↑ ↓ | LaTeX incompatibility | -> <- ^ v |
✓ ✗ | May not render | [x] [ ] |
★ ● | May not render | * - |
© ® ™ | May require packages | (c) (r) (tm) |
é ñ ü | Font-dependent | Keep for xelatex, replace for pdflatex |
Write your document content as Markdown to a source file:
write_file