Generates professional PDFs from Markdown using Pandoc/XeLaTeX with auto-sectioning, TOC, bibliography, and a universal build script. Ideal for automated document generation.
Ships in doc-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Self-Evolving Skill: This skill improves through use. If instructions are wrong, parameters drifted, or a workaround was needed — fix this file immediately, don't defer. Only update for real, reproducible issues.
Generate professional PDF documents from Markdown using Pandoc with the XeLaTeX engine. This skill covers automatic section numbering, table of contents, bibliography management, LaTeX customization, and common troubleshooting patterns learned through production use.
Use this skill when:
This skill provides production-proven assets in $(cc-plugin-root doc-tools)/skills/pandoc-pdf-generation/assets/:
table-spacing-template.tex - Production-tuned LaTeX preamble (booktabs, colortbl, ToC fixes)build-pdf.sh - Universal auto-detecting build script/usr/bin/env bash << 'DETECT_EOF'
# Create symlink once per project (git-friendly)
ln -s "$(cc-plugin-root doc-tools)/skills/pandoc-pdf-generation/assets/build-pdf.sh" build-pdf.sh
# Auto-detect single .md file in directory (landscape default)
./build-pdf.sh
# Portrait mode
./build-pdf.sh --portrait document.md
# Monospace font for ASCII diagrams
./build-pdf.sh --monospace diagrams.md
# Explicit input/output
./build-pdf.sh input.md output.pdf
DETECT_EOF
Options:
| Flag | Description |
|---|---|
--landscape | Landscape orientation (default) |
--portrait | Portrait orientation |
--monospace | Use DejaVu Sans Mono - ideal for ASCII diagrams |
--hide-details | Hide <details> blocks from PDF |
-h, --help | Show help message |
Features:
references.bib) and CSL files<details> blocks from PDF outputFor landscape PDFs with blue hyperlinks (no build-pdf.sh dependency):
pandoc file.md -o file.pdf \
--pdf-engine=xelatex \
-V geometry:a4paper,landscape \
-V geometry:margin=1in \
-V fontsize=11pt \
-V mainfont="DejaVu Sans" \
-V colorlinks=true \
-V linkcolor=blue \
-V urlcolor=blue \
--toc --toc-depth=2 \
--number-sections
Use landscape for: Wide data tables, comparison matrices, technical docs with code blocks.
/usr/bin/env bash << 'SKILL_SCRIPT_EOF'
pandoc document.md \
-o document.pdf \
--pdf-engine=xelatex \
--toc \
--toc-depth=3 \
--number-sections \
-V geometry:margin=1in \
-V mainfont="DejaVu Sans" \
-H "$(cc-plugin-root doc-tools)/skills/pandoc-pdf-generation/assets/table-spacing-template.tex"
SKILL_SCRIPT_EOF
ASCII diagrams need consistent character alignment to survive PDF rendering: use box-drawing characters consistently and keep every row the same width.
Also important: Keep annotations OUTSIDE code blocks. Don't add inline comments like # contains: file1, file2 inside diagram code blocks - they break alignment.
Use --hide-details to remove <details> blocks from PDF output. This is useful when:
<details> tags don't render as collapsible in PDFUsage:
./build-pdf.sh --hide-details document.md
Markdown pattern:
## My Section
```diagram
┌─────┐ ┌─────┐
│ Box │ ──> │ Box │
└─────┘ └─────┘
```
[Box] -> [Box]
With --hide-details, the entire <details> block is stripped from PDF output while remaining visible in markdown/HTML.
Before considering a PDF "done", verify:
Pre-Generation:
--number-sections)Post-Generation:
Pre-Print:
Always let the user review the PDF before printing.
Open for review:
open output.pdf
Print one-sided (simplex):
lpr -P "PRINTER_NAME" -o Duplex=None output.pdf
Print two-sided (duplex):
lpr -P "PRINTER_NAME" -o Duplex=DuplexNoTumble output.pdf # Long-edge binding
lpr -P "PRINTER_NAME" -o Duplex=DuplexTumble output.pdf # Short-edge binding
Find printer name:
lpstat -p -d
Never print without user approval - this wastes paper if issues exist.
For detailed information, see:
| Issue | Cause | Solution |
|---|---|---|
| Font not found | DejaVu Sans not installed | brew install font-dejavu |
| xelatex not found | MacTeX not installed | brew install --cask mactex |
| Table breaks across pages | Missing longtable package | Include table-spacing-template.tex preamble |
| Double section numbers | Manual numbering in markdown | Remove manual numbers, use --number-sections only |
| Bullet list renders as dashes | Markdown formatting issue | Check for proper blank lines before lists |
| Bibliography not rendering | Missing references.bib | Create .bib file or remove --bibliography flag |
| PDF file size too large | Embedded fonts | Use --pdf-engine-opt=-dEmbedAllFonts=false |
After this skill completes, check before closing:
Only update if the issue is real and reproducible — not speculative.
assets/build-pdf-example.sh (opens in a new tab)assets/build-pdf.sh (opens in a new tab)assets/hide-details-for-pdf.lua (opens in a new tab)assets/table-spacing-template.tex (opens in a new tab)references/bibliography-citations.md (opens in a new tab)references/core-principles.md (opens in a new tab)references/document-patterns.md (opens in a new tab)references/evolution-log.md (opens in a new tab)references/latex-parameters.md (opens in a new tab)references/markdown-for-pdf.md (opens in a new tab)references/troubleshooting-pandoc.md (opens in a new tab)references/yaml-structure.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
pandoc, xelatex, markdown-to-pdf, document-generation, build-script
/doc-tools:pandoc-pdf-generationfrom doc-tools
npx claudepluginhub terrylica/cc-skills --plugin doc-tools13 skills in this plugin
/academic-pdf-to-gfmConvert academic PDF papers to GitHub-renderable GFM markdown with math equations. TRIGGERS - PDF, GitHub markdown, math/ascii-diagram-validatorValidate ASCII diagram alignment in markdown. TRIGGERS - diagram alignment, ASCII art, box-drawing diagrams./documentation-standardsApply markdown documentation standards for both LLM consumption and Pandoc PDF export: section numbering, formatting and style. Use when writing or reviewing documentation./glossary-managementManage terminology glossary with Vale. TRIGGERS - sync terms, glossary validation, add terms, Vale vocabulary./latex-buildLaTeX builds with latexmk and live preview. TRIGGERS - latexmk, LaTeX build, live preview, compilation./latex-setupLaTeX environment setup on macOS. TRIGGERS - install LaTeX, MacTeX, Skim viewer, SyncTeX setup.Other plugins' skills for the same job