Skip to content

[Feature Request] Add LaTeX/KaTeX math rendering to TUI #63139

Description

@KaanAlper

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:

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}√x
  • x_i, x^2xᵢ, (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

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>

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:tuiduplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions