Show HN: LaTerM: LaTeX renderer for terminal AI tools (github.com)

🤖 AI Summary
LaTerM (xterm-latex) is a zero‑config LaTeX renderer for terminal AI tools — an xterm addon you can install via npm that lets CLI agents and terminal UIs display both inline ($…$) and display ($$…$$) math with theme-aware, pre-rendered overlays. It hooks terminal.write (so it works with what front-ends forward to the renderer, not raw pty streams), detects LaTeX heuristically (to avoid confusing shell variables), and replaces detected math with a deterministic 4‑character base63 hash while associating that hash with a pre-rendered visual overlay. The result: math-heavy AI outputs look correct in terminals and respond to zoom/scroll without requiring complex setup. Technically, LaTerM exposes a LatexAddon plus lower-level LatexProcessor and OverlayManager, supports custom macros, and offers controls like cacheSize, minPlaceholderWidth, debugLogging, and enable/disable. Because terminals use backslashes, it substitutes a safe macro (@nl) for row separators (and recommends including a provided recPrompt.txt so models learn the constraint). It’s MIT‑licensed, powers projects like an Obsidian terminal plugin, and invites contributions — areas noted for improvement include LaTeX detection heuristics, manual LaTeX entry ergonomics, and occasional inline fraction render collisions (often due to AI output). This is a practical tool for making terminal-based AI workflows mathematically fluent.
Loading comments...
loading comments...