latex-terminal is an opt-in Claude Code plugin that prevents Markdown
escaping from corrupting LaTeX punctuation commands in terminal output.
For example, without the plugin Claude Code can display \, as , and \;
as ;. With the plugin enabled, those commands remain copyable LaTeX source.
This is an opt-in workaround for anthropics/claude-code#80702. It preserves source at display time; it does not modify Claude Code itself.
- Protects Markdown-sensitive LaTeX escapes inside inline
$...$math. - Leaves display-only
$$...$$batches on Claude Code's native path. Once an inline span requires replacement, it also protects display math in that batch and later batches of the same streamed response. - Leaves code fences, inline code, ordinary Markdown, and non-math messages unchanged.
- Changes display output only. Claude's transcript and model context retain the original response.
This plugin preserves source; it does not typeset equations.
Without the plugin, Markdown escaping can remove the backslashes from LaTeX spacing commands:
Inline: $a,b$ and $x;y$.
With the plugin, the terminal displays the source Claude produced:
Inline: $a\,b$ and $x\;y$.
The following captures use the same Claude Code prompt on macOS with Kitty.
Clone this repository, then run Claude Code from its root:
claude --plugin-dir "$PWD"Then ask Claude to emit an expression containing \,, \;, \:, or \!.
Use /reload-plugins after editing plugin files in an active development
session.
Run the test suite from the repository root:
PYTHONDONTWRITEBYTECODE=1 bash hooks/run-python.sh -m unittest discover \
-s tests -p 'test_*.py' -vThe hook requires Bash and Python 3.8 or newer on PATH. It checks python3,
python, and the Windows py -3 launcher in that order. On Windows, use a
Python installation that is available from Git Bash; Git Bash provides the
required Bash runtime and path conversion.
The hook does not make network requests. It stores only temporary parser state
under CLAUDE_PLUGIN_DATA while a message is streaming and removes that state
when the message completes.
- Only dollar-delimited math is supported in this release.
- The plugin deliberately does not render LaTeX visually or add a terminal- specific graphics dependency.
Apache-2.0. See LICENSE.

