# Math Worksheet

> >-

- **Type:** Skill
- **Install:** `agentstack add skill-caoxg-math-worksheet-math-worksheet`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [caoxg](https://agentstack.voostack.com/s/caoxg)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [caoxg](https://github.com/caoxg)
- **Source:** https://github.com/caoxg/math-worksheet

## Install

```sh
agentstack add skill-caoxg-math-worksheet-math-worksheet
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Math Worksheet — 公式转图片

把口述/速记的数学题变成清晰可打印的图片。核心是一个本地实时预览页面：你把题目写成 LaTeX
（一行一题）追加进一个文本文件，浏览器页面每秒自动读取并渲染，用户点按钮就能把单题复制成
PNG/SVG 贴进 Word/WPS。**整套只依赖 `python3` 和一个浏览器，无需安装 LaTeX。**

## 启动（每个会话第一次用时跑一次，幂等）

```bash
bash ~/.claude/skills/math-worksheet/scripts/start.sh
```

它会：拷贝页面与离线 MathJax 到运行目录 → 后台起 `python3 -m http.server 8765` → 打开浏览器。
输出里有三行关键信息，记住 `FORMULAS=` 那个路径：

```
RUN_DIR=.../math-worksheet
FORMULAS=.../math-worksheet/formulas.txt   ← 你要写入的文件
URL=http://localhost:8765/index.html
```

- **端口被占用**时可换端口：`start.sh 8770`。
- 已在运行则直接复用，不会重复启动。
- 结束：`bash ~/.claude/skills/math-worksheet/scripts/stop.sh`。

## 工作循环（启动后）

用户每报一道（或一组）题，你只做一件事：**把 LaTeX 写入 `FORMULAS` 文件**（用 Write 工具，
整体覆盖即可），页面 1 秒内自动更新。一行一题。出一组题就写多行。

例如用户说“1/6 加 3/6，等号后留空”，写入：

```
\dfrac{1}{6}+\dfrac{3}{6}=\underline{\hspace{2cm}}
```

然后告诉用户“已更新，去页面点该题的 复制PNG 贴进 WPS”。**不要**每题再去单独生成 PNG 文件——
复制按钮已经在页面上，这才是省事的路径。

## LaTeX 写法约定（务必遵守）

| 需求 | 写法 |
|---|---|
| 分数 | `\dfrac{a}{b}` |
| 答案填空线 | `\underline{\hspace{2cm}}`（改 cm 调长短） |
| **空白分数**（让学生填分子分母） | `\dfrac{\hspace{1.2cm}}{\hspace{1.2cm}}`（分数线即横线，**不要**再套 `\underline`） |
| 带分数填空 | `\underline{\hspace{1.5cm}}+\dfrac{\hspace{1.2cm}}{\hspace{1.2cm}}` |
| 比大小填空（填 > < =） | `\;\bigcirc\;`，如 `\dfrac{3}{8}\;\bigcirc\;\dfrac{5}{8}` |
| 运算符 | `+`  `-`  `\times`  `\div`  `=` |
| 根号 / 乘方 | `\sqrt{...}`  `x^{2}` |
| 括号（自动适配高度） | `\left( ... \right)` |
| 单位（正体）+ 细空格 | `\,\text{m}`，如 `50\,\text{m}\times 30\,\text{m}` |
| 除法用分数线表示 | `\dfrac{\,被除式\,}{\,除式\,}` |

**硬性规则：**
1. **不要**在公式外加 `$ … $`，页面会自动用 `$$` 包裹。
2. **公式里不要写中文**（MathJax 的数学字体没有中文字形，会显示成方块）。
   需要中文标注时放在题面文字里，不要放进公式。
3. 一行一题；空行忽略。
4. 嵌套在 `\sqrt{}` 或分母里的小分数，可用 `\frac`（小号）让排版更紧凑。

## 页面上的按钮（告诉用户怎么用）

- **复制PNG**：把该题渲染成 4× 高清 PNG 写入剪贴板，去 Word/WPS `Ctrl/Cmd+V` 直接贴图。最稳。
- **复制SVG**：尝试把矢量 SVG 放进剪贴板；浏览器多半不允许，会自动退回复制源码文本。
- **下载SVG**：保存成 `.svg` 文件，再用“插入→图片”插入，可得真正矢量（新版 WPS/Word 支持）。
- **白底/透明**：切换；透明模式下复制出来的 PNG 是透明底（贴进彩色单元格不带白框）。
- **字号**滑块：调大让截图/复制更清晰。

## 注意

- 剪贴板复制需要安全上下文——本页用 `http://localhost` 已满足。**Chrome / Edge / Arc 最稳**；
  Firefox 对 `ClipboardItem` 支持弱，复制 PNG 可能失败，建议用 Chrome 系浏览器打开。
- 用户也能脱离 AI 独立使用：在左侧文本框直接敲 LaTeX → 点“渲染”。
- 离线可用：MathJax 库已随 skill 打包；首次若缺失会联网补下一次，之后纯离线。

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [caoxg](https://github.com/caoxg)
- **Source:** [caoxg/math-worksheet](https://github.com/caoxg/math-worksheet)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-caoxg-math-worksheet-math-worksheet
- Seller: https://agentstack.voostack.com/s/caoxg
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
