latex-setup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLaTeX Environment Setup
LaTeX环境搭建
When to Use This Skill
何时使用该技能
Use this skill when:
- Installing LaTeX on a new machine
- Setting up MacTeX distribution
- Configuring Skim PDF viewer with SyncTeX
- Verifying LaTeX installation
- Troubleshooting missing packages
在以下场景使用本技能:
- 在新设备上安装LaTeX
- 搭建MacTeX发行版环境
- 配置支持SyncTeX的Skim PDF阅读器
- 验证LaTeX安装情况
- 排查缺失包问题
Quick Reference
快速参考
Recommended Stack
推荐技术栈
| Component | Purpose | Status |
|---|---|---|
| MacTeX 2025 | Full LaTeX distribution (TeX Live 2025) | ✅ Recommended |
| Skim 1.7.11 | PDF viewer with SyncTeX support | ✅ macOS only |
| TeXShop 5.57 | Integrated LaTeX IDE (optional) | ✅ Native macOS |
| 组件 | 用途 | 状态 |
|---|---|---|
| MacTeX 2025 | 完整LaTeX发行版(基于TeX Live 2025) | ✅ 推荐使用 |
| Skim 1.7.11 | 支持SyncTeX的PDF阅读器 | ✅ 仅适用于macOS |
| TeXShop 5.57 | 集成式LaTeX开发环境(可选) | ✅ 原生macOS应用 |
Quick Start
快速开始
Install MacTeX
安装MacTeX
bash
brew install --cask mactexbash
brew install --cask mactexSize: ~4.5 GB (includes everything)
大小:约4.5 GB(包含全部组件)
undefinedundefinedVerify Installation
验证安装
bash
tex --versionbash
tex --versionExpected: TeX 3.141592653 (TeX Live 2025)
预期结果:TeX 3.141592653 (TeX Live 2025)
pdflatex --version
latexmk --version
undefinedpdflatex --version
latexmk --version
undefinedTest Compilation
测试编译
bash
echo '\documentclass{article}\begin{document}Hello World!\end{document}' > test.tex
pdflatex test.tex
ls test.pdf # Verify PDF createdbash
echo '\documentclass{article}\begin{document}Hello World!\end{document}' > test.tex
pdflatex test.tex
ls test.pdf # 验证PDF文件已生成Post-Installation Checklist
安装后检查清单
- Verify shows TeX Live 2025
tex --version - Verify shows 4.86a+
latexmk --version - Verify creates PDF
pdflatex test.tex - Install Skim if using mactex-no-gui
- Test SyncTeX: compile with flag
-synctex=1 - Configure Skim preferences for editor integration
- Add to PATH if needed
/Library/TeX/texbin - Test package installation:
sudo tlmgr install <package>
- 验证显示TeX Live 2025
tex --version - 验证显示4.86a+
latexmk --version - 验证可生成PDF文件
pdflatex test.tex - 若使用mactex-no-gui,需安装Skim
- 测试SyncTeX:使用参数编译
-synctex=1 - 配置Skim偏好设置以实现编辑器集成
- 若需要,将添加至PATH环境变量
/Library/TeX/texbin - 测试包安装:
sudo tlmgr install <package>
Reference Documentation
参考文档
For detailed information, see:
- Installation - Full MacTeX vs lightweight options, Skim installation
- Verification - Check installation, verify PATH, test compilation
- Package Management - Check, install, search for packages with tlmgr
- Skim Configuration - Enable SyncTeX, configure preferences for editor integration
- Troubleshooting - PATH issues, tlmgr problems, permissions
See Also:
- Build Workflows: Use skill for latexmk automation
latex/build - Table Creation: Use skill for tabularray usage
latex/tables
如需详细信息,请查看:
- 安装指南 - MacTeX完整版与轻量版对比、Skim安装方法
- 验证指南 - 检查安装情况、验证PATH、测试编译
- 包管理 - 使用tlmgr检查、安装、搜索包
- Skim配置 - 启用SyncTeX、配置编辑器集成偏好设置
- 问题排查 - PATH问题、tlmgr故障、权限问题
扩展参考:
- 构建工作流:使用技能实现latexmk自动化
latex/build - 表格创建:使用技能使用tabularray
latex/tables
Troubleshooting
问题排查
| Issue | Cause | Solution |
|---|---|---|
| tex command not found | PATH not configured | Add |
| Permission denied (tlmgr) | Need sudo for system packages | Use |
| Package not found | Missing from TeX Live | Run |
| Skim not showing PDF | SyncTeX not enabled | Compile with |
| Outdated TeX Live | Old MacTeX version | Run |
| Compilation hangs | Infinite loop in document | Check for circular includes or missing \end{} |
| Missing font error | Font not in TeX distribution | Install with |
| Disk space error | Full TeX Live too large | Consider BasicTeX (smaller) if space limited |
| 问题 | 原因 | 解决方法 |
|---|---|---|
| tex命令未找到 | PATH环境变量未配置 | 在shell配置文件中添加 |
| 权限不足(tlmgr) | 系统级包需要sudo权限 | 使用 |
| 包未找到 | 包不在TeX Live仓库中 | 运行 |
| Skim无法显示PDF | 未启用SyncTeX | 使用 |
| TeX Live版本过时 | MacTeX版本过旧 | 运行 |
| 编译过程卡住 | 文档存在无限循环 | 检查是否有循环引用或缺失 |
| 字体缺失错误 | 字体未包含在TeX发行版中 | 使用 |
| 磁盘空间不足错误 | 完整TeX Live体积过大 | 若空间有限,可考虑使用BasicTeX(轻量版) |