# Mathshow

> Use when writing mathematical or statistical notation in a response — estimator formulas, derivations, proofs, probability/expectation expressions, matrices, integrals, or any discussion of econometrics, statistics, or machine learning methods. Governs how to present math legibly in the terminal, where LaTeX does not render.

- Skill: `groceryheist/mathshow` (Agent Skill)
- Install (CLI): `npx skillmds@latest add groceryheist/mathshow`
- Raw SKILL.md: https://api.skillmd.com/api/skills/groceryheist/mathshow/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: groceryheist (https://skillmd.com/u/groceryheist)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/groceryheist/mathshow

---


# Showing math in the terminal

The TUI renders GitHub-flavored markdown and **cannot typeset LaTeX**. Raw `$...$`
reaches the user as literal dollar signs and backslashes. Two presentation paths,
chosen by the complexity of the expression.

## Short inline expressions: Unicode glyphs

Write them directly in prose. No LaTeX, no `mathshow` call.

τ, β, α, λ, ε, μ, σ, π, Δ, Σ, ∫, √, ≤, ≥, ≠, ≈, ∈, ∉, ⊂, ∼, →, ⇒, ∀, ∃, ±, ∞, ⊥
Subscripts: ᵢ ⱼ ₜ ₀ ₁ ₙ ₖ — Superscripts: ⁰ ¹ ² ³ ⁿ ᵀ ′

So: `Yᵢₜ = αᵢ + λₜ + βDᵢₜ + εᵢₜ`, `E[ΔY | D=1]`, `p(X) ∈ (0,1)`, `√n`, `X ⊥ D | Z`.

Division stays inline as `p(X)/(1−p(X))` when it is a simple ratio.

## Genuine display math: call `mathshow`

Use it for anything Unicode degrades: stacked fractions, integrals with limits,
multi-line `aligned` derivations, matrices, large operators with sub/superscripts,
nested brackets.

Do **both** of these, in this order:

1. Emit the LaTeX in a fenced code block so it stays readable and copy-pasteable
   into Quarto or LaTeX.
2. Call `mathshow` with the same LaTeX so the typeset version appears in the viewer.

````
```latex
\tau_{dr} = E\big[(w_1 - w_0)(\Delta Y - m_0(X))\big]
```
````

```bash
mathshow '\tau_{dr} = E\big[(w_1 - w_0)(\Delta Y - m_0(X))\big]'
```

If `mathshow` is not on PATH, it is at `${CLAUDE_PLUGIN_ROOT}/bin/mathshow`.

Multi-line derivations use `aligned` (or a bare `align`; both work):

```bash
mathshow '\begin{aligned}
\tau_{ipw} &= E\left[\frac{D-p(X)}{\pi(1-p(X))}\Delta Y\right] \\
           &= E[\Delta Y \mid D=1] - E\left[\frac{p(X)}{1-p(X)}\Delta Y \;\middle|\; D=0\right]
\end{aligned}'
```

## Mechanics

- Single-quote the argument so bash leaves backslashes alone; stdin also works
  (`mathshow < file.tex`).
- First call opens a kitty window titled `mathshow`; later calls reuse it and the
  equations accumulate in its scrollback. The window may open **behind** the active
  one — mention this the first time in a session.
- `amsmath` and `amssymb` are loaded. Colors track the kitty theme automatically.
- Renders are cached by content hash, so repeats are instant.
- It always exits 0. On a LaTeX error it prints the failing `!` lines and the raw
  LaTeX to stderr — read them and fix the LaTeX rather than ignoring it.

## Don't

- Don't emit bare LaTeX outside a code block — it renders as noise.
- Don't call `mathshow` for a lone symbol or simple ratio; Unicode is faster to read
  in context than a window switch.
- Don't batch a whole response's math into one call; one call per display equation
  keeps the viewer scannable.

