/che-latex-mcp:latex-preview-chunkfrom che-latex-mcp
預覽單一 LaTeX 片段(vocabbox / tikz 圖 / 數學公式)不必編整本 PDF — 用 compile_chunk 把片段包進 standalone class 編譯 → 單頁 PNG。當用戶說「預覽這個 vocabbox」「看一下這個 tikz 長怎樣」「試試這個公式」「快速看片段」「不要編整本」時使用。
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.
「我改了一個 vocabbox 但不想等 30 秒編整本」這種場景的快速預覽工具。把片段 wrap 進 standalone document class 編出單頁 PDF + PNG。
用戶說:
/latex-preview-chunk或 implicit:
如果用戶貼了 LaTeX 片段 → 直接拿來用。 如果用戶指向 file:line range(如「ch04.tex line 100-120 的 vocabbox」)→ Read 該段 source。
關鍵問題:這個 chunk 用了哪些 custom command / environment?
如果片段引用 custom env,必須給 preamble_path 指向 project 的 commands.tex 或 preamble.tex。沒給 preamble 編 vocabbox 會炸(環境未定義)。
compile_chunk(
tex_fragment, # 不含 \documentclass、\begin{document}
preamble_path?, # commands.tex / preamble.tex 路徑(含 custom env 時必填)
output_dir?, # 預設 /tmp/latex_chunk
engine? # 預設 xelatex
)
工具會:
\documentclass[border=10pt]{standalone} + \input{preamble} + \begin{document}工具回傳 path,主動 Read PNG 載入視覺結果,給用戶評估。如果 user 看了不滿意要 iterate,回 Step 1。
compile_chunk(
tex_fragment: """
\\begin{vocabbox}{Cohen's $\\kappa$ 係數}
\\begin{vocabdesc}
\\item[\\uline{公式}] 校正純機率後的吻合率:
$$\\kappa = \\frac{p_o - p_e}{1 - p_e}$$
\\end{vocabdesc}
\\end{vocabbox}
""",
preamble_path: "/path/to/project/00_common/commands.tex"
)
compile_chunk(
tex_fragment: """
\\begin{tikzpicture}
\\node[draw, rounded corners=8pt] (a) at (0,0) {根節點};
...
\\end{tikzpicture}
""",
preamble_path: "/path/to/project/00_common/preamble.tex"
)
compile_chunk(
tex_fragment: """
$$\\text{AVE} = \\frac{\\sum_{i=1}^{k} \\lambda_i^2}{k}$$
"""
)
\input{commands} 之類:直接 pass preamble.tex 即可,會 cascade load 進來\input 相對路徑 → 可能 work dir 不同會找不到。改 pass 絕對路徑或先 wrap 進臨時 preambleWhat 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-validate編譯 LaTeX 專案後跑完整 layout 驗證流程 — detect_layout_issues + find_overlaps + fonts_check + box_warnings。當用戶說「驗證 LaTeX」「檢查排版」「掃 layout 問題」「LaTeX 編完看看有沒有 bug」「latex audit」或在 LaTeX 專案目錄編譯後想自動 audit 時使用。也適用於 commit 前驗證、release 前 audit、暑校稿 batch 修完想知道剩餘 issue。Other plugins' skills for the same job
npx claudepluginhub psychquant/psychquant-claude-plugins --plugin che-latex-mcp