[Feature Request] Add LaTeX/KaTeX math rendering to TUI
## Summary
The Claude Code terminal UI does not render LaTeX math. Inline ($...$) and display ($$...$$) expressions appear as raw text with
literal dollar signs and backslashes, making any math-heavy conversation unreadable in the CLI.
## Current Behavior
When Claude outputs:
```markdown
The DC component of a half-wave rectifier is $V_{DC} = \frac{V_m}{\pi} \approx 0.318\,V_m$.
$$V_{rms} = \sqrt{\frac{1}{T}\int_0^T v^2(t)\,dt}$$
```
The TUI displays it verbatim — $V_{DC} = \frac{V_m}{\pi}$ — instead of rendering the formula.
Screenshot of the issue:
(attach your screenshot here)
## Expected Behavior
Math expressions should render as readable formulas, either:
- As proper typeset math (via terminal graphics protocols), or
- As a Unicode fallback (e.g.,
V_DC = V_m / π ≈ 0.318·V_m).
## Use Case
I use Claude Code as a study companion for engineering coursework (electronics, signal processing, control systems). Claude
correctly produces well-formatted LaTeX from my lecture notes — but I can't read the output without copying it into an external
KaTeX renderer.
This affects anyone using Claude Code for:
- 📚 STEM coursework and tutoring
- 📄 Research papers (arXiv ML/CS/physics content)
- 📊 Math-heavy domains (DSP, finance, statistics, control theory)
- 🔬 Code review for numerical algorithms and ML loss functions
## Current Workarounds (all unsatisfactory)
| Workaround | Problem |
|------------|---------|
| Switch to claude.ai web | Lose project context, CLI tooling, MCP servers |
| Use VS Code with nuriyev.claude-code-katex extension | Forces me out of my preferred terminal workflow |
| Ask Claude to write formulas in ASCII/Unicode | Degrades fidelity — matrices, integrals, piecewise functions become ugly and
ambiguous |
| Pipe output to external math renderer | Breaks the interactive REPL experience |
## Proposed Solutions (in order of preference)
### 1. Native rendering via terminal graphics protocols
Render KaTeX/MathJax to PNG/SVG and display inline using:
- Kitty graphics protocol
- Sixel (xterm, foot, WezTerm, etc.)
Many modern terminals support at least one. Gracefully fall back to option 2 on unsupported terminals.
### 2. Unicode fallback renderer
Auto-convert common LaTeX patterns to Unicode math:
\frac{a}{b}→a/b(or stacked Unicode where readable)\sqrt{x}→√xx_i,x^2→xᵢ,x²(Unicode sub/superscripts)\int,\sum,\alpha,\pi→∫,∑,α,π\begin{cases}...\end{cases}→ ASCII brace + indented lines
### 3. Opt-in external viewer
A setting like --math-renderer=browser that opens detected formulas in a local KaTeX preview, or copies them to clipboard as PNG.
## Related Issues
- #21433 (existing feature request for LaTeX rendering)
## Impact
For technical and scientific users, this is the single biggest blocker preventing adoption of Claude Code over claude.ai. The model
produces excellent math output — the rendering gap forces a UX downgrade that doesn't exist on the web.
## Environment
- Claude Code version:
<your version, e.g., 1.0.151> - Terminal:
<e.g., kitty, alacritty, gnome-terminal> - OS:
<e.g., Arch Linux, macOS 14> - Shell:
<e.g., fish, zsh, bash>
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