一键导入
latex-compile
Use when compiling LaTeX documents with XeLaTeX, or encountering compilation errors, missing cross-references, or diagnostic warnings.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when compiling LaTeX documents with XeLaTeX, or encountering compilation errors, missing cross-references, or diagnostic warnings.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | latex-compile |
| description | Use when compiling LaTeX documents with XeLaTeX, or encountering compilation errors, missing cross-references, or diagnostic warnings. |
LaTeX compilation assistant for XeLaTeX projects, handling compilation errors, cross-references, and diagnostics.
This skill provides the standard XeLaTeX compilation workflow for LaTeX projects, including error diagnosis and fixes.
Important: When users invoke this skill, they typically have compilation problems that need solving. Always display sufficient error information for diagnosis — do not over-filter the output!
Use when:
.tex files with XeLaTeXDon't use when:
VSCode LaTeX Workshop recipe (XeLaTeX):
# XeLaTeX compilation (first pass)
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex
# XeLaTeX compilation (second pass - update cross-references)
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex
Parameters:
-synctex=1: Generate SyncTeX data for PDF viewer synchronization-interaction=nonstopmode: Continue compilation on errors (shows all errors at once)-file-line-error: Display error messages with file and line numbersmain.tex: Main LaTeX fileCompilation passes:
.aux files, second pass updates cross-referencesSymptom:
! LaTeX Error: \begin{document} ended by \end{remark}.
Cause: Mismatched environment begin/end tags
Diagnosis command:
grep -n "begin{remark}\|end{remark}" chapters/*.tex
Fix:
\begin{remark} has corresponding \end{remark}\end{remark} tagsSymptom:
! Package pgfkeys Error: I do not know the key '/tcb/Title'...
Cause: Incorrect theorem environment format
Correct format:
% CORRECT format (using \newtcbtheorem)
\begin{remark}{Title}{label}
Content...
\end{remark}
% WRONG format
\begin{remark}[Title]
Content...
\end{remark}
Symptom:
! Package pgfkeys Error: I do not know the key '/tcb/中文标题'...
Cause: Chinese title in square brackets
Fix: Ensure using {Title}{label} format
Symptom:
LaTeX Warning: Reference `eq:label' undefined...
LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.
Fix: Run compilation again (second pass)
Output written on main.pdf (93 pages).
Transcript written on main.log.
Package hyperref Warning: Token not allowed in a PDF string (Unicode)...
Output written on main.pdf (93 pages).
! LaTeX Error: ...
l.123 \begin{remark}
⚠️ Important: When diagnosing compilation errors, do not over-filter the output! Error information may be anywhere in the output. Using head or tail may miss critical errors.
Method 1: Show all errors and warnings (recommended)
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex 2>&1 | grep -E "Error|! |Warning"
This displays all errors, warnings, and fatal errors starting with !.
Method 2: Limit line count but don't use head/tail
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex 2>&1 | grep -E "Error|! " | head -50
If the output is truly too large, you can use head -50 to limit to the first 50 errors, but never use tail!
Method 3: Check specific types of errors
# Check all environment mismatch errors
grep -E "begin|end" main.tex | grep -v "%"
# Check remark environments in specific files
grep -n "begin{remark}\|end{remark}" chapters/*.tex
❌ Don't do this:
# Only see last 10 lines, will miss errors in the middle
xelatex ... 2>&1 | tail -10
# Only see first 30 lines, won't see later errors
xelatex ... 2>&1 | head -30
# Only see last 20 lines, may miss main errors
xelatex ... 2>&1 | tail -20
View specific line range:
sed -n '1500,1550p' chapters/chapter02.tex
Check specific labels:
grep -n "label{eq:" chapters/*.tex | sort | uniq -d
⚠️ Important Principle: When users invoke this skill, they have compilation problems. Must display sufficient error information to help diagnose!
Recommended approach: Show all errors without using head/tail
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex 2>&1 | grep -E "Error|! "
If output is truly too large (over 100 lines), you can limit the count:
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex 2>&1 | grep -E "Error|! " | head -50
❌ Never use tail to view errors:
# Wrong! This will miss most errors
xelatex ... 2>&1 | tail -10
After viewing error messages, locate the specific file and line number:
./filename.tex:line_number: error_descriptionAfter fixing errors, recompile to verify:
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex && \
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex
A: Delete .aux and .synctex.gz files and recompile:
rm -f *.aux *.synctex.gz *.log
xelatex -synctex=1 -interaction=nonstopmode -file-line-error main.tex
A: Check VSCode LaTeX Workshop settings to ensure same compilation command
A: This is normal, XeLaTeX compiling large documents takes time. First compilation is usually slower.
Compilation requires:
main.tex (main file)chapters/*.tex (chapter files)figures/ (image files, if any).cls or .sty files (if using custom class)Use when writing, revising, or auditing a standalone Markdown explanation of a research paper. Produces image-supported, source-verified explanations for an average reader in the paper's field, prioritizes the paper's mechanisms and algorithms over background or benchmark dumps, checks appendices/code/official web resources, follows md-report-writer information-density rules, and runs separate Reviewer and Reader subagents.
Use when generating a physics or engineering experiment report from measured data and reference materials — orchestrates Theory, Data Analysis, Plotting, and Report sub-agents to produce a compiled LaTeX PDF. Also use for any sub-task in that pipeline: deriving formulas, analyzing lab data, plotting measurements with theory overlay, or writing/compiling the report.
Use when creating LaTeX Beamer presentation slides from documents, especially for academic presentations. Use when source document contains structured content with sections, subsections, or clear hierarchical organization that should be preserved in slides.
Professional LaTeX experiment report writing assistant for physics and engineering. Focuses on narrative flow, coherent explanations, proper academic style, structured content, and LaTeX best practices.
Use when writing math textbook content in XeLaTeX, including definitions, theorems, proofs, and section formatting in English or Chinese.
Use when enhancing existing lecture notes with multiple course source materials (recordings, PPT slides, existing notes)