返回 Skill 列表
extension
分类: 开发与工程无需 API Key

pandoc-pdf-generation

使用Pandoc和XeLaTeX从Markdown生成专业的PDF。在创建PDF、需要章节编号、目录、参考文献或自定义LaTeX样式时使用。

person作者: jakexiaohubgithub

Pandoc PDF Generation

Overview

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.

When to Use This Skill

Use this skill when:

  • Converting Markdown to PDF with professional formatting requirements
  • Needing automatic section numbering and table of contents
  • Managing citations and bibliographies without manual duplication
  • Controlling table formatting and page breaks in LaTeX output
  • Building automated PDF generation workflows

Quick Start: Universal Build Script

Single Source of Truth Pattern

This skill provides production-proven assets in ~/.claude/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

From Any Project

# Create symlink once per project (git-friendly)
ln -s ~/.claude/skills/pandoc-pdf-generation/assets/build-pdf.sh build-pdf.sh

# Auto-detect single .md file in directory
./build-pdf.sh

# Or specify explicitly
./build-pdf.sh input.md output.pdf

Features:

  • ✅ Auto-detects input file (if single .md exists)
  • ✅ Auto-detects bibliography (references.bib) and CSL files
  • ✅ Always uses production-proven LaTeX preamble from skill
  • ✅ Pre-flight checks (pandoc, xelatex, files exist)
  • ✅ Post-build validation (file size, page count)

Manual Command (For Reference)

pandoc document.md \
  -o document.pdf \
  --pdf-engine=xelatex \
  --toc \
  --toc-depth=3 \
  --number-sections \
  -V geometry:margin=1in \
  -V mainfont="DejaVu Sans" \
  -H ~/.claude/skills/pandoc-pdf-generation/assets/table-spacing-template.tex

Reference Documentation

For detailed information, see: