Generate LaTeX documentation for mathematical research. Use when creating papers, notes, or documenting formulas, proofs, and verification results.
Generate formatted LaTeX documentation with theorems, proofs, and verification tables.
.tex files, use the same preamble/style. If not, ask the user if they have a preferred preamble or use the default one below.latexmk -pdf or pdflatex, then check the log for errors/warnings and fix any issues before deliveringlatexmk -cA typical mathematical writeup follows this structure:
| Section | Content |
|---|---|
| 1. Introduction | Problem description, key objects, motivation |
| 2. Preliminaries | Definitions, notation, background results |
| 3-N. Main Results | Theorems, proofs, verification tables |
| Summary | Table of all formulas and key results |
If no existing preamble is available, use this as a starting point:
\documentclass[11pt]{article}
\usepackage{amsmath, amssymb, amsthm}
\usepackage{hyperref}
\usepackage{booktabs}
\usepackage{geometry}
\geometry{margin=1in}
This is intentionally minimal — customize for your needs (see Customization below).
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
When documenting computationally verified results, include verification tables:
\begin{table}[h]
\centering
\begin{tabular}{c|c|c|c}
Parameter & Computed & Expected & Match \\
\hline
$n=1$ & 0.5000 & 1/2 & \checkmark \\
$n=2$ & 0.3333 & 1/3 & \checkmark \\
\end{tabular}
\caption{Numerical verification of [result name]}
\end{table}
# Create output directory
mkdir -p output/
# Compile (handles cross-references automatically)
cd output/ && latexmk -pdf document.tex
# Check for errors — always review the log
grep -E "^!" document.log || echo "No errors"
grep -c "Warning" document.log
# Clean build artifacts (keeps .tex and .pdf)
latexmk -c
latexmk -pdf runs pdflatex as many times as needed for TOC and cross-references. latexmk -c removes .aux, .log, .out, .toc, .fls, .fdb_latexmk.
Always verify compilation is clean — no undefined references, no missing packages, no overfull hboxes that break layout. Fix issues before delivering the PDF.
This skill is designed to be easily modified for your own workflow. Common things to customize:
output/ to wherever you keep your PDFsarticle for amsart, memoir, beamer, etc.\newtheorem definitions to match your conventionWhen iterating on a document, compile in draft mode with visible labels so the user can easily reference specific equations, theorems, and sections:
\usepackage{showkeys} % displays \label names in the margin
\documentclass[draft]{article} % marks overfull boxes, skips images for speed
This makes it much easier for the user to say "equation eq:main-bound has a typo" instead of "the third equation on page 2."
Label everything — every equation, theorem, lemma, section, and table should have a \label{}. Use descriptive names: eq:spectral-gap, thm:main-result, sec:prelim.
Remove showkeys and draft option for the final version.
If there's no prior setup for how the user views PDFs, ask:
"How should I share the draft? Options: (1) compile and you open the PDF directly, (2) send to Discord, (3) just share the .tex source. How do you usually view PDFs from the terminal?"
Establish this once and reuse for the rest of the session.
\intertext{} inside align environments for inline commentaryalign over equation for multi-line displays