skills/43-wentorai-research-plugins/skills/writing/latex/math-typesetting-guide/SKILL.md
LaTeX math typesetting, equation formatting, and cross-referencing
npx skillsauth add brycewang-stanford/Awesome-Agent-Skills-for-Empirical-Research math-typesetting-guideInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Comprehensive reference for typesetting mathematical notation, equations, and theorems in LaTeX with correct formatting, numbering, and cross-referencing.
\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:
The 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:
\[
\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:
\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 (&):
\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:
\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:
\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:
% 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
% 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}
% 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}
% 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 insteaddevelopment
Conduct rigorous thematic analysis (TA) of qualitative data following Braun and Clarke's (2006) six-phase framework. Use whenever the user mentions 'thematic analysis', 'TA', 'Braun and Clarke', 'qualitative coding', 'identifying themes', or asks for help analysing interviews, focus groups, open-ended survey responses, or transcripts to identify patterns. Also trigger for questions about inductive vs theoretical coding, semantic vs latent themes, essentialist vs constructionist epistemology, building a thematic map, or writing up a qualitative findings section. Covers all six phases, the four upfront analytic decisions, the 15-point quality checklist, and the five common pitfalls. Produces a Word document write-up and an annotated thematic map. Does NOT cover IPA, grounded theory, discourse analysis, conversation analysis, or narrative analysis — use a different method for those.
development
Guide users through writing a systematic literature review (SLR) following the PRISMA 2020 framework. Use this skill whenever the user mentions 'systematic review', 'systematic literature review', 'SLR', 'PRISMA', 'PRISMA 2020', 'PRISMA flow diagram', 'PRISMA checklist', or asks for help writing, structuring, or auditing a literature review that follows reporting guidelines. Also trigger when the user asks about inclusion/exclusion criteria for a review, search strategies for databases like Scopus/WoS/PubMed, study selection processes, risk of bias assessment, or narrative synthesis for a review paper. This skill covers the full PRISMA 2020 checklist (27 items), produces a Word document manuscript in strict journal article format, generates an annotated PRISMA flow diagram, and enforces APA 7th Edition referencing throughout. It does NOT cover meta-analysis or statistical pooling. By Chuah Kee Man.
testing
Performs placebo-in-time sensitivity analysis with hierarchical null model and optional Bayesian assurance. Use when checking model robustness, verifying lack of pre-intervention effects, or estimating study power.
data-ai
Fit, summarize, plot, and interpret a chosen CausalPy experiment. Use after the causal method has been selected, including when configuring PyMC/sklearn models and scale-aware custom priors.