Install any skill in seconds. Free to start, no credit card required.
Get Started Free →LaTeX math typesetting, equation formatting, and cross-referencing
.claude/skills/brycewang-stanford-math-typesetting-guide/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 54% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 117% | 0% |
| case-15 | ✗→✓ | ▲ Improved | 123% | 0% |
| case-17 | ✓→✗ | ▼ Worse | 132% | 0% |
Comprehensive reference for typesetting mathematical notation, equations, and theorems in LaTeX with correct formatting, numbering, and cross-referencing.
latex\usepackage{amsmath} % Core math environments (align, gather, etc.) \usepackage{amssymb} % Additional math symbols \usepackage{amsthm} % Theorem environments \usepackage{mathtools} % Extensions to amsmath (dcases, coloneqq, etc.) \usepackage{bm} % Bold math symbols (\bm{x}) \usepackage{bbm} % Blackboard bold for indicators (\mathbbm{1}) \usepackage{nicefrac} % Inline fractions (\nicefrac{1}{2}) \usepackage{siunitx} % SI units (\SI{9.8}{m/s^2})
Use $...$ or \(...\) for math within text:
latexThe loss function $\mathcal{L}(\theta) = -\sum_{i=1}^{N} \log p(y_i | x_i; \theta)$ minimizes the negative log-likelihood.
Use \[...\] for centered, unnumbered equations:
latex\[ \nabla_\theta \mathcal{L}(\theta) = -\frac{1}{N} \sum_{i=1}^{N} \nabla_\theta \log p(y_i | x_i; \theta) \]
Use the equation environment for numbered equations:
latex\begin{equation} E = mc^2 \label{eq:einstein} \end{equation}
Reference with \eqref{eq:einstein} to produce "(1)" with parentheses automatically.
Use align for multi-line equations with alignment points (&):
latex\begin{align} \mathcal{L}(\theta) &= \mathbb{E}_{(x,y) \sim \mathcal{D}} \left[ \ell(f_\theta(x), y) \right] \label{eq:loss} \\ &= \frac{1}{N} \sum_{i=1}^{N} \ell(f_\theta(x_i), y_i) \label{eq:empirical-loss} \\ &\approx \frac{1}{B} \sum_{j=1}^{B} \ell(f_\theta(x_j), y_j) \label{eq:minibatch-loss} \end{align}
Use align* for unnumbered multi-line equations. Use \nonumber to suppress numbering on specific lines.
Use split inside equation for a single equation number spanning multiple lines:
latex\begin{equation} \begin{split} \text{ELBO}(\theta, \phi; x) &= \mathbb{E}_{q_\phi(z|x)} \left[ \log p_\theta(x|z) \right] \\ &\quad - D_\text{KL}\left( q_\phi(z|x) \| p(z) \right) \end{split} \label{eq:elbo} \end{equation}
For piecewise functions:
latex\begin{equation} \text{ReLU}(x) = \begin{cases} x & \text{if } x > 0 \\ 0 & \text{otherwise} \end{cases} \label{eq:relu} \end{equation}
| Notation | LaTeX | Category | |----------|-------|----------| | Real numbers | \mathbb{R} | Sets | | Integers | \mathbb{Z} | Sets | | Natural numbers | \mathbb{N} | Sets | | Expectation | \mathbb{E} | Probability | | Probability | \mathbb{P} or \Pr | Probability | | Normal distribution | \mathcal{N}(\mu, \sigma^2) | Distributions | | Partial derivative | \frac{\partial f}{\partial x} | Calculus | | Gradient | \nabla f | Calculus | | Matrix transpose | \mathbf{A}^\top | Linear algebra | | Matrix inverse | \mathbf{A}^{-1} | Linear algebra | | Frobenius norm | \|\mathbf{A}\|_F | Linear algebra | | L2 norm | \|\mathbf{x}\|_2 | Linear algebra | | Inner product | \langle \mathbf{x}, \mathbf{y} \rangle | Linear algebra | | Indicator function | \mathbbm{1}_{[condition]} | Functions | | Summation | \sum_{i=1}^{N} | Operations | | Product | \prod_{i=1}^{N} | Operations | | Argmin/argmax | \operatorname*{argmin}_\theta | Optimization | | KL divergence | D_\text{KL}(p \| q) | Information theory |
Define custom operators for clean notation:
latex% In preamble \DeclareMathOperator*{\argmin}{arg\,min} \DeclareMathOperator*{\argmax}{arg\,max} \DeclareMathOperator{\Tr}{Tr} % Matrix trace \DeclareMathOperator{\diag}{diag} % Diagonal matrix \DeclareMathOperator{\softmax}{softmax} \DeclareMathOperator{\sigmoid}{\sigma} \newcommand{\R}{\mathbb{R}} % Shorthand for real numbers \newcommand{\E}{\mathbb{E}} % Shorthand for expectation \newcommand{\norm}[1]{\left\| #1 \right\|} % Norm shorthand \newcommand{\abs}[1]{\left| #1 \right|} % Absolute value \newcommand{\inner}[2]{\langle #1, #2 \rangle} % Inner product
latex% Matrix with parentheses \begin{equation} \mathbf{W} = \begin{pmatrix} w_{11} & w_{12} & \cdots & w_{1n} \\ w_{21} & w_{22} & \cdots & w_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ w_{m1} & w_{m2} & \cdots & w_{mn} \end{pmatrix} \end{equation} % Matrix with square brackets \begin{equation} \mathbf{A} = \begin{bmatrix} 1 & 0 \\ 0 & 1 \end{bmatrix} \end{equation}
latex% In preamble: define theorem environments \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} % In document: \begin{theorem}[Universal Approximation] \label{thm:universal-approx} For any continuous function $f: [0,1]^n \to \mathbb{R}$ and any $\epsilon > 0$, there exists a feedforward neural network $g$ with one hidden layer such that $\sup_{x \in [0,1]^n} |f(x) - g(x)| < \epsilon$. \end{theorem} \begin{proof} The proof proceeds by construction. Consider a network with $\sigmoid$ activation functions... % End proof with QED symbol (automatic with amsthm) \end{proof}
latex% Use cleveref for automatic reference formatting \usepackage[capitalise,noabbrev]{cleveref} % Then reference with: \cref{eq:loss} % -> "Equation 1" \cref{thm:universal-approx} % -> "Theorem 1" \Cref{eq:loss} % -> "Equation 1" (capital, for start of sentence) \crefrange{eq:loss}{eq:minibatch-loss} % -> "Equations 1 to 3" % Label naming conventions: % eq:name for equations % thm:name for theorems % lem:name for lemmas % def:name for definitions % fig:name for figures % tab:name for tables % sec:name for sections
\left( and \right) for auto-sizing delimiters, or explicit sizes: \big(, \Big(, \bigg(, \Bigg(\text{...} for words within math mode: $p(\text{data} | \theta)$\quad or \qquad for spacing in equations\phantom{x} for invisible spacing to align elements$$...$$ (plain TeX); use \[...\] or environments instead| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 9,569 | 7,446 | -22% | 1 | 1 | 0% | 1,795 | 3,086 | +72% | 0 | 0 | — |
case-02 | pass→pass | 11,736 | 18,256 | +56% | 1 | 1 | 0% | 2,189 | 4,841 | +121% | 0 | 0 | — |
case-03 | pass→pass | 7,584 | 4,817 | -36% | 1 | 1 | 0% | 1,375 | 2,984 | +117% | 0 | 0 | — |
case-04 | fail→pass | 12,039 | 11,454 | -5% | 1 | 1 | 0% | 2,587 | 3,991 | +54% | 0 | 0 | — |
case-05 | fail→pass | 9,546 | 13,650 | +43% | 1 | 1 | 0% | 1,749 | 3,793 | +117% | 0 | 0 | — |
case-06 | pass→pass | 9,961 | 8,874 | -11% | 1 | 1 | 0% | 1,471 | 3,452 | +135% | 0 | 0 | — |
case-07 | pass→pass | 6,524 | 6,680 | +2% | 1 | 1 | 0% | 1,102 | 3,028 | +175% | 0 | 0 | — |
case-08 | pass→pass | 4,672 | 3,759 | -20% | 1 | 1 | 0% | 899 | 2,776 | +209% | 0 | 0 | — |
case-09 | pass→pass | 3,860 | 6,125 | +59% | 1 | 1 | 0% | 646 | 3,374 | +422% | 0 | 0 | — |
case-10 | pass→pass | 4,034 | 4,564 | +13% | 1 | 1 | 0% | 773 | 3,100 | +301% | 0 | 0 | — |
case-11 | pass→pass | 13,229 | 11,900 | -10% | 1 | 1 | 0% | 2,078 | 4,550 | +119% | 0 | 0 | — |
case-12 | pass→pass | 3,224 | 3,051 | -5% | 1 | 1 | 0% | 544 | 2,647 | +387% | 0 | 0 | — |
case-13 | fail→fail | 5,688 | 4,677 | -18% | 1 | 1 | 0% | 1,012 | 2,980 | +194% | 0 | 0 | — |
case-14 | fail→fail | 4,049 | 5,164 | +28% | 1 | 1 | 0% | 682 | 3,034 | +345% | 0 | 0 | — |
case-15 | fail→pass | 8,136 | 5,642 | -31% | 1 | 1 | 0% | 1,359 | 3,028 | +123% | 0 | 0 | — |
case-16 | pass→pass | 4,439 | 4,565 | +3% | 1 | 1 | 0% | 747 | 2,770 | +271% | 0 | 0 | — |
case-17 | pass→fail | 10,021 | 10,148 | +1% | 1 | 1 | 0% | 1,714 | 3,983 | +132% | 0 | 0 | — |
case-18 | pass→pass | 5,975 | 4,990 | -16% | 1 | 1 | 0% | 811 | 2,928 | +261% | 0 | 0 | — |
case-19 | pass→pass | 10,540 | 10,284 | -2% | 1 | 1 | 0% | 1,713 | 3,617 | +111% | 0 | 0 | — |
case-20 | pass→pass | 9,644 | 14,233 | +48% | 1 | 1 | 0% | 1,931 | 4,290 | +122% | 0 | 0 | — |
case-21 | pass→pass | 10,126 | 6,792 | -33% | 1 | 1 | 0% | 1,826 | 3,372 | +85% | 0 | 0 | — |
case-22 | pass→pass | 4,851 | 4,424 | -9% | 1 | 1 | 0% | 731 | 2,789 | +282% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +14 percentage points is the difference between those two pass rates over the 22 comparable cases. 1 case got worse with the skill loaded, and it is included in that figure.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.