SKILL.md
Compile LaTeX
Overview
This skill compiles LaTeX documents correctly with the right engine and bibliography system, handles multi-pass compilation, and parses errors to suggest fixes. It ships with a wrapper script (scripts/compile.sh) that detects everything automatically and can be invoked directly.
When to Use
- Compiling any
.texfile - "The paper won't compile"
- LaTeX error messages appearing in output
- Generating the final PDF for submission
- CI or automated builds of a paper
- Verifying that cross-references and citations resolve correctly
Mandatory Steps
-
Detect the engine from the preamble. Look for
\usepackage{fontspec}. If present, usexelatex. Otherwise usepdflatex. The wrapper script does this automatically. -
Detect the bibliography system.
\usepackage{biblatex}in the preamble implies biber.\bibliography{...}at the end of the document implies bibtex. Neither implies no bibliography pass. -
Prefer
latexmkif available. It handles multi-pass logic automatically and is more robust than running passes manually. -
If
latexmkis unavailable, run the manual sequence: engine → bib (if applicable) → engine → engine. -
On error, parse the log file (
<base>.log). Extract lines starting with!, report the line number and file, and suggest a likely fix from the error table below. -
Verify the PDF was produced after successful compilation and that it is non-empty.
Using the Wrapper Script
Invoke the compile script directly:
