kimi-pdf
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRoute Selection
路径选择
| Route | Trigger | Route File |
|---|---|---|
| HTML (default) | All PDF creation requests | |
| LaTeX | User explicitly requests LaTeX, .tex, or Tectonic | |
| Process | Work with existing PDFs (extract, merge, fill forms, etc.) | |
Default to HTML. Only use LaTeX route when user explicitly requests it.
| 路径 | 触发条件 | 路径文件 |
|---|---|---|
| HTML(默认) | 所有PDF创建请求 | |
| LaTeX | 用户明确要求LaTeX、.tex或Tectonic | |
| Process(处理) | 处理现有PDF(提取内容、合并、填写表单等) | |
默认使用HTML路径。仅当用户明确要求时才使用LaTeX路径。
MANDATORY: Read Route File Before Implementation
强制要求:实施前请阅读路径文件
<system-reminder>
You MUST read the corresponding route file before writing ANY code.
Route files contain critical implementation details NOT duplicated here.
Skipping this step leads to incorrect output (wrong scripts, missing CSS, broken layouts).
</system-reminder>
Before implementation, you MUST:
- Determine the route (HTML / LaTeX / Process)
- Read the route file (,
routes/html.md, orroutes/latex.md)routes/process.md - Only then proceed with implementation
This file (SKILL.md) contains constraints and principles. Route files contain how-to details.
<system-reminder>
在编写任何代码之前,您必须阅读对应的路径文件。
路径文件包含此处未重复的关键实施细节。
跳过此步骤会导致输出错误(脚本错误、缺少CSS、布局损坏)。
</system-reminder>
实施前,您必须:
- 确定路径(HTML / LaTeX / Process)
- 阅读路径文件(、
routes/html.md或routes/latex.md)routes/process.md - 之后再开始实施
本文件(SKILL.md)包含约束条件和原则。路径文件包含具体实现步骤。
Decision Rules
决策规则
Route Selection
路径选择
| User Says | Route |
|---|---|
| "Create a PDF", "Make a report", "Write a paper" | HTML |
| "Use LaTeX", "Compile .tex", "Use Tectonic" | LaTeX |
| "Extract text from PDF", "Merge these PDFs", "Fill this form" | Process |
| 用户需求 | 路径 |
|---|---|
| "创建PDF"、"生成报告"、"撰写论文" | HTML |
| "使用LaTeX"、"编译.tex文件"、"使用Tectonic" | LaTeX |
| "从PDF提取文本"、"合并这些PDF"、"填写此表单" | Process |
Cover Style Selection (HTML Route)
封面样式选择(HTML路径)
| Context | Style |
|---|---|
| Academic paper, thesis, formal coursework | Minimal (white, centered, no decoration) |
| Reports, proposals, professional documents | Designed (choose from style reference in html.md) |
| Uncertain | Default to Designed — plain text cover = mediocre |
Key principle: Cover background separates "acceptable" from "impressive". See html.md for 11 style options.
| 场景 | 样式 |
|---|---|
| 学术论文、毕业论文、正式课程作业 | 极简风格(白色背景、居中、无装饰) |
| 报告、提案、专业文档 | 设计风格(从html.md的样式参考中选择) |
| 不确定 | 默认使用设计风格——纯文本封面效果一般 |
核心原则:封面背景是区分"合格"与"出色"的关键。查看html.md了解11种样式选项。
Citation Format Selection
引用格式选择
| Document Language | Format |
|---|---|
| Chinese | GB/T 7714 (use [J][M][D] identifiers) |
| English | APA |
| Mixed | Chinese refs → GB/T 7714, English refs → APA |
| 文档语言 | 格式 |
|---|---|
| 中文 | GB/T 7714(使用[J][M][D]标识符) |
| 英文 | APA |
| 混合语言 | 中文参考文献→GB/T 7714,英文参考文献→APA |
Quick Start
快速开始
Use the unified CLI for all operations:
bash
undefined所有操作使用统一CLI:
bash
undefinedCheck environment (JSON output, exit code 0=ok, 2=missing deps)
检查环境(JSON格式输出,退出码0=正常,2=缺少依赖)
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh check
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh check
Auto-fix missing dependencies (idempotent, safe to run multiple times)
自动修复缺失的依赖(幂等操作,可多次安全运行)
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh fix
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh fix
Convert HTML to PDF
将HTML转换为PDF
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh html input.html
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh html input.html
Compile LaTeX to PDF
编译LaTeX为PDF
/app/.kimi/skills/kimi-pdf/scripts/pdf.sh latex input.tex
**Exit codes:**
- `0` = success
- `1` = usage error
- `2` = dependency missing (run `pdf.sh fix`)
- `3` = runtime error
**Dependencies by route:**
- **HTML route**: Node.js, Playwright, Chromium
- **Process route**: Python 3, pikepdf, pdfplumber
- **LaTeX route**: Tectonic
---/app/.kimi/skills/kimi-pdf/scripts/pdf.sh latex input.tex
**退出码说明:**
- `0` = 成功
- `1` = 使用错误
- `2` = 缺少依赖(运行`pdf.sh fix`修复)
- `3` = 运行时错误
**各路径依赖:**
- **HTML路径**:Node.js、Playwright、Chromium
- **Process路径**:Python 3、pikepdf、pdfplumber
- **LaTeX路径**:Tectonic
---Core Constraints (Must Follow)
核心约束(必须遵守)
1. Output Language
1. 输出语言
Output language must match user's query language.
- User writes in Chinese → PDF content in Chinese
- User writes in English → PDF content in English
- User explicitly specifies language → Follow user's specification
输出语言必须与用户查询语言一致。
- 用户使用中文提问 → PDF内容为中文
- 用户使用英文提问 → PDF内容为英文
- 用户明确指定语言 → 遵循用户指定
2. Word Count and Page Constraints
2. 字数与页数约束
- Strictly follow user-specified word/page count requirements
- Do not arbitrarily inflate content length
- 严格遵循用户指定的字数/页数要求
- 不得随意增加内容长度
3. Citation and Search Standards
3. 引用与搜索标准
CRITICAL: Search Before Writing
关键要求:撰写前先搜索
DO NOT fabricate information. When in doubt, SEARCH.
If content involves ANY of these, you MUST search FIRST before writing:
- Statistics, numbers, percentages, rankings
- Policies, regulations, laws, standards
- Academic research, theories, methodologies
- Current events, recent developments
- Anything you're not 100% certain about
不得编造信息。如有疑问,务必搜索。
如果内容涉及以下任何一项,您必须先搜索再撰写:
- 统计数据、数字、百分比、排名
- 政策、法规、法律、标准
- 学术研究、理论、方法论
- 时事、最新动态
- 任何您无法100%确定的内容
When Search is Required
需要搜索的场景
| Scenario | Search? | Notes |
|---|---|---|
| Statistics, data | Required | e.g., "2024 employment rate" |
| Policies, regulations | Required | e.g., "startup subsidies" |
| Research, papers | Required | e.g., "effectiveness of method X" |
| Time-sensitive content | Required | Information after knowledge cutoff |
| Uncertain facts | Required | If unsure, always search |
| Common knowledge | Not needed | e.g., "water boils at 100°C" |
Search workflow:
- Identify facts/data requiring verification
- Search for authentic sources
- If results insufficient, iterate search until reliable info obtained
- Include real sources in references
- If search fails repeatedly, tell the user instead of making up data
| 场景 | 是否需要搜索 | 说明 |
|---|---|---|
| 统计数据、资料 | 是 | 例如:"2024年就业率" |
| 政策、法规 | 是 | 例如:"创业补贴" |
| 研究、论文 | 是 | 例如:"方法X的有效性" |
| 时效性内容 | 是 | 知识库截止日期之后的信息 |
| 不确定的事实 | 是 | 如有疑问,始终先搜索 |
| 常识 | 否 | 例如:"水在100°C沸腾" |
搜索流程:
- 识别需要验证的事实/数据
- 搜索可靠来源
- 如果结果不足,重复搜索直到获取可靠信息
- 在参考文献中包含真实来源
- 如果多次搜索失败,告知用户,不得编造数据
Citations Must Be Real
引用必须真实
Fabricating references is prohibited. All citations must have:
- Correct author/institution names
- Accurate titles
- Verifiable year, journal/source
严禁编造参考文献。所有引用必须包含:
- 正确的作者/机构名称
- 准确的标题
- 可验证的年份、期刊/来源
Cross-references (Must Be Clickable)
交叉引用(必须可点击)
html
As shown in <a href="#fig-1-1">Figure 1-1</a>...
From <a href="#eq-2-1">Equation (2-1)</a>...
See <a href="#sec3">Section 3</a>...Note: must be placed at container top (see CSS Counters section in html.md).
idhtml
如<a href="#fig-1-1">图1-1</a>所示...
根据<a href="#eq-2-1">公式(2-1)</a>...
详见<a href="#sec3">第3节</a>...注意:必须放在容器顶部(查看html.md中的CSS计数器部分)。
idContent Quality Constraints
内容质量约束
1. Word/Page Count Constraints
1. 字数/页数约束
Must strictly follow user-specified word or page count requirements:
| User Request | Execution Standard |
|---|---|
| Specific word count (e.g., "3000 words") | Within ±20%, i.e., 2400-3600 words |
| Specific page count (e.g., "5 pages") | Exactly equal, last page may be partial |
| Word count range (e.g., "2000-3000 words") | Must fall within range |
| No explicit requirement | Infer reasonably by document type; prefer thorough over superficial |
| Minimum specified (e.g., "more than 5000 words") | No more than 2x, i.e., 5000-10000 words |
Prohibited behaviors:
- Arbitrarily shortening content ("concise" is not an excuse)
- Padding pages with excessive bullet lists (maintain high information density)
- Exceeding twice the user's requested length
Special case - Resume/CV:
- Resume should be 1 page unless user specifies otherwise
- Use compact margins:
margin: 1.5cm
必须严格遵循用户指定的字数或页数要求:
| 用户需求 | 执行标准 |
|---|---|
| 具体字数(如"3000字") | 误差在±20%以内,即2400-3600字 |
| 具体页数(如"5页") | 严格符合,最后一页可部分内容 |
| 字数范围(如"2000-3000字") | 必须落在范围内 |
| 无明确要求 | 根据文档类型合理推断;优先全面而非简略 |
| 最低字数要求(如"超过5000字") | 不超过2倍,即5000-10000字 |
禁止行为:
- 随意缩短内容("简洁"不能成为借口)
- 用过多项目符号填充页数(保持高信息密度)
- 超过用户要求长度的2倍
特殊情况 - 简历/CV:
- 简历默认1页,除非用户另有指定
- 使用紧凑边距:
margin: 1.5cm
2. Outline Adherence (Mandatory)
2. 大纲遵循(强制要求)
When user provides outline:
- Strictly follow the user-provided outline structure
- Section titles must match outline (minor wording adjustments OK, no level/order changes)
- Do not add or remove sections arbitrarily
- If outline seems problematic, ask user first before modifying
When no user outline:
- Use standard structures based on document type:
- Academic papers: IMRaD (Introduction-Methods-Results-Discussion) or Introduction-Literature Review-Methods-Results-Discussion-Conclusion
- Business reports: Conclusion-first (Executive Summary → Detailed Analysis → Recommendations)
- Technical docs: Overview → Principles → Usage → Examples → FAQ
- Course assignments: Follow assignment structure requirements
- Sections must have logical progression, no disconnects
当用户提供大纲时:
- 严格遵循用户提供的大纲结构
- 章节标题必须与大纲匹配(可做少量措辞调整,不得更改层级/顺序)
- 不得随意添加或删除章节
- 如果大纲存在问题,先询问用户再修改
当用户未提供大纲时:
- 根据文档类型使用标准结构:
- 学术论文: IMRaD(引言-方法-结果-讨论)或引言-文献综述-方法-结果-讨论-结论
- 商业报告: 结论先行(执行摘要→详细分析→建议)
- 技术文档: 概述→原理→使用方法→示例→常见问题
- 课程作业: 遵循作业结构要求
- 章节必须逻辑连贯,无脱节
Tech Stack Overview
技术栈概述
| Route | Tools | Purpose |
|---|---|---|
| HTML | Playwright + Paged.js | HTML → PDF conversion |
| HTML | KaTeX, Mermaid | Math formulas, diagrams |
| Process | pikepdf | Form filling, page operations, metadata |
| Process | pdfplumber | Text and table extraction |
| Process | LibreOffice | Office → PDF conversion |
| LaTeX | Tectonic | LaTeX → PDF compilation |
| 路径 | 工具 | 用途 |
|---|---|---|
| HTML | Playwright + Paged.js | HTML → PDF 转换 |
| HTML | KaTeX, Mermaid | 数学公式、图表 |
| Process | pikepdf | 表单填写、页面操作、元数据处理 |
| Process | pdfplumber | 文本和表格提取 |
| Process | LibreOffice | 办公文档→PDF 转换 |
| LaTeX | Tectonic | LaTeX → PDF 编译 |