Free SKILL.md scraped from GitHub. Clone the repo or copy the file directly into your Claude Code skills directory.
npx versuz@latest install vivekkarmarkar-claude-code-os-skills-latexgit clone https://github.com/VivekKarmarkar/claude-code-os.gitcp claude-code-os/SKILL.MD ~/.claude/skills/vivekkarmarkar-claude-code-os-skills-latex/SKILL.md# LaTeX — Generate Publication-Quality LaTeX Documents
Generate LaTeX documents matching the quality, structure, and aesthetic of the bundled reference documents. The output is a compilable `.tex` file and optionally a compiled `.pdf`.
## Arguments
`<topic or description>` — What the document should be about.
Examples:
- `/latex derive the Navier-Stokes equations from first principles`
- `/latex write a report on the double pendulum with phase portraits`
- `/latex derivation notes mapping between two formulations of the heat equation`
- `/latex` — no args, ask the user what they want
## Reference Documents
This skill bundles two reference documents in `reference-documents/`. **These are the source of truth** for quality, structure, and LaTeX style. Read both `.tex` files before generating any document.
### Reference 1: PDE Derivation Notes
- `reference-documents/PDEs/domain_transform_derivation.tex` — Compact technical derivation
- `reference-documents/PDEs/domain_transform_derivation.pdf` — Compiled output
- **Style:** Terse, working-notes format. Color-coded `tcolorbox` for problem statements (blue=source, green=transformed, red=target, yellow=code). Boxed key equations. No figures. No bibliography. Pure math.
- **Use as template when:** The user wants derivation notes, proofs, coordinate transformations, mathematical mappings, or any short technical document focused on equations.
### Reference 2: Pendulum Report
- `reference-documents/Pendulum/pendulum_report.tex` — Full pedagogical report
- `reference-documents/Pendulum/pendulum_report.pdf` — Compiled output
- **Style:** Publication-quality report. Custom color scheme (blue section headers, syntax-highlighted Python code). Fancy headers with document title. Abstract, epigraph quotes, figures with detailed captions. Numbered equations with cross-references. Bibliography. Code listings in appendix.
- **Use as template when:** The user wants a full report, tutorial, educational document, or anything that needs figures, code, narrative prose, and references.
## Workflow
### Phase 1: Determine Document Type
Based on the user's request, decide which reference template to follow:
**Derivation Notes** (PDE template) if the user says:
- "derive", "derivation", "proof", "show that", "transform", "map between"
- Short, equation-heavy, no prose needed
- Working notes, not for publication
**Full Report** (Pendulum template) if the user says:
- "report", "write about", "explain", "tutorial", "educational"
- Needs narrative prose, figures, code, references
- For sharing, publication, or teaching
If unclear, ask: "Should this be compact derivation notes or a full report with narrative and figures?"
### Phase 2: Understand the Content
Read the user's request carefully. If the topic involves physics, math, or engineering:
- Identify the governing equations
- Plan the logical flow (setup → derivation → result → discussion)
- Determine what needs to be boxed, highlighted, or emphasized
- Identify if code (Python/Julia/etc.) should be included
### Phase 3: Generate the LaTeX
**Read the appropriate reference `.tex` file first.** Match its structure exactly:
#### For Derivation Notes (PDE style):
- `\documentclass[11pt]{article}`
- Packages: `amsmath, amssymb, xcolor, tcolorbox`
- Custom commands for partial derivatives: `\pd`, `\pdd`
- Color-coded `tcolorbox` environments for problem statements
- `\boxed{}` for key results
- Clean section numbering: Setup → Steps → Comparison → Observations
- No `\tableofcontents`, no bibliography, no figures
- Concise — every sentence earns its place
#### For Full Reports (Pendulum style):
- `\documentclass[11pt, a4paper]{article}`
- Full package set: `amsmath, amssymb, graphicx, xcolor, listings, booktabs, hyperref, caption, float, enumitem, microtype, fancyhdr, titlesec`
- Custom color scheme:
- `codeblue` (#213a87) for section headers and keywords
- `codegreen` (#408059) for comments
- `accentred` (#bf1f1f) for strings and URLs
- `codegray` (#808080) for line numbers and metadata
- `backcolour` (#f7f7f7) for code backgrounds
- Python listing style with frame, line numbers, syntax highlighting
- Section title formatting with `titlesec` (blue, bold)
- `fancyhdr` with document title in header, page number on right
- `hyperref` with colored links (blue for internal, red for URLs)
- Abstract with horizontal rule below
- Optional epigraph quote in italics
- Figures with `[H]` placement and detailed `\caption`
- Tables with `booktabs` (`\toprule, \midrule, \bottomrule`)
- `\thebibliography` with standard citations
- Code appendix at end
### Phase 4: Quality Checks
Before outputting, verify:
1. **All equations compile.** No mismatched delimiters, no undefined commands.
2. **Cross-references are consistent.** Every `\label` has a `\ref` or `\eqref` that uses it.
3. **No placeholder text.** Every equation, every sentence is real content.
4. **Boxed results.** Key results use `\boxed{}` or `tcolorbox`.
5. **Numbered equations.** Important equations are numbered with `equation` environment, inline math uses `$...$`.
6. **Step-by-step derivations.** Use `align` environment with `\\[6pt]` spacing between logical steps.
### Phase 5: Compile (if possible)
If `pdflatex` is available:
```bash
pdflatex -interaction=nonstopmode document.tex
pdflatex -interaction=nonstopmode document.tex # Run twice for references
```
If compilation fails, read the `.log` file, fix the error, and retry.
### Phase 6: Deliver
- Save the `.tex` file to the user's working directory (or a specified location)
- If compiled, provide the `.pdf` path
- If figures are needed, generate them with Python/matplotlib and save alongside
## Writing Style Guide
### Mathematical Writing
- **Derive from first principles.** Don't skip steps. Show the chain rule, show the substitution, show the simplification.
- **Box key results.** The reader should be able to scan for `\boxed{}` equations and get the main results.
- **Label equations that will be referenced later.** Don't label throwaway equations.
- **Use `\quad` and `\qquad` for spacing** in display equations, not `\hspace`.
- **Align multi-step derivations** with `align` or `align*`, aligning on `=` or key operators.
### Prose Writing
- **Conversational but precise.** "This looks deceptively simple — just five symbols — but that sin(θ) hides a world of trouble."
- **Subsection titles are hooks.** "The textbook trick: small angles", "When elegance breaks down", "The honest equation" — not "Section 2.1: Approximation Method".
- **Connect math to intuition.** After every derivation, explain what it means physically.
- **End with insight.** Every section should close with a takeaway, not trail off.
### Code Listings
- Use `lstlisting` environment with Python style from the Pendulum reference
- Include function signatures, docstrings, and comments
- Caption every listing
- Keep code functional — no pseudocode unless explicitly appropriate
## Rules
1. **Read the reference files before generating.** Always. The references are the source of truth.
2. **Match the style exactly.** Same packages, same color scheme, same formatting conventions. Don't improvise a new style.
3. **No placeholder figures.** If figures are needed, generate them with Python or note that they need to be generated separately.
4. **Every equation must be correct.** Verify dimensional consistency, boundary conditions, limiting cases.
5. **Compilable output.** The `.tex` file must compile with `pdflatex` without errors on the first or second pass.
6. **Self-contained.** All custom commands (`\pd`, `\pdd`, etc.) must be defined in the preamble. No external style files.
7. **Author field.** Use "Claude Opus 4.6" as author unless the user specifies otherwise.