TopRank Skills

Home / Claw Skills / Document / md2pdf
Official OpenClaw rules 72%

md2pdf

Convert Markdown files to PDF with full LaTeX math formula rendering and CJK (Chinese/Japanese/Korean) support. Use when the user asks to convert markdown to PDF, render a report as PDF, export notes to PDF, or generate a printable document from markdown. Handles $...$ inline and $$...$$ display math, code blocks, tables, and mixed CJK/Latin text. Requires pandoc + texlive-xetex.

Stars

0

Installs

0

Status

ACTIVE

Visibility

PUBLIC

安装方式

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

请先检查是否已安装 SkillHub 商店,若未安装,请根据 https://skillhub-1388575217.cos.ap-guangzhou.myqcloud.com/install/skillhub.md 安装 SkillHub 商店,然后安装 md2pdf 技能。 若已安装,则直接安装 md2pdf 技能。

Overview

Skill Key
huaruoji/md2pdf-xelatex
Author
huaruoji
Source Repo
openclaw/skills
Version
-
Source Path
skills/huaruoji/md2pdf-xelatex
Latest Commit SHA
c0f52c4929133c79c4976f271f9fd4ea834d8702

Extracted Content

SKILL.md excerpt

# md2pdf

Convert Markdown → PDF via Pandoc + XeLaTeX. Full LaTeX math + CJK support.

## Prerequisites

System packages (apt):

```
pandoc texlive-xetex texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra texlive-lang-chinese
```

## Quick Convert

```bash
bash <skill_dir>/scripts/md2pdf.sh input.md output.pdf
```

The script auto-detects CJK content, picks suitable fonts, sanitizes emoji, adds TOC, and configures XeLaTeX.

## Manual Pandoc Command

For fine-grained control, run pandoc directly:

```bash
pandoc input.md -o output.pdf \
  --pdf-engine=xelatex \
  -f markdown-smart \
  -H header.tex \
  -V mainfont="DejaVu Sans" \
  -V monofont="DejaVu Sans Mono" \
  -V geometry:margin=20mm \
  -V fontsize=10pt \
  -V colorlinks=true \
  --highlight-style=tango \
  --toc -V toc-title="Table of Contents"
```

Where `header.tex` contains:

```latex
\usepackage{xeCJK}
\setCJKmainfont{<CJK font name>}
```

## Key Details

- **Math**: Pandoc natively converts `$...$` (inline) and `$$...$$` (display) to LaTeX math. No MathJax/KaTeX needed.
- **CJK fonts**: Script auto-detects from: Noto Sans CJK SC > WenQuanYi Micro Hei > Droid Sans Fallback > AR PL UMing CN.
- **Emoji**: Replaced with text equivalents (`✅` → `[Y]`, `❌` → `[N]`, `⭐` → `*`) since most LaTeX fonts lack emoji glyphs.
- **Smart quotes**: Use `-f markdown-smart` to avoid curly quote rendering issues.
- **Long tables**: Pandoc may struggle with complex tables; keep tables simple or use `longtable` LaTeX package.

## Troubleshooting

| Problem | Fix |
|---------|-----|
| Missing character warnings | Check `fc-list :lang=zh` for available CJK fonts; install `fonts-noto-cjk` if needed |
| `xelatex not found` | Install `texlive-xetex` |
| PDF has no math rendering | Ensure markdown uses `$...$` / `$$...$$` (not HTML math tags) |
| Broken table layout | Simplify table or add `-V geometry:margin=15mm` for more width |

Related Claw Skills

edholofy

dojo.md

★ 4

University for AI agents. 92 courses, 4400+ scenarios, any model via OpenRouter. Auto-training loops generate per-model SKILL.md documents. Works with Claude Code, OpenClaw, Cursor, Windsurf. No fine-tuning required.

lethehades

wps-macos-helper

★ 1

macOS WPS Office workflow helper skill for safer document preparation, conversion, export, and compatibility guidance

capt-marbles

firecrawl

★ 0

Web scraping and crawling with Firecrawl API. Fetch webpage content as markdown, take screenshots, extract structured data, search the web, and crawl documentation sites. Use when the user needs to scrape a URL, get current web info, capture a screenshot, extract specific data from pages, or crawl docs for a framework/library.

caqlayan

Tweet Processor

★ 0

Tweet Processor Skill

carev01

md-docs-search

★ 0

Full-text search across structured Markdown documentation archives using SQLite FTS5. Use when you need to search large collections of Markdown articles that are separated by "---" delimiters and contain source URLs (marked with "*Source:" pattern). Provides fast BM25-ranked search with automatic source URL extraction for citations. Ideal for research, documentation lookups, and knowledge base exploration. Requires indexing documentation first with `docs.py index`.

camelsprout

duckdb-en

★ 0

DuckDB CLI specialist for SQL analysis, data processing and file conversion. Use for SQL queries, CSV/Parquet/JSON analysis, database queries, or data conversion. Triggers on "duckdb", "sql", "query", "data analysis", "parquet", "convert data".