Internal Safety Override
- Status: local-only unless explicitly opted into external access.
- Before using network tools, package managers, account connectors, browser automation, or remote APIs, state the destination, data scope, and reason, then wait for explicit user approval.
- Do not upload source files, PDFs, logs, bibliography data, document text, project metadata, secrets, or private assets to external services by default.
- Do not install TeX packages, enable
--shell-escape, run arbitrary Makefiles, or execute generated scripts unless the user explicitly approves that specific action. - Do not edit files outside the active workspace unless the user explicitly approves the target path.
- Preserve user changes. Make focused edits and do not perform destructive cleanup, broad rewrites, git resets, or forced checkouts.
- Audit categories: filesystem, command-execution, network, package-install, secrets, document-content.
LaTeX Documentation
This skill creates and improves professional LaTeX deliverables: reports, technical documentation, formal specifications, manuals, white papers, research notes, and polished PDFs with strong structure, references, typography, and navigation.
Use This Skill For
- Creating a complete LaTeX report or documentation project.
- Converting outlines, Markdown, notes, or plain text into LaTeX.
- Designing title pages, document metadata, headers, footers, page numbering, margins, and section hierarchy.
- Adding tables of contents, lists of figures/tables, indexes, glossaries, appendices, and acronyms.
- Managing citations, bibliographies, footnotes, cross-references, labels, and hyperlinks.
- Formatting professional tables, figures, code listings, equations, diagrams, callouts, and appendices.
- Troubleshooting LaTeX build errors, warnings, overfull boxes, missing references, missing citations, and layout issues.
Do Not Use This Skill For
- Word
.docxediting unless the user specifically wants LaTeX output. - PowerPoint or slide deck generation unless the user wants Beamer or LaTeX source.
- Remote collaborative editors such as Overleaf unless the user explicitly approves external access.
- Installing or updating TeX distributions without explicit approval.
Default Workflow
Scope the document
- Identify document type: report, manual, specification, paper, thesis chapter, proposal, policy, or appendix pack.
- Confirm audience, required sections, branding constraints, citation style, page size, language, and output target.
- If details are missing and the task is safe, choose conservative defaults: A4 paper, 11 pt,
scrreprt,xelatex,biblatex, numbered headings,hyperref,cleveref,fancyhdr, and a table of contents.
Inspect existing files
- Read current
.tex,.bib, image, and build files before changing anything. - Check whether the project already uses
latexmk,pdflatex,xelatex,lualatex,bibtex,biber,biblatex, ornatbib. - Follow the existing class, package, naming, folder, and build conventions when they are reasonable.
- Read current
Plan the document architecture
- For new projects, start from
templates/professional-report-template.tex. - Use stable structure: title matter, abstract or executive summary, table of contents, body sections, conclusion, bibliography, appendices, glossary/index if needed.
- Split large reports into included chapter files only when it improves maintainability.
- Use
\label{}and\cref{}consistently for sections, figures, tables, equations, and appendices.
- For new projects, start from
Implement formatting
- Use semantic LaTeX:
\chapter,\section,\subsection,table,figure,description,enumerate,itemize,quote,lstlisting, and custom macros when repetition is meaningful. - Keep visual design professional: readable margins, restrained color, clear heading hierarchy, useful running headers/footers, and accessible link colors.
- Use manual spacing commands sparingly. Prefer class options, package configuration, and reusable macros.
- Use semantic LaTeX:
Handle references and citations
- Use
biblatexwithbiberfor new documents unless the existing project uses another system. - Never invent sources. If a citation is needed but not supplied, insert a clear compile-safe placeholder such as
\textbf{[Source needed: ...]}or ask for sources. - Ensure every
\cite{}key exists in the.bibfile and every important figure/table/section has a label.
- Use
Build and verify locally
- Prefer local commands only. Use
latexmk -xelatex -interaction=nonstopmode -halt-on-error main.texwhenlatexmkand Perl are available; on MiKTeX without Perl, usetexifyor explicitxelatex/biberpasses. - Do not use
--shell-escapeunless explicitly approved. - Review
.log,.blg, and.bblfiles for errors, unresolved references, missing citations, missing files, overfull boxes, and font issues. - If local TeX tools are unavailable, run static checks and report that PDF compilation was skipped.
- Prefer local commands only. Use
Report results
- Summarize files changed, document structure, build command used, warnings that remain, and any manual follow-up.
- Separate facts, assumptions, and open questions when content or source material is incomplete.
Quality Checklist
Use this checklist before delivering a LaTeX document:
- Title page contains title, subtitle if useful, author/organization, version/date, classification if applicable, and contact or owner if requested.
- Page layout has appropriate paper size, margins, line spacing, paragraph spacing, header/footer, and page numbering.
- Heading levels are consistent and no level is skipped for visual effect.
- Table of contents is generated and shows the right depth.
- Lists of figures, tables, glossary, acronyms, or index are included only when useful.
- Cross-references use labels rather than hardcoded numbers.
- Citations are present for factual claims that require support, and bibliography entries are complete enough for the requested style.
- Figures and tables have captions, labels, source notes when required, and fit within margins.
- Long tables use
longtableortabularxinstead of spilling off the page. - Code blocks use a configured listing style and do not overflow.
- Appendices are clearly separated and referenced from the body.
- Hyperlinks are active, legible, and not visually noisy.
- Build completes locally or static validation findings are documented.
File Organization
Recommended project structure:
latex-report/
|-- main.tex
|-- references.bib
|-- chapters/
| |-- 01-introduction.tex
| |-- 02-methodology.tex
| |-- 03-findings.tex
| `-- 04-conclusion.tex
|-- figures/
|-- tables/
|-- appendices/
| `-- appendix-a.tex
|-- build/
`-- README.md
For small reports, a single main.tex plus references.bib is acceptable.
Local Resources
templates/professional-report-template.tex: complete editable LaTeX report template with title page, headers/footers, contents, citations, figures, tables, glossary, index, and appendices.templates/references.bib: starter bibliography file.references/latex-document-architecture.md: structure, package choices, and build guidance.references/professional-formatting.md: typography, layout, headings, tables, figures, and finishing checklist.scripts/check_latex_project.py: static local checker for common LaTeX report issues.
Static Validation Script
Run from the skill directory or pass a target .tex file:
python scripts/check_latex_project.py path/to/main.tex
The script checks for missing structure, duplicate labels, unresolved citation keys against a local .bib, risky shell-escape mentions, missing bibliography setup, and common draft placeholders. It does not compile the PDF and does not contact the network.
Build Commands
Recommended new-document build when latexmk and Perl are available:
latexmk -xelatex -interaction=nonstopmode -halt-on-error main.tex
biber main
latexmk -xelatex -interaction=nonstopmode -halt-on-error main.tex
If the project uses biblatex, latexmk usually invokes biber automatically when configured. If it uses natbib, follow the existing BibTeX workflow.
MiKTeX fallback when latexmk is unavailable:
texify --pdf --engine=xetex --synctex=1 main.tex
Manual fallback for biblatex documents:
xelatex -interaction=nonstopmode -halt-on-error main.tex
biber main
xelatex -interaction=nonstopmode -halt-on-error main.tex
xelatex -interaction=nonstopmode -halt-on-error main.tex
Troubleshooting
- Undefined references: run LaTeX enough times, then inspect labels and
\cref{}keys. - Undefined citations: verify
.bibfile name, citation keys,biberorbibtexbackend, and generated.bcfor.aux. - Overfull hboxes: find the line in
.log, then fix long URLs, table widths, code listings, or unbreakable inline text. - Missing fonts: switch to installed fonts, use TeX Gyre fonts, or ask before installing fonts.
- Package missing: ask before installing packages; offer a fallback using packages already present.
- Index or glossary missing: ensure
makeindex/makeglossariesstep is configured and the document has entries.