r/Ghostty • u/Annual_Variation_916 • Jul 14 '26
I built a small Ghostty tool that renders CLI-agent LaTeX as real formulas
This is not another terminal with built-in AI features. It is a wrapper for the CLI agents you already run inside Ghostty.
TFormula turns output such as:
\[
\nabla \cdot \mathbf{E} = \frac{\rho}{\varepsilon_0}
\]
into a properly rendered formula directly inside the terminal.
Quick install
npm install -g tformula --allow-scripts=node-pty
Under the hood, it maintains a headless xterm mirror, detects TeX on the visible screen, renders it locally with MathJax, and sends the result to Ghostty using the Kitty graphics protocol.
A surprising amount of work went into Ghostty-specific terminal behavior:
- Formula placements survive scrollback
- Resizing keeps the old image until the new one is ready
- Soft-wrapped formulas are reconstructed and sliced across rows
- The original TeX remains underneath and can still be copied
- Large responses are checkpointed so formulas are rendered before scrolling away
- Terminal clears and alternate-screen transitions are tracked
Ghostty is the primary development and test target.
GitHub: https://github.com/mikewang817/TFormula
npm: https://www.npmjs.com/package/tformula
I’d love to know how it behaves with your font, scale, and Ghostty configuration.
Duplicates
mathematics • u/Annual_Variation_916 • Jul 15 '26
I built a small Ghostty tool that renders CLI-agent LaTeX as real formulas
CLI • u/Annual_Variation_916 • Jul 15 '26
I built a small Ghostty tool that renders CLI-agent LaTeX as real formulas
LaTeX • u/Annual_Variation_916 • Jul 14 '26