npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@fffangchenghao/dsh-latex-look

v0.4.5

Published

See what a LaTeX page actually looks like: compile, render the page to an image, map a point or text anchor back to the source line, and diff the page against the previous build. CLI, MCP server and DSH plugin over one core.

Readme

latex-look — 让 Agent 真正「看见」你的 LaTeX

npm license English · 简体中文

左:编译零错误,但页面是错的。右:五句话之后的同一页

左边编译零错误:标题上下各一条横线、表格是带竖线的网格、长链接冲出版心、 图顶到了页边。右边是五句人话之后的同一页。可直接复现:examples/broken-layout。


它解决什么问题

一个只会读 .tex 源码的 Agent 是瞎的。

文档可以编译零错误、打开正常,但读者一眼就看出不对:这页最上面多了一条横线、这个表格丑、 这段文字压到了页边、图太大了、两页之间空了一大块、图号怎么从 3-4 跳回 3-3 了…… 这些没有一条是编译错误,grep 也搜不到——那条横线根本不在源码里,它是宏包画的。

这类需求你只能这样表达:

「把这一页最上面的横线去掉」「这个表格改成三线表」「图小一点」 「这两页之间空太多了,填满」「图号顺序不对」

latex_look 就是让 Agent 接得住这些话:编译 → 渲染成图 → 定位到源码行 → 改完再比一次, 一个调用做完。Agent 于是能进入 看 → 诊断 → 改 → 再看 → 确认 的循环,而不是改完就说「应该好了」。

三个能力,一个动词

| 你说的话 | 它做什么 | |---|---| | 「这页最上方的横线去掉」 | 在预览里找到横线,再核对附近的绘线命令。页眉装饰线的来源无法确认时,返回最近的源码位置并注明原因 | | 「表格改成三线表」 | 改完渲染,用像素 diff 告诉你只动了表格、没碰正文 | | 「图号顺序不对」 | 扫全书阅读顺序,直接列出 图 3-4 (p63) → 图 3-3 (p64) | | 「这次改动有没有弄坏别处」 | 用全书 audit 找出相较上一次审计新增或明显加深的留白,列出所在页和深度。同一份 PDF 翻页时仍能看到这次的结果 |

latex-look main.tex --page 62                    # 渲染第 62 页
latex-look main.tex --text "图 3-1"              # 定位到源码行并显示所在页
latex-look main.tex --page 62 --text "实验结果"   # 同一句话出现多次时,只找第 62 页
latex-look main.tex --page 62 --compare previous # 与上一版并排对比
latex-look main.tex --page 1  --sequence 图       # 检查图号阅读顺序
latex-look main.tex --page 1  --audit             # 全书版面回归审计

--page 从 PDF 第一张数起。--text 匹配一行源码里连续出现的文字。同一段源码被多次 \input 时,可以在指定页用坐标定位。坐标从左上角量起,原始预览图的像素坐标乘以 72 / dpi 就是插件使用的 PDF 点数。

全书审计会为每个 --audit-blank 阈值单独建立基线。改稿前后使用同一阈值,就能看到哪些页新增了留白、哪些原有留白明显加深。旧版审计记录会在升级后第一次使用相应阈值时重新建立。

这不是「AI 帮你写 LaTeX」

写 LaTeX 的工具已经很多了(生成、补全、编译服务)。这个工具管的是验收: 改完之后,那份 PDF 到底对不对。

这也是为什么它值得单独存在——编译器只保证「不是错误」,不保证「好看」。

真实战绩

用一本 215 页的中文技术书(6 章、163 张图、129 个公式、术语表、目录)当靶子, 读者只能看 PDF、逐像素量、拒绝「我觉得没问题」:

  • 编译错误 0,Overfull hbox 0
  • 163 个图题全部按阅读顺序,0 处倒序
  • 129 个公式编号分章连续 (1-1) … (6-1)
  • 9 处「页面下方空一大块」全部压到 ≤56 mm
  • 六章首页首行墨迹全部 17.0% 页高——没有任何一章被图占了章名位置

完整记录(含每个缺陷的成因与修法):CASE-STUDY.md。

安装

需要 Node ≥ 18、TeX 引擎(xelatex/lualatex/pdflatex/latexmk 或 tectonic)、 synctex、ghostscript。

DeepSeek Harness 插件形态:

plugin_manager  action: install_bundle  target: @fffangchenghao/dsh-latex-look

命令行形态:

npm i -g @fffangchenghao/dsh-latex-look

MCP 形态(Claude Desktop / Cursor / Codex 等任何支持 MCP 的客户端):

{
  "mcpServers": {
    "latex-look": {
      "command": "npx",
      "args": ["-y", "@fffangchenghao/dsh-latex-look", "mcp"]
    }
  }
}

放在 Claude Desktop 的 claude_desktop_config.json、Cursor 的 ~/.cursor/mcp.json, 或在 ~/.codex/config.toml 里写成:

[mcp_servers.latex-look]
command = "npx"
args = ["-y", "@fffangchenghao/dsh-latex-look", "mcp"]

三种形态共用一个 lib/core.mjs:同样的测量、同样的措辞、同样的坑。它只暴露一个工具 latex_look,参数与插件完全一致;页面以图片内容块返回,模型直接看见那一页。 已收录进官方 MCP Registry,名称 io.github.fangchenghao/latex-look——客户端可以直接按名字搜索安装;也已提交 awesome-mcp-servers。

Agent 的「眼睛」由工具提供;SKILL.md 提供「看到症状之后怎么改」的知识—— 一份症状 → 成因 → 修法的手册,例如「读者说的那条横线通常是 \pagestyle/fancyhdr, 不是某个 \hline」。

更新

插件每天在后台查一次 npm,有新版本时在一次工具回复里加一行提示;离线时完全静默。

latex-look --version
latex-look --check-update

许可

MIT。