From medsci-project
Converts academic Markdown documents (English or Korean) to publication-quality PDFs via pandoc + xelatex. Targets non-bibliography artifacts: proposals, IRB cover letters, briefing handouts, anchor docs, reference tables. Auto-sizes pipe-table columns and handles CJK fonts.
How this skill is triggered — by the user, by Claude, or both
Slash command
/medsci-project:render-pdf-docinheritThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Markdown + frontmatter → publication-quality academic PDF (English or Korean).
references/known_pitfalls.mdreferences/pandoc_korean_cheatsheet.mdscripts/check_deps.shscripts/infer_colwidths.pyscripts/render_pdf.shscripts/scan_glyph_coverage.pyskill.ymltemplates/anchor-doc.mdtemplates/anchor-doc_ko.mdtemplates/briefing-handout.mdtemplates/briefing-handout_ko.mdtemplates/proposal-cover.mdtemplates/proposal-cover_ko.mdtemplates/reference-table.mdtemplates/reference-table_ko.mdtests/fixtures/glyph_plain.mdtests/fixtures/glyph_risky.mdtests/test_glyph_coverage.shMarkdown + frontmatter → publication-quality academic PDF (English or Korean).
In real circulation cycles for academic PDFs, two recurring failure patterns appear:
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.
| 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 |
mainfont + CJKmainfont. The default fallback is OS-detected.redact_internal: true option.tbl-colwidths has reported PDF regressions (issues 6089/9200).# Required
brew install pandoc # macOS
brew install --cask mactex-no-gui # xelatex + xeCJK (~5 GB)
# Linux
sudo apt-get install pandoc texlive-xetex texlive-lang-cjk fonts-noto-cjk
Detection:
bash scripts/check_deps.sh
---
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 instead. The render script auto-detects.
python scripts/infer_colwidths.py input.md > input.colwidths.md
The script:
max(len(header), max(len(cell))) (CJK = 2 cells, ASCII = 1).Override per-table via attribute: {tbl-colwidths="[20,40,40]"} after caption — passes through unchanged.
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
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.
Open the PDF. Check:
Starter markdown in templates/ (English default; a Korean variant *_ko.md ships alongside each):
anchor-doc.md — Q&A gridproposal-cover.md — research-proposal cover pagebriefing-handout.md — meeting brief (1-page)reference-table.md — comparison-table formatEach template marks slots with a <!-- TODO: --> marker.
| 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 |
scripts/render_pdf.sh — pandoc + xelatex wrapper, OS font detectionscripts/infer_colwidths.py — auto-generates pipe-table separator dash ratiosscripts/check_deps.sh — checks for pandoc / xelatex / CJK fonttemplates/ — 4 starters (English) + their *_ko.md Korean variantsreferences/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)~/.claude/rules/numerical-safety.md. Read from CSV./manage-refs separately — this skill does not handle bib.~/.claude/rules/senior-mentor-circulation.md (preserve the primary source) + ~/.claude/rules/ai-drafted-document-policy.md.npx claudepluginhub aperivue/medsci-skills --plugin medsci-presentationConverts Markdown documents to professionally typeset PDFs using reportlab (primary) or pandoc+XeLaTeX (fallback). Handles CJK/Latin mixed text, code blocks, tables, Obsidian callouts, math formulas, and 14 color themes. Triggered by "markdown to PDF", "md2pdf", "any2pdf", or export requests.
Renders a polished markdown report to a letter-size PDF using pandoc with xelatex (11pt serif, 1-inch margins, numbered footnotes). Fails loudly with install instructions if pandoc or xelatex is missing.
Converts Markdown to professionally styled PDFs with Mermaid diagrams, LaTeX/KaTeX math, tables, and syntax-highlighted code blocks.