math-print-paper

Math Print Paper Generator: Converts math problems into a printable exercise layout. Produces plain problem pages with very large problem formulas (36pt), smaller problem numbers (24pt), small margins (0.5cm), and no decorations. Trigger phrases include “print paper version,” “large font,” “exercise template,” and “plain problems.”

Installation

Review the source and dependencies with a prompt. A package is available to download.

Install with an AI assistant

Copy the prompt so your assistant can review the pinned revision and dependencies first.

View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "math-print-paper" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-ec1c368359742987b113fd5c2583e41fe306880282a8f52c59eeff69a085aac9. Verify the upstream source and version against https://skillhub.cn/skills/user_ce094de0/math-print-paper before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.

Source and setup

skillhub.cn

Setup guidance pending

See the original source for supported tools, dependencies, and permissions.

Installation test pending

Math Print Paper Generator: Converts math problems into a printable exercise layout. Produces plain problem pages with very large problem formulas (36pt), smaller problem numbers (24pt), small margins (0.5cm), and no decorations. Trigger phrases include “print paper version,” “large font,” “exercise template,” and “plain problems.”

0 Downloads

Introduction source: third_party · user_ce094de0 · 1.0.0 Reference

SkillPi interpretation

Tasks
Translation pending; see source documentation.
Audience
Translation pending; see source documentation.
Testing
Not tested

Browse files

Browse files at the source ↗

Original SKILL.md

Open original ↗
Frontmatter
name: math-print-paper
description: 数学打印纸版生成器。当用户需要将数学题目转换为适合打印做题的格式时使用。特点:题号来源较小(24pt)、题干公式特大(36pt)、小边距(0.5cm)、无装饰。触发词:"打印纸版"、"大字体"、"做题模板"、"纯题目"。

数学打印纸版生成器

将数学题目转换为适合打印做题的格式,特点是题号来源小、题干公式特大、小边距、无装饰,方便在纸上直接做题。

适用场景

  • 将电子版的数学错题整理成纸质版练习
  • 需要题干大字体方便阅读和书写
  • 题号来源缩小,不占用视觉焦点
  • 去除装饰元素,节省墨水

模板字体规格

元素 字体大小 颜色 说明
题号+来源 24pt #666(灰) 较小,次要信息
题干内容 36pt #000(黑) 特大,主要内容
数学公式 36pt (继承) - 与题干同大
章节标题 28-32pt #333 适中
页边距 0.5cm - 最小边距
题目间距 0.6em - 紧凑但可区分

文件结构

math-print-paper/
├── SKILL.md                    # 技能说明文档
├── assets/
│   └── print_template.html     # 打印纸版HTML模板
└── scripts/
    ├── convert_to_print.py     # 转换脚本
    └── self_check.py           # 自检脚本(验证环境+最小PDF)

脚本工作原理

scripts/convert_to_print.py 采用智能检测策略:

  1. 完整 HTML(推荐):如果输入 HTML 已包含 <html>、<body> 等完整结构,脚本直接渲染该文件,不再拆解重组。仅当缺少 KaTeX 或打印样式时自动补全。
  2. 纯题目片段:如果输入是裸的题目 HTML 片段,脚本才用模板包装。
  3. 网络等待:使用 wait_until='networkidle' + KaTeX 元素轮询,确保 KaTeX CDN 加载完成且公式已渲染。
  4. 内容验证:渲染后统计已加载的题目数量和 .katex 元素数,输出到日志供确认。

重要:生成 HTML 时务必包含完整的 <html>/<head>/<body> 结构和 KaTeX 引用,脚本会直接渲染完整文件,避免正则提取导致内容丢失。

渲染机制

使用 Playwright (Chromium headless):

  • 主动轮询 .katex 元素 > 0,超时 15s 不中断
  • 失败时不阻塞(KaTeX CDN 偶尔慢)
  • 模板内置 robustKatex IIFE 二次扫描确保动态公式也渲染

