/che-latex-mcp:latex-visual-difffrom che-latex-mcp
改動 LaTeX source 後做視覺 diff,知道改動影響哪幾頁 — 用 compile_diff(git_ref) 自動 checkout + compile + compare,或用 compare_pdfs 比兩個既存 PDF。當用戶說「視覺 diff」「比較改動前後」「我改了 X 影響哪幾頁」「跟上一版比」「visual regression」時使用。也適用於 batch 修完想驗證、release 前 ripple 檢查。
Ships in che-latex-mcp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
「改完不知道影響哪幾頁」是 LaTeX batch 修最大的 friction。這個 skill 把「改動 → 視覺 attribution」壓縮成單一 tool call。
用戶說:
/latex-visual-diff或 implicit 場景:
用戶想看「跟某個 commit 比改了什麼」。
compile_diff(
project_path,
main_file?, # 預設 main
engine?, # 預設 xelatex
git_ref, # HEAD~1(預設)/ HEAD~3 / branch-name / commit-sha
page_range?,
output_dir? # 預設 /tmp/latex_diff
)
工具會:
git worktree add 把 ref checkout 到暫存目錄前置條件:當前 PDF 必須已編譯(current branch 的 main.pdf 存在)。如果還沒,先跑 compile_latex 再 call 這個。
用戶手動保存 baseline PDF,或要比兩個 release 版本。
compare_pdfs(
before_pdf, # baseline PDF path
after_pdf, # current PDF path
page_range?,
output_dir?,
save_diff_images? # 預設 true
)
問用戶或從 context 推斷:
call 對應的 tool。等 30 秒 - 2 分鐘(baseline 編譯需要時間)。
工具回傳的是「哪幾頁變了 + diff PNG path」。不要直接 dump 整 list 給用戶,而是:
範例輸出:
## 視覺 diff: HEAD~1 → 當前
改動的 .tex 檔案(從 git diff):
- 02_暑期班/part1_心理測驗/ch04_信度/ch04.tex
- 02_暑期班/00_common/commands.tex
### 影響頁面(共 6 頁)
**Group 1 — ch04 信度(4 頁,預期內)**
- p.66, 67, 69, 71: 2-15% 像素改變
- 對應改動:ch04 Cohen κ vocabbox + ICC vocabbox
- diff PNG: /tmp/latex_diff/diff_p66.png ⋯⋯
**Group 2 — ch10(2 頁,⚠️ 意外 ripple)**
- p.185, 186: 0.5% 像素改變
- 對應改動:commands.tex examitem env 改了 → 影響所有 examitem 渲染
- diff PNG: /tmp/latex_diff/diff_p185.png
- 建議:抽一頁 visual check 確認 examitem 改動 OK
compile_diff 需要 git repo:如果 project 不在 git 內,會 error,改用 compare_pdfs + 手動 baselineWhat SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/latex-page-locate查出一段文字印在 PDF 的第幾頁,或反過來驗證「某段文字是不是真的在第 N 頁」。當用戶說「這段在第幾頁」「頁碼是多少」「頁碼對不對」「幫我查頁碼」「勘誤要填 location」「errata 的頁碼」「這條勘誤指到哪一頁」「核一下頁碼」時使用。也用於寫 errata.yaml / release.yaml 的 `location:` 欄位之前,以及批次稽核既有頁碼是否仍然正確(改版重排之後頁碼會整批位移)。/latex-precompileLaTeX source 編譯前的 static check — punct_check(半形/全形標點)+ fonts_check(字型缺字,需既有 .log)+ source-level pattern audit。當用戶說「precompile check」「編譯前檢查」「跑 make check」「source audit」「掃半形標點」「掃缺字」時使用。對應暑期班 typesetting-checklist 的/latex-preview-chunk預覽單一 LaTeX 片段(vocabbox / tikz 圖 / 數學公式)不必編整本 PDF — 用 compile_chunk 把片段包進 standalone class 編譯 → 單頁 PNG。當用戶說「預覽這個 vocabbox」「看一下這個 tikz 長怎樣」「試試這個公式」「快速看片段」「不要編整本」時使用。Other plugins' skills for the same job
npx claudepluginhub psychquant/psychquant-claude-plugins --plugin che-latex-mcp