latex-document by ndpvt-web/latex-document-skill
npx skills add https://github.com/ndpvt-web/latex-document-skill --skill latex-document创建任意 LaTeX 文档,编译为 PDF,并生成 PNG 预览。将任意类型的 PDF 转换为 LaTeX。
assets/templates/ 复制合适的模板或从头开始编写python3 <skill_path>/../generate-image/scripts/generate_image.py "prompt" --output ./outputs/figure.pngpython3 <skill_path>/scripts/generate_chart.py <type> --data '<json>' --output chart.png广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
bash <skill_path>/scripts/mermaid_to_image.sh diagram.mmd output.png</>,变换章节格式,限制 \newpage 的使用,图像尺寸设为 0.75-0.85 文本宽度。scripts/compile_latex.sh 编译(自动检测 CJK/RTL、术语表、参考文献以选择 XeLaTeX)当用户请求海报时:阅读 references/poster-design-guide.md 获取完整工作流程,包括会议尺寸预设(NeurIPS/ICML/CVPR/ICLR 尺寸)、布局原型(传统/BetterPoster/视觉主导)、配色方案和排版标准。使用 poster.tex(纵向)或 poster-landscape.tex(横向)。使用 AskUserQuestion 询问用户会议/方向、布局样式和配色方案,然后继续步骤 5。
当用户请求速查表、参考卡片或公式表时:
cheatsheet.tex(通用,3 列横向)、cheatsheet-exam.tex(考试公式,2 列纵向)或 cheatsheet-code.tex(编程,4 列横向)。使用 scripts/mail_merge.py 从 LaTeX 模板 + CSV/JSON 数据源生成 N 个个性化文档。模板语法:{{variable}} 用于简单替换,Jinja2 (<< >>, <% %>) 用于条件/循环。示例请参见 assets/templates/mail-merge-letter.tex。完整指南:references/interactive-features.md。
使用 scripts/latex_diff.sh 生成带高亮显示的变更追踪 PDF。支持文件到文件差异比较、Git 修订版本差异比较、多文件扁平化处理和自定义标记样式。完整指南:references/interactive-features.md。
使用 scripts/convert_document.sh 在 Markdown、DOCX、HTML 和 LaTeX 之间进行转换。完整指南:references/format-conversion.md。
将现有 PDF(手写笔记、打印报告、法律文件)转换为 LaTeX。完整流程:references/pdf-conversion.md。
快速步骤:将 PDF 分割为页面图像(scripts/pdf_to_images.sh),选择转换配置文件,创建共享导言区,应用缩放策略,使用 scripts/validate_latex.py 验证,连接,编译。
缩放策略:1-10 页 = 单个代理;11-20 页 = 分成两半(2 个代理);21+ 页 = 批量-7 管道(ceil(N/7) 个代理,使用 run_in_background: true)。
转换配置文件(位于 references/profiles/):math-notes.md(方程、定理 -- 包含精美模式)、business-document.md(报告、备忘录)、legal-document.md(合同、法规)、general-notes.md(手写、混合内容)。
填写现有 PDF 表单——包括可填写(带有表单域)和不可填写(基于图像)的表单。完整指南:references/pdf-operations.md。
步骤 1:检查表单类型:
python3 <skill_path>/scripts/pdf_check_form.py form.pdf
如果是可填写表单(有表单域):
# 提取字段元数据
python3 <skill_path>/scripts/pdf_extract_fields.py form.pdf field_info.json
# 创建 field_values.json 并为每个字段赋值,然后填充
python3 <skill_path>/scripts/pdf_fill_form.py form.pdf field_values.json output.pdf
如果是不可填写表单(无表单域):
# 转换为图像以进行视觉分析
bash <skill_path>/scripts/pdf_to_images.sh form.pdf ./tmp/pages
# 视觉识别字段,创建带有边界框的 fields.json
# 验证边界框(+ 可选的验证图像)
python3 <skill_path>/scripts/pdf_validate_boxes.py fields.json --image page_1.png --output validation.png --page 1
# 使用文本注释填充
python3 <skill_path>/scripts/pdf_fill_annotations.py form.pdf fields.json output.pdf
关于文本/表格提取(pdfplumber)、OCR(pytesseract)、程序化 PDF 创建(reportlab)、添加水印、页面旋转/裁剪、元数据提取、JavaScript 库(pdf-lib, pdfjs-dist)和批处理,请参见 references/pdf-operations.md。
# 基本编译(自动检测引擎)
bash <skill_path>/scripts/compile_latex.sh document.tex
# 编译 + 生成 PNG 预览
bash <skill_path>/scripts/compile_latex.sh document.tex --preview
# 编译 + 在指定目录生成 PNG
bash <skill_path>/scripts/compile_latex.sh document.tex --preview --preview-dir ./outputs
# 强制使用特定引擎
bash <skill_path>/scripts/compile_latex.sh document.tex --engine xelatex
bash <skill_path>/scripts/compile_latex.sh document.tex --engine lualatex
# 使用 latexmk 进行自动多轮编译(推荐用于复杂文档)
bash <skill_path>/scripts/compile_latex.sh document.tex --use-latexmk --preview
# 用于论文提交和归档合规性的 PDF/A 输出
bash <skill_path>/scripts/compile_latex.sh document.tex --pdfa
# 详细输出,用于调试编译问题
bash <skill_path>/scripts/compile_latex.sh document.tex --verbose
# 批处理/CI 作业的静默模式(仅显示错误)
bash <skill_path>/scripts/compile_latex.sh document.tex --quiet
# 仅清理辅助文件(不编译)
bash <skill_path>/scripts/compile_latex.sh document.tex --clean
| 标志 | 描述 |
|---|---|
--preview | 编译后为每页生成 PNG 预览 |
--preview-dir DIR | PNG 输出目录(默认:与 .tex 文件相同) |
--engine ENGINE | 强制使用引擎:pdflatex、xelatex 或 lualatex |
--use-latexmk | 使用 latexmk 作为编译后端(自动多轮编译、参考文献、索引) |
--verbose | 显示完整编译输出(所有引擎日志) |
--quiet | 抑制所有非错误输出 |
--clean | 删除辅助文件(.aux、.log、.bbl、.fdb_latexmk 等)并退出 |
--pdfa | 生成符合 PDF/A-2b 标准的输出(自动注入 pdfx 包) |
--auto-fix | 自动修复常见编译错误(浮动体位置、编码) |
手动多轮编译(默认): 根据需要运行引擎多次,包括参考文献/索引/术语表轮次。这是传统方法,无需安装 latexmk 即可工作。
latexmk (--use-latexmk): 使用 latexmk 进行自动依赖驱动编译。推荐用于包含参考文献、索引、术语表或交叉引用的复杂文档——latexmk 会自动确定正确的编译轮次。需要 latexmk(包含在 TeX Live 中)。
当安装了 texfot(包含在 TeX Live 中)时,编译输出会自动过滤,仅显示相关的警告和错误,抑制嘈杂的包加载信息。这适用于默认的详细模式。使用 --verbose 查看未过滤的输出,或使用 --quiet 抑制所有非错误输出。
引擎自动检测:如果 .tex 文件使用 fontspec、xeCJK 或 polyglossia,脚本会自动使用 xelatex。如果使用 luacode 或 luatextra,则使用 lualatex。否则默认使用 pdflatex。可使用 --engine 覆盖。
如果缺少 texlive(包括 texlive-science、texlive-xetex、texlive-luatex、biber)和 poppler-utils,脚本会自动安装。它会自动检测 \bibliography{}(运行 bibtex)、\addbibresource{}(运行 biber)、\makeindex(运行 makeindex)、\makeglossaries(运行 makeglossaries),运行正确的编译轮次,使用 pdftoppm 生成 PNG 预览,并清理辅助文件。
关于 PDF 实用工具(加密、合并、优化、提取页面、pdf 转图像)、LaTeX 质量工具(语法检查、字数统计、分析、包检查、引用)、编译自动修复、参考文献获取和图表脚本(Mermaid、Graphviz、PlantUML),请参见 references/script-tools.md。
从 assets/templates/ 复制并自定义。
根据经验水平、行业和 ATS 要求进行选择。完整的 ATS 指南请参见 references/resume-ats-guide.md。
| 模板 | 最适合 | 关键特性 | ATS 评分 |
|---|---|---|---|
resume-classic-ats.tex | 金融、法律、政府、任何 ATS 门户 | 零图形、纯文本、最大解析安全性 | 10/10 |
resume-modern-professional.tex | 科技、企业、通用专业领域 | 微妙的色彩点缀、简洁设计、良好的 ATS 和人工吸引力 | 9/10 |
resume-executive.tex | 副总裁、总监、C 级高管(5-15+ 年经验) | 两页、高管摘要、董事会角色、P&L 重点 | 9/10 |
resume-technical.tex | 软件、数据、工程类职位 | 技能优先的混合型、项目部分、技术栈强调 | 9/10 |
resume-entry-level.tex | 应届毕业生、职场新人 | 教育优先、一页、课程作业、活动 | 9/10 |
所有 5 个模板都遵循 ATS 规则:单栏、无图形/图像、无用于布局的表格、标准章节标题、联系信息在正文中(不在页眉/页脚)。
homework.tex -- 作业/任务提交模板(article 类,11pt),带有可切换的解答(\showsolutionstrue/\showsolutionsfalse)、自定义问题/解答环境、诚信守则部分、fancyhdr 页眉、amsmath+amssymb+amsthm 数学支持、listings 代码高亮(Python、Java、C++、Matlab 样式)、enumitem 用于 (a)、(b)、(c) 子部分、hyperref。可通过 \coursename、\assignmentnumber、\studentname、\studentid、\duedate 自定义。示例问题:微积分、数学归纳法证明、Python 编码、矩阵代数、运动学、Java OOP。lab-report.tex -- STEM 实验报告模板(article 类,11pt),包含 siunitx 用于不确定度和 SI 单位、pgfplots 用于数据可视化、booktabs 用于专业表格、amsmath 用于方程、fancyhdr 页眉、caption+subcaption 用于图表。结构化章节:摘要、理论、步骤、数据/结果(含不确定度表格)、分析(pgfplots 图表)、讨论(误差分析)、结论、参考文献、附录。示例:摆锤周期测量与误差传播。lecture-notes.tex -- 精美的课堂笔记(scrartcl KOMA-Script 类),使用 Palatino 字体、microtype 排版、颜色编码的 tcolorbox 定理环境(蓝色定理、绿色定义、橙色示例、紫色备注)、TikZ 图论图表样式和宏(\CompleteGraph、\CycleGraph、\PathGraph)、使用 titlesec 的样式化章节标题、fancyhdr 页眉、hyperref + cleveref 导航。非常适合将手写数学/科学笔记转换为精美的 PDF。包含图论自定义命令(\V、\E、\deg、\chr)。被 math-notes 转换配置文件在精美模式下使用。thesis.tex -- 学位论文/博士论文(book 类),包含标题页、声明、摘要、致谢、目录、图/表列表、章节、附录、参考文献。前页使用罗马数字,正文使用阿拉伯数字。包含定理环境。academic-cv.tex -- 多页学术简历,包含出版物(期刊/会议/预印本部分)、资助和基金、教学、指导(当前/已毕业学生)、奖项、专业服务、特邀报告。ORCID 和 Google Scholar 链接。book.tex -- 完整书籍(book 类),包含半标题页、标题页、版权页、献词、前言、致谢、目录、图/表列表、部分、章节、附录、参考文献、索引。自定义章节标题、题词、fancyhdr、microtype。poster.tex -- 会议海报(tikzposter 类,A0 纵向),包含 2 栏布局、二维码、5 种配色方案、tikzfigure 图表、表格、coloredbox 高亮。包含注释掉的 #BetterPoster 布局变体(中央广告牌 + 侧边栏)。纵向是大多数会议的标准。会议尺寸预设请参见海报设计指南。poster-landscape.tex -- 横向会议海报(tikzposter 类,A0 横向),包含 3 栏(30/40/30)布局、二维码、科技紫色配色方案。适用于 CS/ML 会议(NeurIPS、ICML、CVPR、ICLR)。包含注释掉的 \geometry{} 预设,用于 CVPR/NeurIPS 自定义尺寸。cheatsheet.tex -- 通用参考卡片(extarticle 类,横向 A4,7pt 基准字体),包含 3 栏 multicols 布局、tcolorbox 彩色章节框、紧凑间距。适用于命令参考、概念总结、快速参考指南。支持正反面打印。cheatsheet-exam.tex -- 考试公式表(extarticle 类,纵向 A4,6pt 基准字体),包含 2 栏布局、最大内容密度、黑白打印安全。适用于大学考试“允许携带的速查表”,包含公式、定理、定义。针对单面打印进行了优化。cheatsheet-code.tex -- 编程参考卡片(extarticle 类,横向 A4,7pt 基准字体),包含 4 栏布局、minted 语法高亮、等宽字体强调。适用于语言语法、API 参考、CLI 命令、键盘快捷键。letter.tex -- 正式商务信函,包含彩色信头栏、TikZ 徽标占位符、公司信息、收件人信息块、日期、主题行、签名。专业企业外观。exam.tex -- 考试/测验(exam 类),包含评分表、多种问题类型(多项选择、判断对错、填空、匹配、简答、论述)、分值、通过 \printanswers 切换解答。report.tex -- 商务报告,包含目录、页眉/页脚、数据表格、条形图(pgfplots)、流程图(TikZ)、建议cover-letter.tex -- 专业求职信,包含发件人/收件人信息块invoice.tex -- 发票,包含公司抬头、行项目表格、小计/税费/总计academic-paper.tex -- 研究论文,包含摘要、章节、参考文献、图表。包含示例 .bib 文件(references.bib)用于 BibTeX 引用。presentation.tex -- Beamer 演示文稿,包含标题幻灯片、内容页、分栏fillable-form.tex -- 可填写的 PDF 表单(article 类),包含 hyperref 表单域:文本输入框、复选框、单选按钮、下拉列表、按钮。使用 tabularx 的两栏布局。自定义 \FormField、\FormCheck、\FormDropdown 辅助命令。需要 Adobe Reader 以获得完整的表单支持(浏览器 PDF 查看器的表单功能有限)。conditional-document.tex -- 可配置文档(article 类),包含 etoolbox 切换系统:显示/隐藏目录、附录、水印、草稿模式、机密标记、摘要。通过 \providecommand 的模板变量(标题、作者、组织、版本)。三种视觉配置文件(企业、学术、极简)。支持 CI/CD 的命令行变量传递。mail-merge-letter.tex -- 邮件合并信函模板,包含 {{variable}} 占位符,用于 scripts/mail_merge.py。公司品牌信头、收件人地址块、带有数据驱动个性化的正文。与 CSV/JSON 数据源配对使用。resume.tex -- 旧版简历模板(包含照片区域和表格——未针对 ATS 优化)用法:
cp <skill_path>/assets/templates/resume-classic-ats.tex ./outputs/my_resume.tex
# 编辑内容,然后编译
bash <skill_path>/scripts/compile_latex.sh ./outputs/my_resume.tex --preview --preview-dir ./outputs
| 用户请求 | 模板 | 文档类 |
|---|---|---|
| 简历、履历(ATS 安全) | resume-classic-ats.tex | article |
| 简历(现代外观) | resume-modern-professional.tex | article |
| 简历(高级/高管) | resume-executive.tex | article |
| 简历(技术/工程) | resume-technical.tex | article |
| 简历(应届毕业生) | resume-entry-level.tex | article |
| 作业、任务、习题集 | homework.tex | article |
| 实验报告、实验记录 | lab-report.tex | article |
| 课堂笔记、数学笔记(精美) | lecture-notes.tex | scrartcl |
| 学位论文、博士论文 | thesis.tex | book |
| 学术简历(出版物、基金) | academic-cv.tex | article |
| 报告、分析 | report.tex | article |
| 求职信 | cover-letter.tex | article |
| 发票 | invoice.tex | article |
| 学术论文 | academic-paper.tex + references.bib | article |
| 书籍 | book.tex | book |
| 科学海报(纵向) | poster.tex | tikzposter |
| 科学海报(横向) | poster-landscape.tex | tikzposter |
| 速查表、参考卡片 | cheatsheet.tex | extarticle |
| 考试公式表、备忘单 | cheatsheet-exam.tex | extarticle |
| 编程参考卡片 | cheatsheet-code.tex | extarticle |
| 正式商务信函 | letter.tex | article |
| 考试、测验、测试 | exam.tex | exam |
| 幻灯片、演示文稿 | presentation.tex | beamer |
| 可填写的 PDF 表单 | fillable-form.tex | article |
| 条件/可配置文档 | conditional-document.tex | article |
| 邮件合并、批量信函 | mail-merge-letter.tex + scripts/mail_merge.py | article |
| 版本差异比较 (latexdiff) | 使用 scripts/latex_diff.sh + 参见 interactive-features.md | 视情况而定 |
| 将 PDF 转换为 LaTeX | 选择配置文件 + 参见 pdf-conversion.md | 视情况而定 |
| 转换格式 | 使用 scripts/convert_document.sh + 参见 format-conversion.md | 视情况而定 |
| 从 CSV/JSON 进行邮件合并 | 使用 scripts/mail_merge.py + 参见 interactive-features.md | 视情况而定 |
始终转义:% → \%、$ → \$、& → \&、# → \#、_ → \_
文本模式中的尖括号: 在 T1 编码的 LaTeX 文本模式中,< 和 > 是无效的。它们会显示为倒问号(¡ 或 ¿)。始终使用数学模式或文本命令:
<5% → $<$5\% 或 \textless 5\%>50 → $>$50 或 \textgreater 50<$300 → $<$\$300>= → $\geq$、<= → $\leq$这是生成的 LaTeX 中最常见的静默错误之一——文档编译没有错误,但 PDF 显示乱码字符。
日期范围使用短破折号:2019--2025(双连字符)。
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{enumitem}
\usepackage{titlesec}
关于即用型 LaTeX 代码片段(表格、图表、流程图、参考文献、水印、横向页面、多语言、图像、Mermaid 图表、matplotlib 图表、CSV 表格、AI 图像、可填写表单、条件内容、邮件合并、版本差异比较),请阅读 references/code-patterns.md。
创建报告时,请使用用户在步骤 4 中选择的增强元素。关于视觉元素工具(图表、流程图、AI 图像、表格、时间线)和尺寸指南的快速参考表,请参见 references/advanced-features.md。使用 \begin{figure}[H](来自 float 包)以防止图表浮动。使用 width=0.8\textwidth 或更小的尺寸来调整 TikZ 图表大小。
当对 LaTeX 模式、编译问题或文档质量不确定时,请查阅此表并加载相关文件。
| 主题 | 文件 | 何时阅读 |
|---|---|---|
| 长文档最佳实践 | long-form-best-practices.md | 对于 5 页以上的文档必须阅读:9 个反模式、报告导言区最佳实践、内容生成检查清单 |
| 代码模式(LaTeX 片段) | code-patterns.md | 即用型 LaTeX 代码:表格、图表、流程图、参考文献、水印、横向、多语言、图像、表单、邮件合并、差异比较 |
| 脚本与工具参考 | script-tools.md | PDF 实用工具(加密、合并、优化、提取)、LaTeX 质量工具(语法检查、字数统计、分析、包检查、引用)、编译自动修复、参考文献、图表 |
| 参考文献/引用 | bibliography-guide.md | BibTeX/biblatex、引用样式、.bib 格式 |
| 高级功能与视觉元素 | advanced-features.md | 水印、横向、多语言、代码、算法、tcolorbox、siunitx、高级图表、AI 图像、视觉元素参考表 |
| Mermaid 图表 | mermaid-diagrams.md | 流程图、序列图、类图、ER 图、甘特图、饼图、思维导图 |
| Python 图表 (matplotlib) | python-charts.md | 条形图、折线图、散点图、饼图、热力图、箱形图、直方图、面积图、雷达图 |
| 格式转换 (Pandoc) | format-conversion.md | Markdown/DOCX/HTML 与 LaTeX 相互转换 |
| 表格和图像 | tables-and-images.md | 彩色行、多行/多列、booktabs、长表格、图像、TikZ |
| 图表和图形 (pgfplots) | charts-and-graphs.md | pgfplots 中的线图、条形图、散点图、饼图 |
| LaTeX 包 | packages.md | 常用包参考 |
| 海报设计指南 | poster-design-guide.md | 会议尺寸预设、排版、配色方案、布局原型、内容指南 |
| 简历 ATS 指南 | resume-ats-guide.md | ATS 规则、LaTeX 陷阱、关键词 |
| PDF 转 LaTeX 流程 | pdf-conversion.md | 完整转换流程、缩放策略、工作代理、验证 |
| 交互式功能 | interactive-features.md | 可填写的 PDF 表单、条件内容、从 CSV/JSON 进行邮件合并、latexdiff 版本追踪 |
| 速查表设计 | cheatsheet-guide.md | 模板选择、排版、密度优化、PDF 转速查表流程 |
| PDF 转速查表提示词 | pdf-extraction-prompts.md | 用于提取阶段的 LLM 提示词:结构分析、特定主题提取、压缩、格式化 |
| 视觉包 (TikZ) | visual-packages.md | 24 个已安装的 TikZ/可视化包及工作示例 |
| Graphviz & PlantUML | graphviz-plantuml.md | .dot 转 PDF/PNG、.puml 转 PDF/PNG、LaTeX 集成 |
| 调试与错误 | debugging-guide.md | 阅读 LaTeX 错误、20 个常见错误、.log 分析、静默失败 |
| 可访问性与 PDF/A | accessibility-guide.md | 用于论文的 PDF/A、用于屏幕阅读器的 PDF/UA、带标签的 PDF、替代文本 |
| Beamer 演示文稿 | beamer-guide.md | 主题、覆盖/动画、代码幻灯片、讲义、演讲者备注 |
| 字体选择 | font-guide.md | 字体族、fontspec、数学字体、fontawesome5、microtype、CJK |
| 协作与 CI/CD | collaboration-guide.md | LaTeX 的 Git 使用、GitHub Actions、Docker、多作者工作流程 |
| PDF 操作 | pdf-operations.md | 表单填充(可填写 + 不可填写)、文本/表格提取(pdfplumber)、OCR(pytesseract)、程序化 PDF 创建(reportlab)、添加水印、旋转/裁剪、元数据、JavaScript(pdf-lib, pdfjs-dist)、批处理、性能提示 |
./outputs/ 中以便用户查看poppler-utils(脚本会自动安装)这些会导致 Undefined control sequence -- 始终
Create any LaTeX document, compile to PDF, and generate PNG previews. Convert PDFs of any type to LaTeX.
assets/templates/ or write from scratchpython3 <skill_path>/../generate-image/scripts/generate_image.py "prompt" --output ./outputs/figure.pngpython3 <skill_path>/scripts/generate_chart.py <type> --data '<json>' --output chart.pngbash <skill_path>/scripts/mermaid_to_image.sh diagram.mmd output.png</> in text mode, vary section formats, limit \newpage, size images at 0.75-0.85 textwidth.scripts/compile_latex.sh (auto-detects XeLaTeX for CJK/RTL, glossaries, bibliography)When the user requests a poster: read references/poster-design-guide.md for the complete workflow including conference size presets (NeurIPS/ICML/CVPR/ICLR dimensions), layout archetypes (Traditional/BetterPoster/Visual-Heavy), color schemes, and typography standards. Use poster.tex (portrait) or poster-landscape.tex (landscape). Ask the user for conference/orientation, layout style, and color scheme using AskUserQuestion, then proceed to step 5.
When the user requests a cheat sheet, reference card, or formula sheet:
cheatsheet.tex (general, 3-col landscape), cheatsheet-exam.tex (exam formula, 2-col portrait), or cheatsheet-code.tex (programming, 4-col landscape).Generate N personalized documents from a LaTeX template + CSV/JSON data source using scripts/mail_merge.py. Template syntax: {{variable}} for simple substitution, Jinja2 (<< >>, <% %>) for conditionals/loops. See assets/templates/mail-merge-letter.tex for an example. Full guide: references/interactive-features.md.
Generate highlighted change-tracked PDFs using scripts/latex_diff.sh. Supports file-to-file diff, git revision diff, multi-file flatten, and custom markup styles. Full guide: references/interactive-features.md.
Convert between Markdown, DOCX, HTML, and LaTeX using scripts/convert_document.sh. Full guide: references/format-conversion.md.
Convert existing PDFs (handwritten notes, printed reports, legal docs) to LaTeX. Full pipeline: references/pdf-conversion.md.
Quick steps : Split PDF into page images (scripts/pdf_to_images.sh), select a conversion profile, create shared preamble, apply scaling strategy, validate with scripts/validate_latex.py, concatenate, compile.
Scaling strategy : 1-10 pages = single agent; 11-20 pages = split in half (2 agents); 21+ pages = batch-7 pipeline (ceil(N/7) agents with run_in_background: true).
Conversion profiles (in references/profiles/): math-notes.md (equations, theorems -- has beautiful mode), business-document.md (reports, memos), legal-document.md (contracts, statutes), general-notes.md (handwritten, mixed content).
Fill existing PDF forms -- both fillable (with form fields) and non-fillable (image-based). Full guide: references/pdf-operations.md.
Step 1: Check form type:
python3 <skill_path>/scripts/pdf_check_form.py form.pdf
If fillable (has form fields):
# Extract field metadata
python3 <skill_path>/scripts/pdf_extract_fields.py form.pdf field_info.json
# Create field_values.json with values for each field, then fill
python3 <skill_path>/scripts/pdf_fill_form.py form.pdf field_values.json output.pdf
If non-fillable (no form fields):
# Convert to images for visual analysis
bash <skill_path>/scripts/pdf_to_images.sh form.pdf ./tmp/pages
# Visually identify fields, create fields.json with bounding boxes
# Validate bounding boxes (+ optional validation image)
python3 <skill_path>/scripts/pdf_validate_boxes.py fields.json --image page_1.png --output validation.png --page 1
# Fill with text annotations
python3 <skill_path>/scripts/pdf_fill_annotations.py form.pdf fields.json output.pdf
For text/table extraction (pdfplumber), OCR (pytesseract), programmatic PDF creation (reportlab), watermarking, page rotation/cropping, metadata extraction, JavaScript libraries (pdf-lib, pdfjs-dist), and batch processing, see references/pdf-operations.md.
# Basic compile (auto-detects engine)
bash <skill_path>/scripts/compile_latex.sh document.tex
# Compile + generate PNG previews
bash <skill_path>/scripts/compile_latex.sh document.tex --preview
# Compile + PNG in specific directory
bash <skill_path>/scripts/compile_latex.sh document.tex --preview --preview-dir ./outputs
# Force a specific engine
bash <skill_path>/scripts/compile_latex.sh document.tex --engine xelatex
bash <skill_path>/scripts/compile_latex.sh document.tex --engine lualatex
# Use latexmk for automatic multi-pass (recommended for complex documents)
bash <skill_path>/scripts/compile_latex.sh document.tex --use-latexmk --preview
# PDF/A output for thesis submissions and archival compliance
bash <skill_path>/scripts/compile_latex.sh document.tex --pdfa
# Verbose output for debugging compilation issues
bash <skill_path>/scripts/compile_latex.sh document.tex --verbose
# Quiet mode for batch/CI jobs (only errors shown)
bash <skill_path>/scripts/compile_latex.sh document.tex --quiet
# Clean auxiliary files only (no compilation)
bash <skill_path>/scripts/compile_latex.sh document.tex --clean
| Flag | Description |
|---|---|
--preview | Generate PNG previews of each page after compilation |
--preview-dir DIR | Directory for PNG output (default: same as .tex file) |
--engine ENGINE | Force engine: pdflatex, xelatex, or lualatex |
--use-latexmk | Use latexmk as compilation backend (auto multi-pass, bibliography, index) |
Manual multi-pass (default): Runs the engine multiple times with bibliography/index/glossary passes as needed. This is the traditional approach and works without latexmk installed.
latexmk (--use-latexmk): Uses latexmk for automatic dependency-driven compilation. Recommended for complex documents with bibliographies, indexes, glossaries, or cross-references -- latexmk determines the correct number of passes automatically. Requires latexmk (included with TeX Live).
When texfot is installed (included with TeX Live), compilation output is automatically filtered to show only relevant warnings and errors, suppressing noisy package loading messages. This applies in the default verbosity mode. Use --verbose to see unfiltered output, or --quiet to suppress all non-error output.
Engine auto-detection : If the .tex file uses fontspec, xeCJK, or polyglossia, the script automatically uses xelatex. If it uses luacode or luatextra, it uses lualatex. Otherwise defaults to pdflatex. Override with --engine.
The script auto-installs texlive (including texlive-science, texlive-xetex, texlive-luatex, biber) and poppler-utils if missing. It auto-detects \bibliography{} (runs bibtex), \addbibresource{} (runs biber), \makeindex (runs makeindex), \makeglossaries (runs makeglossaries), runs the correct number of passes, generates PNG previews with pdftoppm, and cleans auxiliary files.
For PDF utilities (encrypt, merge, optimize, extract pages, pdf-to-images), LaTeX quality tools (lint, word count, analysis, package check, citations), compilation auto-fix, bibliography fetching, and diagram scripts (Mermaid, Graphviz, PlantUML), see references/script-tools.md.
Copy from assets/templates/ and customize.
Select based on experience level, industry, and ATS requirements. See references/resume-ats-guide.md for full ATS guidance.
| Template | Best For | Key Feature | ATS Score |
|---|---|---|---|
resume-classic-ats.tex | Finance, law, government, any ATS portal | Zero graphics, plain text only, maximum parse safety | 10/10 |
resume-modern-professional.tex | Tech, corporate, general professional | Subtle color accents, clean design, good ATS + human appeal | 9/10 |
resume-executive.tex | VP, Director, C-suite (5-15+ years) | Two-page, executive summary, board roles, P&L focus | 9/10 |
resume-technical.tex |
All 5 templates follow ATS rules: single-column, no graphics/images, no tables for layout, standard section headings, contact info in body (not header/footer).
homework.tex -- Homework/assignment submission template (article class, 11pt) with toggle-able solutions (\showsolutionstrue/\showsolutionsfalse), custom problem/solution environments, honor code section, fancyhdr headers, amsmath+amssymb+amsthm math, listings code highlighting (Python, Java, C++, Matlab styles), enumitem for (a), (b), (c) sub-parts, hyperref. Customization via , , , , . Example problems: calculus, proof by induction, Python coding, matrix algebra, kinematics, Java OOP.lecture-notes.tex -- Beautiful lecture notes (scrartcl KOMA-Script class) with Palatino font, microtype typography, color-coded tcolorbox theorem environments (blue theorems, green definitions, orange examples, purple remarks), TikZ graph theory diagram styles and macros (\CompleteGraph, \CycleGraph, \PathGraph), styled section headings with titlesec, fancyhdr headers, hyperref + cleveref navigation. Ideal for converting handwritten math/science notes to beautiful PDFs. Includes graph theory custom commands (, , , ). Used by the math-notes conversion profile in beautiful mode.Usage:
cp <skill_path>/assets/templates/resume-classic-ats.tex ./outputs/my_resume.tex
# Edit content, then compile
bash <skill_path>/scripts/compile_latex.sh ./outputs/my_resume.tex --preview --preview-dir ./outputs
| User Request | Template | Document Class |
|---|---|---|
| Resume, CV (ATS-safe) | resume-classic-ats.tex | article |
| Resume (modern look) | resume-modern-professional.tex | article |
| Resume (senior/executive) | resume-executive.tex | article |
| Resume (technical/engineering) |
Always escape: % → \%, $ → \$, & → \&, # → \#, _ → \_
Angle brackets in text mode: < and > are NOT valid in LaTeX text mode with T1 encoding. They render as inverted question marks (¡ or ¿). Always use math mode or text commands:
<5% → $<$5\% or \textless 5\%>50 → $>$50 or \textgreater 50<$300 → $<$\$300>= → $\geq$, <= → $\leq$This is one of the most common silent errors in generated LaTeX — the document compiles without errors but the PDF shows garbage characters.
Date ranges use en-dash: 2019--2025 (double hyphen).
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tabularx}
\usepackage{colortbl}
\usepackage{enumitem}
\usepackage{titlesec}
For ready-to-use LaTeX code snippets (tables, charts, flowcharts, bibliography, watermarks, landscape pages, multi-language, images, Mermaid diagrams, matplotlib charts, CSV tables, AI images, fillable forms, conditional content, mail merge, version diff), read references/code-patterns.md.
When creating reports, use the enrichment elements the user selected in step 4. For the quick reference table of visual element tools (charts, flowcharts, AI images, tables, timelines) and sizing guidelines, see references/advanced-features.md. Use \begin{figure}[H] (from float package) to prevent figures from floating. Size TikZ diagrams with width=0.8\textwidth or smaller.
When uncertain about LaTeX patterns, compilation issues, or document quality, consult this table and load relevant files.
| Topic | File | When to Read |
|---|---|---|
| Long-Form Best Practices | long-form-best-practices.md | MUST READ for 5+ page documents : 9 anti-patterns, report preamble, content generation checklist |
| Code Patterns (LaTeX snippets) | code-patterns.md | Ready-to-use LaTeX code: tables, charts, flowcharts, bibliography, watermarks, landscape, multi-lang, images, forms, mail merge, diffs |
| Script & Tool Reference | script-tools.md | PDF utilities (encrypt, merge, optimize, extract), LaTeX quality tools (lint, wordcount, analysis), compilation auto-fix, bibliography, diagrams |
| Bibliography/Citations | bibliography-guide.md | BibTeX/biblatex, citation styles, .bib format |
| Advanced Features & Visual Elements | advanced-features.md |
./outputs/ for user visibilitypoppler-utils (auto-installed by script)These cause Undefined control sequence -- always include the required package:
| If you use... | You MUST include | Error without it |
|---|---|---|
\rowcolor{} | \usepackage{colortbl} | Undefined control sequence \rowcolor |
\url{} in .bib with natbib | \usepackage{url} | Undefined control sequence \url |
\checkmark |
hyperref is fine for normal documents (most templates use it).\set@color errors.-interaction=nonstopmode (not -halt-on-error) to ensure PDFs are produced even with warnings. This is intentional -- many documents produce warnings on first pass that resolve on subsequent passes.setup.sh) verifies their availability. latexmk is used when --use-latexmk is passed; texfot is used automatically when available (default verbosity mode)..chktexrc configuration file is included at the skill root to suppress common false positives when linting generated LaTeX documents. The latex_lint.sh script uses it automatically.For documents 5+ pages (reports, theses, books), read references/long-form-best-practices.md for 9 critical anti-patterns, the report preamble best practices, and the content generation checklist. This is MUST-READ material before generating any long document.
Weekly Installs
78
Repository
GitHub Stars
134
First Seen
Feb 16, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
codex69
opencode65
gemini-cli64
cursor64
github-copilot63
kimi-cli62
实验恢复工具:自动恢复暂停的AI研究实验,从断点继续优化
441 周安装
--verbose | Show full compilation output (all engine logs) |
--quiet | Suppress all non-error output |
--clean | Remove auxiliary files (.aux, .log, .bbl, .fdb_latexmk, etc.) and exit |
--pdfa | Produce PDF/A-2b compliant output (auto-injects pdfx package) |
--auto-fix | Auto-fix common compilation errors (float placement, encoding) |
| Software, data, engineering roles |
| Skills-first hybrid, projects section, tech stack emphasis |
| 9/10 |
resume-entry-level.tex | New graduates, career starters | Education-first, one page, coursework, activities | 9/10 |
\coursename\assignmentnumber\studentname\studentid\duedatelab-report.tex -- STEM lab report template (article class, 11pt) with siunitx for uncertainties and SI units, pgfplots for data visualization, booktabs for professional tables, amsmath for equations, fancyhdr headers, caption+subcaption for figures. Structured sections: abstract, theory, procedure, data/results (with uncertainty tables), analysis (pgfplots graphs), discussion (error analysis), conclusion, references, appendix. Example: pendulum period measurement with error propagation.\V\E\deg\chrthesis.tex -- Thesis/dissertation (book class) with title page, declaration, abstract, acknowledgments, TOC, list of figures/tables, chapters, appendices, bibliography. Front matter uses roman numerals, main matter uses arabic. Includes theorem environments.academic-cv.tex -- Multi-page academic CV with publications (journal/conference/preprint sections), grants and funding, teaching, advising (current/graduated students), awards, professional service, invited talks. ORCID and Google Scholar links.book.tex -- Full book (book class) with half-title, title page, copyright page, dedication, preface, acknowledgments, TOC, list of figures/tables, parts, chapters, appendix, bibliography, index. Custom chapter headings, epigraphs, fancyhdr, microtype.poster.tex -- Conference poster (tikzposter class, A0 portrait) with 2-column layout, QR code, 5 color schemes, tikzfigure charts, tables, coloredbox highlights. Includes commented #BetterPoster layout variant (central billboard + sidebars). Portrait is standard for most conferences. See poster design guide for conference size presets.poster-landscape.tex -- Landscape conference poster (tikzposter class, A0 landscape) with 3-column (30/40/30) layout, QR code, tech purple color scheme. For CS/ML conferences (NeurIPS, ICML, CVPR, ICLR). Includes commented \geometry{} presets for CVPR/NeurIPS custom sizes.cheatsheet.tex -- General reference card (extarticle class, landscape A4, 7pt base font) with 3-column multicols layout, tcolorbox colored section boxes, tight spacing. For command references, concept summaries, quick-reference guides. Supports front+back printing.cheatsheet-exam.tex -- Exam formula sheet (extarticle class, portrait A4, 6pt base font) with 2-column layout, maximum content density, black-and-white printer-safe. For university exam "allowed cheat sheets" with formulas, theorems, definitions. Optimized for single-sided printing.cheatsheet-code.tex -- Programming reference card (extarticle class, landscape A4, 7pt base font) with 4-column layout, minted syntax highlighting, monospace font emphasis. For language syntax, API reference, CLI commands, keyboard shortcuts.letter.tex -- Formal business letter with colored letterhead bar, TikZ logo placeholder, company info, recipient block, date, subject line, signature. Professional corporate appearance.exam.tex -- Exam/quiz (exam class) with grading table, multiple question types (multiple choice, true/false, fill-in-blank, matching, short answer, essay), point values, solution toggle via \printanswers.report.tex -- Business report with TOC, headers/footers, data tables, bar chart (pgfplots), process flowchart (TikZ), recommendationscover-letter.tex -- Professional cover letter with sender/recipient blocksinvoice.tex -- Invoice with company header, line items table, subtotal/tax/totalacademic-paper.tex -- Research paper with abstract, sections, bibliography, figures. Includes example .bib file (references.bib) for BibTeX citations.presentation.tex -- Beamer presentation with title slide, content frames, columnsfillable-form.tex -- Fillable PDF form (article class) with hyperref form fields: text inputs, checkboxes, radio buttons, dropdowns, push buttons. Two-column layout with tabularx. Custom \FormField, \FormCheck, \FormDropdown helper commands. Requires Adobe Reader for full form support (browser PDF viewers have limited form capabilities).conditional-document.tex -- Configurable document (article class) with etoolbox toggle system: show/hide TOC, appendix, watermark, draft mode, confidential marking, abstract. Template variables via \providecommand (title, author, org, version). Three visual profiles (corporate, academic, minimal). Supports command-line variable passing for CI/CD.mail-merge-letter.tex -- Mail merge letter template with {{variable}} placeholders for use with scripts/mail_merge.py. Company-branded letterhead, recipient address block, body text with data-driven personalization. Pair with CSV/JSON data source.resume.tex -- Legacy resume template (has photo area and tables -- not ATS-optimized)resume-technical.texarticle |
| Resume (new graduate) | resume-entry-level.tex | article |
| Homework, assignment, problem set | homework.tex | article |
| Lab report, experiment writeup | lab-report.tex | article |
| Lecture notes, math notes (beautiful) | lecture-notes.tex | scrartcl |
| Thesis, dissertation | thesis.tex | book |
| Academic CV (publications, grants) | academic-cv.tex | article |
| Report, analysis | report.tex | article |
| Cover letter | cover-letter.tex | article |
| Invoice | invoice.tex | article |
| Academic paper | academic-paper.tex + references.bib | article |
| Book | book.tex | book |
| Scientific poster (portrait) | poster.tex | tikzposter |
| Scientific poster (landscape) | poster-landscape.tex | tikzposter |
| Cheat sheet, reference card | cheatsheet.tex | extarticle |
| Exam formula sheet, crib sheet | cheatsheet-exam.tex | extarticle |
| Programming reference card | cheatsheet-code.tex | extarticle |
| Formal business letter | letter.tex | article |
| Exam, quiz, test | exam.tex | exam |
| Slides, presentation | presentation.tex | beamer |
| Fillable PDF form | fillable-form.tex | article |
| Conditional/configurable document | conditional-document.tex | article |
| Mail merge, batch letters | mail-merge-letter.tex + scripts/mail_merge.py | article |
| Version diff (latexdiff) | Use scripts/latex_diff.sh + see interactive-features.md | varies |
| Convert PDF to LaTeX | Select profile + see pdf-conversion.md | varies |
| Convert formats | Use scripts/convert_document.sh + see format-conversion.md | varies |
| Mail merge from CSV/JSON | Use scripts/mail_merge.py + see interactive-features.md | varies |
| Watermarks, landscape, multi-lang, code, algorithms, tcolorbox, siunitx, advanced charts, AI images, visual elements reference table |
| Mermaid Diagrams | mermaid-diagrams.md | Flowcharts, sequence, class, ER, Gantt, pie, mindmap |
| Python Charts (matplotlib) | python-charts.md | Bar, line, scatter, pie, heatmap, box, histogram, area, radar |
| Format Conversion (Pandoc) | format-conversion.md | Markdown/DOCX/HTML to/from LaTeX |
| Tables and Images | tables-and-images.md | Colored rows, multi-row/column, booktabs, long tables, images, TikZ |
| Charts and Graphs (pgfplots) | charts-and-graphs.md | Line plots, bar charts, scatter plots, pie charts in pgfplots |
| LaTeX Packages | packages.md | Common packages reference |
| Poster Design Guide | poster-design-guide.md | Conference size presets, typography, color schemes, layout archetypes, content guidelines |
| Resume ATS Guide | resume-ats-guide.md | ATS rules, LaTeX pitfalls, keywords |
| PDF-to-LaTeX Pipeline | pdf-conversion.md | Full conversion pipeline, scaling strategy, worker agents, validation |
| Interactive Features | interactive-features.md | Fillable PDF forms, conditional content, mail merge from CSV/JSON, latexdiff version tracking |
| Cheat Sheet Design | cheatsheet-guide.md | Template selection, typography, density optimization, PDF-to-cheatsheet pipeline |
| PDF-to-Cheatsheet Prompts | pdf-extraction-prompts.md | LLM prompts for extraction stages: structure analysis, subject-specific extraction, compression, formatting |
| Visual Packages (TikZ) | visual-packages.md | 24 installed TikZ/visualization packages with working examples |
| Graphviz & PlantUML | graphviz-plantuml.md | .dot to PDF/PNG, .puml to PDF/PNG, LaTeX integration |
| Debugging & Errors | debugging-guide.md | Reading LaTeX errors, 20 common errors, .log analysis, silent failures |
| Accessibility & PDF/A | accessibility-guide.md | PDF/A for thesis, PDF/UA for screen readers, tagged PDFs, alt text |
| Beamer Presentations | beamer-guide.md | Themes, overlays/animations, code slides, handouts, presenter notes |
| Font Selection | font-guide.md | Font families, fontspec, mathematical fonts, fontawesome5, microtype, CJK |
| Collaboration & CI/CD | collaboration-guide.md | Git for LaTeX, GitHub Actions, Docker, multi-author workflows |
| PDF Operations | pdf-operations.md | Form filling (fillable + non-fillable), text/table extraction (pdfplumber), OCR (pytesseract), programmatic PDF creation (reportlab), watermarking, rotation/cropping, metadata, JavaScript (pdf-lib, pdfjs-dist), batch processing, performance tips |
\usepackage{amssymb}Undefined control sequence \checkmark |
\begin{figure}[H] | \usepackage{float} | Unknown float option H |
\rowcolors{}{}{} | \usepackage[table]{xcolor} or \usepackage{colortbl} | Undefined control sequence |