Comprehensive LaTeX/TikZ/Beamer auditor. Validates document structure, package configuration, cross-references, bibliography setup, TikZ externalization, and Beamer presentations. Produces standards-backed reports with MWEs and compilation guidance.
A comprehensive auditing skill for LaTeX documents, including article/report/book classes, TikZ/PGF graphics, pgfplots visualizations, and Beamer presentations. All recommendations are grounded in official CTAN documentation and TeX best practices.
Use this skill when task mentions:
This skill enforces best practices from:
Read the LaTeX source file(s)
.tex file\input or \include.cls) if custom.sty) if customExtract metadata:
- Document class: \documentclass[options]{class}
- Class options: aspectratio, fontsize, paper size, etc.
- Engine hints: fontspec (XeLaTeX/LuaLaTeX), inputenc (pdfLaTeX)
Parse preamble:
\usepackage{...} commands in orderDetect document type:
Load rules from checklists/latex_checklist.yml and execute in order:
class_detect: Identify class and validate optionsengine_detect: Determine appropriate LaTeX engineencoding_check: Verify UTF-8 input and T1 font encoding (pdfLaTeX)Execute in sequence:
hyperref_order: Verify hyperref loaded near end
RULE: hyperref must come after most packages
EXCEPTION: cleveref, glossaries must come after hyperref
hyperref_metadata: Check PDF metadata
VERIFY: \hypersetup{pdftitle=..., pdfauthor=..., pdfsubject=..., pdfkeywords=...}
cleveref_present: If cross-refs detected, recommend cleveref
DETECT: \ref{}, \label{} usage
RECOMMEND: \usepackage{cleveref} after hyperref
cleveref_order: Verify cleveref loaded last
RULE: cleveref must be one of the last packages
EXCEPTION: Only microtype may come after
bib_backend: Check bibliography system
PREFER: biblatex with backend=biber
LEGACY: \bibliography{}, \bibliographystyle{} → flag for migration
microtype_enabled: Verify microtype for typography
CHECK: \usepackage{microtype} present
NOTE: Works with pdfLaTeX, XeLaTeX, LuaLaTeX
csquotes_present: Check quotation handling
DETECT: ``, '', \"{}, etc. → recommend csquotes
VERIFY: \usepackage{csquotes} after babel/polyglossia
babel_polyglossia: Language support
pdfLaTeX: \usepackage[language]{babel}
XeLaTeX/LuaLaTeX: \usepackage{polyglossia}
Execute if TikZ detected:
tikz_present: Confirm TikZ package and usage
DETECT: \usepackage{tikz}, \begin{tikzpicture}
tikz_libraries: Verify library loading
COMMON: positioning, arrows.meta, shapes, calc
CHECK: \usetikzlibrary{...} before first use
pgfplots_present: Check pgfplots usage
DETECT: \usepackage{pgfplots}, \begin{axis}
pgfplots_compat: Verify compatibility level
REQUIRE: \pgfplotsset{compat=1.18} or compat=newest
REASON: Enables modern features and behavior
tikz_compile_cost: Estimate compilation time
COUNT: Number of tikzpicture environments
ESTIMATE:
- 1-5 figures: Low
- 6-15 figures: Medium
- 16-30 figures: High
- 31+ figures: Very High
RECOMMEND: Externalization if High or Very High
externalize_detection: Check externalization setup
DETECT: \usetikzlibrary{external}, \tikzexternalize
VERIFY: prefix=tikz-cache/ or similar
externalize_shell_escape: Verify shell-escape awareness
IF externalization detected:
REQUIRE: Compilation with -shell-escape
WARN: Security implications (only trusted documents)
RECOMMEND: latexmk -pdf -shell-escape document.tex
tikz_naming: Check for explicit figure naming
RECOMMEND: \tikzsetnextfilename{descriptive-name}
REASON: Reproducible cache names, easier debugging
Execute if \documentclass{beamer} detected:
beamer_class: Confirm Beamer detection
aspect_ratio: Check aspectratio option
DEFAULT: 43 (4:3)
MODERN: 169 (16:9 widescreen)
OTHER: 1610 (16:10), 149 (14:9)
RECOMMEND: 169 for contemporary displays
frame_title: Verify all frames have titles
CHECK: \begin{frame}{Title} or \frametitle{Title}
REASON: Structure, navigation, accessibility
overlay_detection: Count overlay specifications
DETECT: \pause, <n->, \onslide<>, \only<>, etc.
LOAD: lexicons/beamer_overlays.yml patterns
overlay_density: Flag excessive overlays
THRESHOLD: 5 overlays per frame
IF count > 5:
WARN: Over-complexity
SUGGEST: Consolidate or split frame
frame_content_balance: Check frame content volume
HEURISTIC: >20 lines of content → potentially overcrowded
RECOMMEND: Split across multiple frames
contrast_check: Assess WCAG compliance
ANALYZE: Theme colors (if standard theme)
REFERENCE: lexicons/beamer_overlays.yml contrast guidelines
WARN: Potential contrast failures
RECOMMEND: Test with contrast checker
If user requests or document is problematic:
Invoke compilation (if code-capable helper available):
COMMAND: latexmk -pdf -interaction=nonstopmode -halt-on-error document.tex
IF externalization detected:
ADD: -shell-escape flag
Parse compilation output:
Check auxiliary files:
.log file for detailed errors.bcf file for biblatex backend.bbl file for bibliography compilationUse templates/audit_report_template.md:
Fill executive summary:
Document analysis section:
Findings by category:
Detailed findings:
Compilation guidance:
MWE references:
Use templates/fix_plan_template.md:
Priority 1 actions (errors):
Priority 2 actions (warnings):
Priority 3 actions (info):
Package loading order:
Specialized fixes:
Conform to schema/tex_audit_schema.json:
{
"metadata": {...},
"document": {...},
"packages": {...},
"tikz": {...},
"beamer": {...},
"findings": [...],
"compilation": {...},
"mwe_paths": [...],
"summary": {...}
}
Generate MWEs for relevant fixes:
TikZ Externalization (if applicable):
mwes/tikz_externalization.texBeamer 16:9 with Overlays (if applicable):
mwes/beamer_16_9_overlays.texModern Bibliography (if BibTeX detected):
mwes/modern_bibliography.texBest Practices Template:
mwes/best_practices_article.texChkTeX configuration:
lint/.chktexrc to projectchktex -v0 -l document.texlatexindent configuration:
lint/indentconfig.yaml to projectlatexindent -l=indentconfig.yaml -w document.texShell-escape warning:
IF -shell-escape required:
EMPHASIZE: Security implications
NOTE: Only use with trusted documents
EXPLAIN: Restricted shell escape in modern distributions
Package conflicts:
IF known conflicts detected:
WARN: Specific incompatibilities
SUGGEST: Alternative approaches
Manual references:
FOR each recommendation:
CITE: Specific manual section
PROVIDE: CTAN link or official documentation URL
Beamer accessibility:
IF Beamer detected:
NOTE: Contrast recommendations are WCAG 2.1 AA guidelines
ACKNOWLEDGE: Theme customization may be needed
PROVIDE: Contrast checking tools
Correct order (with rationale):
% 1. ENCODING & FONTS (pdfLaTeX only)
\usepackage[utf8]{inputenc} % UTF-8 input
\usepackage[T1]{fontenc} % T1 font encoding
% 2. LANGUAGE
\usepackage[english]{babel} % Or polyglossia for XeLaTeX/LuaLaTeX
\usepackage{csquotes} % After babel
% 3. MATHEMATICS (early for other packages to use)
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
% 4. GRAPHICS & FLOATS
\usepackage{graphicx}
\usepackage{float}
\usepackage{caption}
\usepackage{subcaption}
% 5. TABLES
\usepackage{booktabs}
\usepackage{array}
\usepackage{multirow}
% 6. TIKZ (if needed)
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,shapes,calc}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
% 7. BIBLIOGRAPHY
\usepackage[backend=biber,style=authoryear]{biblatex}
\addbibresource{references.bib}
% 8. PAGE LAYOUT
\usepackage{geometry}
% 9. HYPERLINKS (near end!)
\usepackage[colorlinks=true,...]{hyperref}
% 10. CROSS-REFERENCES (after hyperref!)
\usepackage{cleveref}
% 11. TYPOGRAPHY (last!)
\usepackage{microtype}
Rationale:
IF \usetikzlibrary{external} present:
CHECK for \tikzexternalize command
VERIFY prefix setting
COUNT tikzpicture environments
ESTIMATE cache size
IF count > 10:
STRONGLY RECOMMEND externalization
IF count 5-10:
RECOMMEND externalization
IF count < 5:
NOTE: Optional, may not provide significant benefit
ALWAYS WARN: Requires -shell-escape
FOR each \begin{frame}...\end{frame}:
COUNT occurrences of:
- \pause
- <n-> patterns (extract n)
- \onslide<...>
- \only<...>
- \item<...>
COMPUTE max overlay number for frame
IF max > 5:
WARN: Excessive overlays
PROVIDE frame title/line number
SUGGEST: Consolidation strategies
ACCUMULATE global overlay statistics
FOR standard Beamer themes:
LOAD known color schemes
ESTIMATE contrast ratios
FOR custom themes:
WARN: Manual contrast checking required
PROVIDE: Online contrast checker tools
REFERENCE: WCAG 2.1 SC 1.4.3
ALWAYS NOTE:
- Normal text: ≥4.5:1 (AA)
- Large text (≥18pt): ≥3:1 (AA)
- Don't rely solely on color
User: "Check my LaTeX document for issues"
Process:
1. Read document.tex
2. Detect class: article
3. Run document/packages/crossref/bib checks
4. Generate audit report
5. Provide fix plan
6. Include best_practices_article.tex as reference
User: "Review my presentation slides for LaTeX issues"
Process:
1. Read slides.tex
2. Detect class: beamer
3. Run all standard checks
4. ADDITIONALLY run Beamer-specific checks:
- Aspect ratio
- Overlay density
- Contrast estimation
- Frame content balance
5. Generate audit report with Beamer section
6. Provide beamer_16_9_overlays.tex as reference
7. Highlight WCAG contrast requirements
User: "My document with lots of TikZ figures compiles very slowly"
Process:
1. Read document.tex
2. Count tikzpicture environments
3. IF count > 15:
- STRONGLY recommend externalization
- Generate externalization setup guide
- Provide tikz_externalization.tex MWE
- Explain shell-escape security
- Show Makefile integration
4. Estimate compilation time savings
User: "How do I modernize my bibliography setup?"
Process:
1. Detect legacy BibTeX usage:
- \bibliographystyle{}
- \bibliography{}
2. Recommend migration to biblatex + biber
3. Provide modern_bibliography.tex as guide
4. Show step-by-step migration:
- Remove old commands
- Add biblatex package
- Change compilation workflow
5. Explain benefits:
- UTF-8 support
- Flexible formatting
- Better sorting
IF document uses conference class (IEEEtran, ACM, etc.):
SUPPRESS warnings about:
- Package loading order (template may have specific requirements)
- Class options (conference-mandated)
- Bibliography style (often required by venue)
STILL CHECK:
- Compilation issues
- TikZ externalization opportunities
- Code quality (ChkTeX, indentation)
IF document appears to be legacy (pre-2010 packages):
NOTE: Document may be intentionally using older packages
DISTINGUISH:
- Critical issues (will cause errors)
- Modernization opportunities (optional improvements)
PROVIDE migration path but acknowledge may not be desired
IF document is very short (<100 lines, simple structure):
REDUCE recommendations to essentials
DON'T recommend:
- microtype (minimal benefit)
- Complex cross-reference systems
- Externalization (overhead not worth it)
IF tex-runner skill available:
INVOKE for compilation test:
tex-runner.compile(
path=document.tex,
engine=detected_engine,
shell_escape=externalization_detected,
timeout=300
)
PARSE results:
- Errors → add to findings with severity=error
- Warnings → add to findings with severity=warn
- Success → note in report
IF large project with multiple files:
ANALYZE structure:
- Main file
- \input{} and \include{} files
- figures/ directory
- data/ directory for pgfplots
RECOMMEND:
- Organized directory structure
- Separation of content and presentation
- Version control (.gitignore for auxiliary files)
Prioritize fast checks; only invoke compilation test if:
Version: 1.0.0 License: MIT Maintained by: Claude Skills Library