mcpbeat Sign in

Render PDF Doc Skill for Claude

> Render academic Markdown documents (English or Korean) to publication-quality PDF via pandoc + xelatex. handouts, anchor docs (Q&A grids), and reference tables. Auto-infers pipe-table column widths from content (label column shrinks to fit, data columns share remaining width). CJK-aware font fallback for Korean text (Apple SD Gothic Neo on macOS, Noto Sans CJK KR on Linux). filling (/fill-protocol), figures (/make-figures).

11k tokens
context cost
the whole folder, loaded on every use
19
files
ships runnable scripts
0
copies elsewhere
how many repositories repackaged it
230
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/Aperivue/medsci-skills --skill render-pdf-doc

The instruction itself

16 sections, as written by the author

Render-PDF-Doc Skill

Markdown + frontmatter → publication-quality academic PDF (English or Korean).

Why This Skill Exists

In real circulation cycles for academic PDFs, two recurring failure patterns appear:

  • v1 drafts: change-history, version numbers, and PI attribution leak into the attached PDF, confusing the first recipient.
  • v2 drafts: pandoc pipe-table dash ratios are misjudged, narrowing the first column and forcing label wrapping that hurts readability.

Manual fixes work but the same pattern recurs across proposals, briefings, IRB covers, exemption applications. This skill focuses on layout (CJK fonts + table column widths). Bibliography and CSL are handled by /manage-refs.

Boundary (separation from other skills)

| Task | Skill |

|---|---|

| Manuscript + bibliography → DOCX/PDF | /manage-refs scripts/render_pandoc.sh (CSL + .bib) |

| Filling an institutional .docx form | /fill-protocol |

| ICMJE COI form | /fill-icmje-coi |

| Figure / PPTX | /make-figures, /present-paper |

| This skill: non-bib academic markdown → PDF (proposal, briefing, anchor doc, IRB cover) | /render-pdf-doc |

Core Principles

  • Pipe table column widths must be inferred from content. No equal splitting. Size the first column (label) to the longest label, and distribute the remaining width content-proportionally across the data columns.
  • Set the CJK font explicitly — mainfont + CJKmainfont. The default fallback is OS-detected.
  • For circulation PDFs, remove change history / version numbers / PI attribution (or split them into a supplementary). Use the frontmatter redact_internal: true option.
  • No Quarto dependency — raw pandoc + xelatex. Quarto's tbl-colwidths has reported PDF regressions (issues 6089/9200).

Dependencies

# macOS
brew install pandoc
brew install --cask mactex-no-gui          # xelatex + xeCJK (~5 GB)

# Linux
sudo apt-get install pandoc texlive-xetex texlive-lang-cjk fonts-noto-cjk

# Windows (PowerShell) — run in Git Bash afterwards
winget install --id JohnMacFarlane.Pandoc
winget install --id MiKTeX.MiKTeX          # xelatex; installs missing LaTeX packages on demand
# No CJK font download needed: Malgun Gothic ships with Windows 7+ and is the default here.

Detection:

bash scripts/check_deps.sh

Windows / Git Bash note. MiKTeX's binary directory

(%LOCALAPPDATA%\Programs\MiKTeX\miktex\bin\x64) is often not on the Git Bash PATH,

so xelatex can read as [MISS] even after install. Both check_deps.sh and

render_pdf.sh now auto-probe that location; if xelatex still isn't found, add the

directory to your PATH (or run from the *MiKTeX Console → Settings*-configured shell).

The Windows CJK/main font default is Malgun Gothic (preinstalled); override per document

via frontmatter, or with --font / --cjk-font.

Workflow

Step 1 — Author markdown with frontmatter

---
title: "Paper 2 Calibration Anchor — Q&A Grid"
author: "<Author Group>"
date: "2026-05-01"
mainfont: "Apple SD Gothic Neo"        # macOS default
CJKmainfont: "Apple SD Gothic Neo"
geometry: "margin=0.85in"
fontsize: 11pt
linestretch: 1.25
colorlinks: true
---

For Linux/CI, use Noto Sans CJK KR; on Windows, use Malgun Gothic. The render script auto-detects the default per OS.

Step 2 — Infer column widths

python scripts/infer_colwidths.py input.md > input.colwidths.md

The script:

  • Finds every pipe table block.
  • For each column, computes display width = max(len(header), max(len(cell))) (CJK = 2 cells, ASCII = 1).
  • Generates dash-row separator with proportional dash counts.
  • Writes a new file with separator rows replaced.

Override per-table via attribute: {tbl-colwidths="[20,40,40]"} after caption — passes through unchanged.

Step 3 — Render

bash scripts/render_pdf.sh -i input.colwidths.md -o output.pdf

Or one-shot:

bash scripts/render_pdf.sh -i input.md -o output.pdf --infer-colwidths

Step 3.5 — Scientific-symbol + CJK glyph scan (before render)

xelatex silently drops any character the chosen font does not cover — the PDF

renders with the glyph simply missing, no error or warning. Academic markdown

routinely carries glyphs a default Latin font misses: transition arrows (→ ↑ ↓),

math operators (− ≤ ≥ ± √ ∪ × ≈ ≠), stats Greek (κ μ σ β), bullets/marks (• ★ ✓),

and CJK. Scan the source first so a silent drop is caught before it ships:

python3 scripts/scan_glyph_coverage.py input.md --strict
# real cmap check when you have the font file + fonttools:
python3 scripts/scan_glyph_coverage.py input.md --font "/path/to/body.otf" --strict

It groups the risky glyphs by class (advisory), or — with --font + fonttools

— reports which are genuinely absent from the font's cmap. If risky glyphs are

present, ensure mainfont/CJKmainfont cover them (a CJK-capable font such as

*Apple SD Gothic Neo* / *Noto Sans CJK* usually covers arrows + Hangul but can

still miss the true-minus − U+2212 and ★). **The DOCX is authoritative; the

PDF is a convenience copy** — never let a PDF render drop a glyph the document

needs.

Step 4 — Visual verify

Open the PDF. Check:

  • The first-column labels do not wrap and stay on a single line
  • Data columns have sufficient width
  • No broken Korean glyphs (a Times New Roman fallback means CJKmainfont was not applied)
  • No missing scientific symbols (arrows, −, ≤, ±, √) — the Step 3.5 scan flags candidates
  • No change history / internal version numbers exposed

Templates

Starter markdown in templates/ (English default; a Korean variant *_ko.md ships alongside each):

  • anchor-doc.md — Q&A grid
  • proposal-cover.md — research-proposal cover page
  • briefing-handout.md — meeting brief (1-page)
  • reference-table.md — comparison-table format

Each template marks slots with a <!-- TODO: --> marker.

Anti-Patterns

| Anti-pattern | Consequence |

|---|---|

| Equal dash split (\|---\|---\|---\|) | A column with only a short label gets the same width → cramped data columns |

| CJKmainfont not set | Hangul falls back to Times New Roman (broken Latin glyphs or blanks) |

| Change history / version (e.g. v3.2.2) / PI attribution exposed in a circulation PDF | Confuses the first recipient; leaks internal information |

| Quarto tbl-colwidths for PDF | PDF regression in Quarto 1.4+ — trust HTML only |

Files

  • scripts/render_pdf.sh — pandoc + xelatex wrapper, OS font detection
  • scripts/infer_colwidths.py — auto-generates pipe-table separator dash ratios
  • scripts/check_deps.sh — checks for pandoc / xelatex / CJK font
  • templates/ — 4 starters (English) + their *_ko.md Korean variants
  • references/pandoc_korean_cheatsheet.md — collection of frontmatter patterns (Korean-PDF reference)
  • references/known_pitfalls.md — em-dash line breaks, smart quotes, etc. (Korean-PDF reference)

Anti-Hallucination

  • Numerical content in tables: read every value from the source CSV or analysis output. Do not

retype a number from prose, and do not carry one forward from an earlier draft — a table that

was correct in v3 is not evidence it is correct in v4.

  • References: use /manage-refs separately — this skill does not handle bib.
  • When producing a circulation PDF, keep the received primary source (the .docx or .eml a

co-author sent) unmodified as its own artifact. The PDF is a derivative, not a replacement, and

the next round is diffed against that source. If the source was itself AI-drafted by a

collaborator, treat every number, denominator, and author-year in it as unverified: re-derive

each from the underlying paper or analysis output before it reaches the PDF.

Global-rule references

Some passages in this skill cite a path of the form ~/.claude/rules/<name>.md. Those are the

maintainer's personal global rules, kept outside this repository. They are **not shipped with

this skill** and will not exist on your machine; they appear only as provenance for where a

convention came from. If one of them looks like it is standing in for an instruction you actually

need, that is a bug — please open an issue, because the instruction belongs here.

Other skills for the same job

different authors, same section of the catalogue
DOCX
by anthropics
vendor ×16

Comprehensive document creation, editing, and analysis with support for tracked changes, comments, formatting preservation, and text extraction. When Claude needs to work with professional documents (.docx files) for: (1) Creating new documents, (2) Modifying or editing content, (3) Working with tracked changes, (4) Adding comments, or any other document tasks

7k tokens
PDF
by anthropics
vendor ×16

Comprehensive PDF manipulation toolkit for extracting text and tables, creating new PDFs, merging/splitting documents, and handling forms. When Claude needs to fill in a PDF form or programmatically process, generate, or analyze PDF documents at scale.

13k tokens scripts
PPTX
by JayZeeDesign
×15

Presentation creation, editing, and analysis. When Claude needs to work with presentations (.pptx files) for: (1) Creating new presentations, (2) Modifying or editing content, (3) Working with layouts, (4) Adding comments or speaker notes, or any other presentation tasks

308k tokens scripts
Canvas Design
by anthropics
vendor ×13

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

1388k tokens
PDF
by anthropics
vendor ×10

Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.

15k tokens scripts
DOCX
by w95
×6

Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.

5k tokens
PPTX
by w95
×4

Use this skill any time a .pptx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates, layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx filename, regardless of what they plan to do with the content afterward. If a .pptx file needs to be opened, created, or touched, use this skill.

2k tokens
Obsidian Markdown
by ZhanlinCui
×3

Create and edit Obsidian Flavored Markdown with wikilinks, embeds, callouts, properties, and other Obsidian-specific syntax. Use when working with .md files in Obsidian, or when the user mentions wikilinks, callouts, frontmatter, tags, embeds, or Obsidian notes.

3k tokens

How to use it

Copy the folder

Take aperivue/render-pdf-doc from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference brew, apt. Without those the skill loads but fails at the first command.