Bug Description
Title: Terminal corrupts and does not render LaTeX math in assistant output
Environment: Claude Code CLI, Windows 11, PowerShell.
Summary: Assistant messages containing LaTeX math are (1) shown as raw source instead of rendered, and (2) silently corrupted by GitHub-flavored-markdown backslash-escaping applied before display, which mangles LaTeX spacing macros.
Repro & evidence:
- Backslash-punctuation escaping (content corruption). The model emits $\forall, \varepsilon$. It is displayed as $\forall, \varepsilon$ — the , (LaTeX thin-space) has its backslash stripped, leaving a bare comma. Same failure for ;→;, :→:, !→!. Meanwhile \varepsilon, \forall, \ge keep their backslashes, because markdown only escapes ASCII punctuation, not letters. So the escaping is selective and corrupts exactly the spacing macros.
- No math rendering. The model emits $$f(n) = 2n, \qquad g(n) = n.$$. It is displayed verbatim as raw source — $$, \qquad and all — with no math typesetting.
Expected: Either render $...$ / $$...$$ as math, or at minimum pass their contents through verbatim (no backslash-escaping) so the source can be copied into a LaTeX renderer intact.
Actual: Math is not rendered, and backslash-punctuation escapes inside math spans are stripped, silently corrupting the LaTeX. The model emits correct source and cannot see the corruption; the user gets stray punctuation.
Impact: Math-heavy responses are hard to read in-terminal, and — worse — copy-pasting the raw source into a real LaTeX engine yields wrong output wherever spacing macros were used, with no visible warning.
Suggested fix: Treat $...$ / $$...$$ as math spans: skip markdown backslash-escaping inside them, and ideally render them (or fall back to a Unicode/plaintext math presentation).
Environment Info
- Platform: win32
- Terminal: WezTerm
- Version: 2.1.218
- Feedback ID: f64b4b12-cf46-49b0-be57-0edbff64731e
Errors
Bug Description
Title: Terminal corrupts and does not render LaTeX math in assistant output
Environment: Claude Code CLI, Windows 11, PowerShell.
Summary: Assistant messages containing LaTeX math are (1) shown as raw source instead of rendered, and (2) silently corrupted by GitHub-flavored-markdown backslash-escaping applied before display, which mangles LaTeX spacing macros.
Repro & evidence:
Expected: Either render$...$ / $$...$$ as math, or at minimum pass their contents through verbatim (no backslash-escaping) so the source can be copied into a LaTeX renderer intact.
Actual: Math is not rendered, and backslash-punctuation escapes inside math spans are stripped, silently corrupting the LaTeX. The model emits correct source and cannot see the corruption; the user gets stray punctuation.
Impact: Math-heavy responses are hard to read in-terminal, and — worse — copy-pasting the raw source into a real LaTeX engine yields wrong output wherever spacing macros were used, with no visible warning.
Suggested fix: Treat$...$ / $$...$$ as math spans: skip markdown backslash-escaping inside them, and ideally render them (or fall back to a Unicode/plaintext math presentation).
Environment Info
Errors