TeX Live
$ pdflatex 基金会 中风险TeX Live 是权威的跨平台 TeX/LaTeX 发行版,内置 pdflatex、xelatex、lualatex 与 bibtex。在无头 Agent 环境中必须传入 -interaction=nonstopmode 与 -halt-on-error,否则 pdflatex 遇到语法错误会进入交互式 ? 提示符并挂起。
brew install texlive 本地 TeX Live 编译直接读写项目 .tex 目录树,用 MCP 包装 pdflatex 只会增加无谓的中间层。
Agent 友好度体检单
当前为静态评估(本机尚未安装或尚未运行探针)。可在本地运行 npm run data:probe 并提交 data/probes/ 升级为实测证据。
FCRS-1.0 六维评分拆解
未传入 -interaction=nonstopmode 时遇到错误会进入交互提示阻塞,默认输出冗长的多页 .log 文本且无 JSON 模式,并常需多轮编译解析引用。
- Hangs at interactive
?prompt on errors without-interaction=nonstopmode - No JSON output; noisy plain-text compiler logs
默认会在工作目录生成大量辅助文件(.aux、.log、.toc),且 --shell-escape 允许 .tex 宏执行任意系统命令。
--shell-escapeenables arbitrary shell execution inside TeX macros- Default execution pollutes the working directory unless
-output-directoryis set
覆盖 macOS、Linux 与 Windows,但完整 TeX Live 发行版高达数 GB,在临时沙箱中安装耗时。
- Full
texlivedistribution exceeds several gigabytes
对传统学术论文和期刊模板具有无可替代的宏包兼容性,但对 Agent 而言比 tectonic 或 typst 更慢且输出更嘈杂。
- Complete compatibility with CTAN packages and journal templates
由 TeX Users Group(TUG)长期维护并按年度发布协调版本。
- Official TeX Users Group distribution
具备完备的 man 手册与 TUG 指南,但历史参数沿袭数十年 TeX 习惯。
- Official documentation at tug.org/texlive/doc.html
安全边界、鉴权与放权指南
无需凭据;仅操作本地 .tex 文件与系统 TeX 目录树。
100% 免费开源(LPPL / GPL);完整发行版约需 5 GB 磁盘空间。
# TeX Live (pdflatex) Agent Rules - ALWAYS pass `-interaction=nonstopmode -halt-on-error` so syntax errors do not hang on an interactive `?` prompt. - NEVER pass `--shell-escape` on untrusted `.tex` files (allows arbitrary shell command execution). - Use `-output-directory=build` to isolate `.aux`, `.log`, and `.pdf` outputs.
Agent 高频安全命令配方
只读查询(安全推荐)
pdflatex -interaction=nonstopmode -halt-on-error -draftmode -output-directory=/tmp/texcheck main.tex
以 -draftmode 检查 main.tex 而不生成最终 PDF,同时避免在报错时卡在交互提示符。
受控写入与预演
pdflatex -interaction=nonstopmode -halt-on-error -output-directory=build main.tex
将 PDF 与 .aux/.log 产物输出至 build,并在遇到 LaTeX 错误时立即失败退出。
核心优势
- + 完整兼容 CTAN 宏包与各类学术期刊模板。
- + 支持
-draftmode与-output-directory以隔离检查输出。
注意事项与踩坑点
- ! 未显式传入
-interaction=nonstopmode时遇到语法错误会无限等待标准输入。 - ! 数 GB 安装体积及多轮编译需求使其在轻量 Agent 容器中较为沉重。
- ! 冗长的纯文本日志相比现代编译器会消耗更多上下文 Token。