[BUG] Inline $...$ math renders as raw text for some valid KaTeX expressions, while the same content renders in $$...$$
Environment
- Claude desktop app 2.2553.1, Code tab
- Claude Code 2.1.169
- macOS (Darwin 25.6.0), Apple Silicon
Summary
In assistant messages, inline math delimited by $...$ is sometimes emitted as raw
literal text (delimiters included) instead of being typeset, while the exact same
content inside a $$...$$ display block renders correctly.
This is not an unsupported-macro problem: every LaTeX construct in the failing
expression renders fine on its own in the same client.
Reproduction
Have the assistant emit a message containing the following markdown. In my session,
items 1-3 and 5-8 typeset correctly; item 4 is shown as literal text, including
the surrounding $ delimiters.
1. Inline integral: $\int_L \frac{d\tau}{\tau-z}$
2. tfrac: $\tfrac12$
3. Escaped space: $1,\ 2,\ 3$
4. Combined: $\frac{1}{2\pi i}\int_L\frac{d\tau}{\tau-z} = 1,\ \tfrac12,\ 0$
5. Same content as a display block:
$$\frac{1}{2\pi i}\int_L\frac{d\tau}{\tau-z} = 1,\quad \frac12,\quad 0$$
6. boxed: $\boxed{S^2 = I}$
7. cases:
$$\Phi^{\pm}(t) = \begin{cases} \varphi(t), & z \in D^+\\ 0, & z \in D^-\end{cases}$$
8. operatorname: $\operatorname{Ind} G(t) = \varkappa$
Observed
Item 4 is displayed verbatim as:
$\frac{1}{2\pi i}\int_L\frac{d\tau}{\tau-z} = 1,\ \tfrac12,\ 0$
The failure is deterministic: the same expression failed to render in two separate
messages in the same conversation.
Expected
Item 4 typesets, the same way item 5 does.
Notes that may help narrow it down
- Each constituent construct of item 4 renders individually in this client:
\int_L (item 1), \tfrac (item 2), \ (item 3). \boxed, begin{cases},
\operatorname and \varkappa also render (items 6-8).
- Display
$$...$$blocks did not fail once across the whole conversation,
including blocks containing \operatorname, \partial, \begin{cases} and
nested fractions. Only inline $...$ is affected.
- One textual difference between the working item 1 and the failing item 4:
item 1 has a space in \int_L \frac, item 4 has \int_L\frac with no space
after the subscript. I have not been able to confirm whether that is the
trigger, so please treat it as a hint rather than a diagnosis.
Impact
Writing mathematics in chat is unreliable in a way that is invisible to the
assistant: the assistant cannot see its own rendered output, so it cannot detect
or work around the failure without the user reporting it each time. The practical
workaround is to put anything non-trivial into $$...$$ display blocks, which
hurts readability for short inline expressions.