tex-display

Reviewed at commit 8362030

Draws LaTeX display math in Claude's replies as typeset pictures in kitty and Ghostty and as Unicode text elsewhere, with MathJax bundled, so it runs no…

Made by
Samuel Recker
What we checked

Draws display math in Claude's terminal replies as images in kitty or Ghostty, or as Unicode text elsewhere, using a bundled copy of MathJax. It adds a short note (about 110 tokens) to your first prompt of each conversation on how to write math, and takes over /btw with text, asking in a separate request on your own account, which uses tokens. No file reads, programs or network calls.

Review details

Static review of the source at the pinned commit; not run. Delta review of the changes since f44dfb5; the rest carries over from the review at that commit. Registers session.start (registers the /tex-calibrate command via $.command.register), command.run for tex-calibrate ($.ui.open of a pane), ui.render for the calibration Pane (Buttons that adjust a plugin atom; Save calls $.config.set for tex-display.cellAspect and $.ui.toast), config.set for theme (only clears the cached look), session.compact and session.end (reset a flag), prompt.submit (appends a fixed MATH_PROMPT string to e.context once per context window, only on the terminal surface, and never reads the prompt text), and ui.render for AssistantMessage (on the terminal surface, when the reply contains $$, \[ or \begin{, splits it into Markdown and TeX pieces and renders each TeX block as an Image from a PNG it produces itself, as Unicode text via the vendored texToUnicode, or as a latex code block on a TeX error or past a 2 MiB per-message image budget). It reads the environment variables TERM, TERM_PROGRAM, KITTY_WINDOW_ID, TMUX and COLORFGBG and the theme from $.config.list. What changed: the rendering was moved into a shared column() function, and two things were added. command.run for /btw: when /btw has text, it calls $.model.fork with a fixed note (answer in one message, no tools) plus the text you typed, and returns the answer as the command output; bare /btw and a session with nothing to fork are passed to the engine. The fork is a model call on your own Claude account (uses tokens) with tools denied. A ui.render hook for CommandOutput of the btw command draws that answer through the same math renderer. The MathJax bundle, png.ts, raster.ts and the vendored unicode files are unchanged in this range (the changed-files list shows only register.tsx, tests and README), so the earlier targeted-search checks of the MathJax bundle still apply: no network, eval, require or process use. Results are cached in memory.

What it uses
  • Reads your prompts: no
  • Sees tool calls: no
  • Blocks or changes tool calls: no
  • Reads or writes files: no
  • Runs programs on your machine: no
  • Calls the model (uses tokens): yes
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Screenshot of tex-display

Renders display math ($$…$$, \[…\], equation/align/gather/multline) in Claude Code's terminal as images, with MathJax bundled: nothing to install

Made this mod? Add a badge to your README

modsforClaude badge for tex-display

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/tex-display.svg)](https://modsforclaude.com/mods/tex-display/)

← All mods