Compile
Skill SeidSmatti/misc-CC-Plugins/plugins/academic-latex/skills/compile
Personal multi usage Claude Code plugins/skills marketplace
npx -y skills add SeidSmatti/misc-CC-Plugins --skill compileAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Compiles a LaTeX document end-to-end across pdflatex / xelatex / lualatex. Auto-detects the right compiler from preamble features, runs latexmk for multi-pass + bib backend orchestration (biber or bibtex), and surfaces a clean error summary on failure. Use when the user asks to compile, build, render, "make the PDF", "run latex", or hands a .tex file expecting a PDF. Delegates to /academic-latex:debug on failure and /academic-latex:docs-lookup when uncertain about a package or option.
The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
5.0 KB, as published. Nobody here has run it
compile — cross-compiler LaTeX build
Quick path
latexmk -interaction=nonstopmode -halt-on-error -file-line-error -pdf <main>.tex
That's the answer for ~70% of documents. The rest need a different engine — detect first.
Engine detection
Run scripts/detect_compiler.sh <main>.tex. The script returns one of pdflatex, xelatex, lualatex. Decision precedence (deterministic):
- Magic comment at top of file:
% !TEX program = lualatex|xelatex|pdflatex→ use it verbatim. - LuaLaTeX-only signal anywhere in source tree:
\directlua,\luadirect,\usepackage{luacode},\usepackage{luatexja}→lualatex. - XeLaTeX-only signal:
\usepackage{xeCJK},\usepackage{ctex}(default xetex mode),\usepackage{bidi}→xelatex. - Modern Unicode signal (engine-ambiguous):
\usepackage{fontspec},\usepackage{polyglossia},\usepackage{luabidi},\setmainfont,\setsansfont,\setmonofont,\newfontfamily,\newfontface→lualatex(preferred overxelatexfor broader features and stronger RTL via luabidi). - Class signal:
\documentclass{ctexart|ctexrep|ctexbook}(default xelatex) →xelatex. - Default:
pdflatex(broadest journal-template compatibility, fastest).
Source: https://ctan.org/pkg/fontspec (fontspec aborts under pdftex). When uncertain on edge cases, delegate to /academic-latex:docs-lookup.
Run with the chosen engine
| Engine | latexmk flag |
|---|---|
| pdflatex | -pdf |
| xelatex | -pdfxe |
| lualatex | -pdflua |
Source: latexmk manual at https://mirrors.ctan.org/support/latexmk/latexmk.pdf.
ENGINE=$(scripts/detect_compiler.sh "$MAIN")
case "$ENGINE" in
pdflatex) FLAG="-pdf" ;;
xelatex) FLAG="-pdfxe" ;;
lualatex) FLAG="-pdflua";;
esac
latexmk $FLAG -interaction=nonstopmode -halt-on-error -file-line-error -synctex=1 "$MAIN"
Bibliography backend
latexmk auto-detects which to run:
- biblatex with
backend=biberproduces<main>.bcf— biber runs. - natbib +
\bibliography{}produces<main>.auxwith\bibdata— bibtex runs. - The
$bibtex_use=2default (run bib if requested) is correct for both. Don't override unless instructed.
Source: latexmk manual §$bibtex_use and §bib_dependencies.
When the document mixes (which is wrong — bibliography and biblatex together), report and stop; refer the user to /academic-latex:bibliography.
Multi-document workspace
If the user's directory has more than one .tex and no clear main:
- Look for
% !TEX root = <path>magic comments in the candidates. - Look for
\documentclass{...}— files with that are entry points; files without are sub-includes. - Look for
\begin{document}— must be present in the main. - If still ambiguous, ask the user (one question, list candidates).
On failure
If latexmk exit code is non-zero:
- Capture the last 100 lines of the
.log. - Invoke
/academic-latex:debugwith the path to<main>.logand<main>.tex. Do not attempt to fix in this skill —debugowns error classification and remediation.
The compile loop with debug:
compile → fail → debug → patch (with author or docs-lookup as needed) → compile
Stop after 3 unsuccessful iterations and surface the residual error to the user.
Cleanup
After a successful build, leave aux files in place — latexmk will use them on the next incremental build. To force a clean rebuild: latexmk -C (removes everything, including the PDF) or latexmk -c (keeps the PDF, removes intermediates).
When uncertain
Delegate package-specific or option-specific questions (e.g., "does this microtype option work under xelatex?") to /academic-latex:docs-lookup. Do not guess — see suite README.
Last verified
2026-05-09 — latexmk v4.88 (2026-03-09); fontspec docs at https://ctan.org/pkg/fontspec.