不要在 .katex 上加 font-size: ... !important; —— 这会导致三角符号(▲▼●)伪影。KaTeX 默认字号继承自父元素已经足够大。

使用方法

方式一:使用脚本转换

python scripts/convert_to_print.py input.html [output.pdf]

方式二:手动使用模板

  1. 复制 assets/print_template.html
  2. 在 <!-- 在此处添加题目内容 --> 区域添加题目
  3. 用浏览器打开,打印为PDF

题目格式示例

<div class="problem">
    <div class="problem-number">题 1 (来源:《考研数学1000题》P6)</div>
    <div class="problem-content">
        <p>求极限 $\displaystyle\lim_{x\to 0}\frac{\sin x}{x}$</p>
    </div>
</div>

公式语法

支持标准LaTeX数学公式:

  • 行内公式:$公式$
  • 块级公式:$$公式$$

数学公式中的不等号必须使用 \lt / \gt 或 &lt; / &gt;,不要写裸 < / >。

故障排查

快速诊断

运行 python scripts/self_check.py 一次性检查:

  • Python 依赖(playwright)
  • Playwright Chromium 浏览器是否已下载
  • KaTeX CDN(jsdelivr)是否可达
  • 最小 HTML 文件能否成功生成打印版 PDF

常见问题

Q1: PDF 中出现裸 LaTeX(如 $x^2$)

  • 原因:KaTeX 库未加载(断网/CDN被墙)
  • 排查:self_check.py 第3项检查 KaTeX CDN 是否可达
  • 修复:检查网络或使用本地 KaTeX 资源

Q2: PDF 中三角符号(▲▼●)伪影

  • 原因:.katex 上设置了过大的 font-size
  • 修复:删除所有 .katex { font-size: ... !important; } 覆盖
  • 注:本 skill 模板已经按规范实现,若你修改了 CSS 请遵循此规则

Q3: 某些公式不渲染

  • 原因:KaTeX throwOnError: false 让失败公式保持原文
  • 排查:浏览器打开 HTML,按 F12 Console 看 ParseError 警告
  • 修复:根据警告修正 LaTeX 语法(常见:不等号用了裸 < / >)

Q4: PDF 中显示的不是大字体

  • 原因:输入 HTML 的 <body> 没有设置 font-size: 36pt
  • 修复:让输入 HTML 包含 <style>body{font-size:36pt;...}</style>,或使用本 skill 的完整模板

依赖

pip install playwright
playwright install chromium

Current listing version

1.0.0

Verify the source revision ↗

Safety and assessment details

Quality assessment

Out of 100 · Assessment report from SkillPi LAB.

Scenario Value85/100

Highlights

  • 提供数学题目打印纸版生成功能,解决教育场景下的实际需求
  • 功能完整,包含模板、脚本、使用说明和故障排查
Trigger Precision90/100

Highlights

  • 触发词精准完整,覆盖多种变体,边界清晰
Structure and Standards95/100

Highlights

  • 文档结构完整,包含适用场景、模板规格、文件结构、工作原理、使用方法、示例和故障排查
  • 有清晰的步骤说明和端到端示例
Execution Reliability90/100

Highlights

  • 提供了完整的转换脚本和自检脚本,工具来源明确
  • 覆盖了主要异常情况,并有详细的故障排查指南
Evidence Verifiability (mean of the first four)90/100

The arithmetic mean of the first four original scores, rounded to a whole number.

Static text checks

100 / 100 · skillpi-20261123-no-r3-v1

No current rules matched the text.

This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.

Permissions and checks before use

Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.

  • Install or fetch external dependencies

    Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.

    Mentioned in main document · lines 128

These notices grant no permissions. Your host tool must still confirm file changes, secrets, external transfers or costs as needed.

Security rating and access scope

safe · Static evidence review; not a runtime safety guarantee.

Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.