Chat: KaTeX parse error breaks markdown/math rendering

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

While viewing an AI chat response that includes inline or display mathematics, the chat renderer fails with a KaTeX parse error. A tooltip shows an error similar to: ParseError: KaTeX parse error: Can’t use function ‘\l’ in math mode (with a position index in the parsed string). After the failure, a large portion of the message is shown as raw, unrendered content in red, mixing visible LaTeX fragments, markdown (e.g. bold), and table-like pipe text. The response is hard to read; formatting is effectively broken for that chat turn.

Steps to Reproduce

  1. Open Cursor IDE chat with a model that produces technical answers with equations (e.g. physics / engineering calculations).
  2. Ask for an analysis that includes LaTeX-style math (fractions, \frac, \Delta, impulse/momentum expressions, etc.).
  3. When the model emits math that KaTeX rejects (in this case, input apparently containing an invalid \l token in math mode — possibly from truncation or a malformed \left / similar sequence), observe the chat pane.
  4. Actual result: KaTeX error tooltip appears; subsequent content renders as red raw text instead of normal formatted markdown and math.

(Exact prompt text not required; the failure mode depends on specific generated LaTeX strings.)

Expected Behavior

Invalid or unsupported LaTeX should fail gracefully: show a small inline error or plain-text fallback for the offending expression, while the rest of the message continues to render as normal markdown and math. The entire remainder of the response should not turn into a red raw dump.

A screenshot will be attached showing the KaTeX ParseError tooltip and the red-rendered tail of the response.

Screenshots / Screen Recordings

Operating System

Windows 10/11

Version Information

IDE:
Version: 3.2.0-pre.6.patch.0
VSCode Version: 1.105.1
Commit: 7b988c9060d302d4752a7b58829dac7239ac3740
Date: 2026-04-10 06:02:02
OS: Windows_NT x64 10.0.26200

(Copied from local install product.json / About-equivalent fields.)

For AI issues: which model did you use?

Opus 4.6 (as shown in the chat model selector when the issue occurred)

For AI issues: add Request ID with privacy disabled

Not captured — privacy was not disabled for the affected chat turn. I can add a Request ID if needed after reproducing with privacy off.

Additional Information

  • The visible error references "\l" in math mode, which may indicate malformed model output (e.g. broken "\left…") or how the chat pipeline splits/passes strings into KaTeX.
  • Impact is readability of long technical answers; the IDE otherwise continues to function.
  • Screenshot will be attached separately (KaTeX ParseError tooltip + red-rendered tail of the response).

Does this stop you from using Cursor

No - Cursor works, but with this issue

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.