LATEX Rendering issue in agent chat

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

When the agent replies to me using LATEX the output gets doubled. It is rendered in latex and then again in plain text.

Steps to Reproduce

I receive this error every time I ask it to write me math

Expected Behavior

It should just renter the latex without duplicating it in plain text.

Screenshots / Screen Recordings

Operating System

MacOS

Version Information

Version: 3.6.31
VS Code Extension API: 1.105.1
Commit: 81fcf2931d7687b4ff3f3017858d0c6dee7e2a60
Date: 2026-05-31T17:46:29.630Z
Layout: glass
Build Type: Stable
Release Track: Default
Electron: 39.8.1
Chromium: 142.0.7444.265
Node.js: 22.22.1
V8: 14.2.231.22-electron.0
xterm.js: 6.1.0-beta.220
OS: Darwin arm64 25.3.0

For AI issues: which model did you use?

I’ve used auto, composer 2.5, Opus 4.7, and GPT 5.5

Does this stop you from using Cursor

Yes - Cursor is unusable

Pasting:

document.getElementById(‘katex-fix’)?.remove();
document.getElementById(‘katex-real’)?.remove();
document.getElementById(‘katex-fix-v2’)?.remove();
(() => { const s = document.createElement(‘style’); s.id = ‘katex-mathml-only’; s.textContent = ‘.katex-html{display:none!important}’; document.head.appendChild(s); return ‘mathml-only mode’; })()

into my console seemed to work

This is something we’ve seen before - there are two separate issues at play here. The doubled output (where each math symbol appears twice) is caused by the MathML annotation not being properly hidden by CSS, so both the rendered math and the raw annotation text show up. The red-text collapse happens when the model outputs nested math delimiters (like \( inside a \[...\] block), which triggers a KaTeX parse error that cascades across the rest of the response.

Your console workaround hiding .katex-html is smart - it works because your browser natively renders the MathML, so hiding the KaTeX HTML output leaves only the clean MathML rendering. That said, it’s a temporary fix that resets on reload.

Our team is aware of several math rendering gaps in the chat interface and is actively working on improvements. I don’t have a specific timeline for when this particular combination will be resolved, but I’ve flagged it internally.

In the meantime, the console snippet you found is the best workaround available. If you want math content to render more reliably in general, you can also add a User Rule like:

When writing mathematical formulas, use $$...$$ for block math only. Avoid nesting math delimiters. Never use \( inside a \[ block.

This can reduce how often the model triggers the parse error cascade.

Let me know if you have any other questions!