• ogas

    最近两个月订阅了 Claude Pro,主要用来学习和整理笔记,搭配 Obsidian 形成了一套比较顺手的工作流

    目前唯一的痛点是 Claude Code 的 Desktop App 行内 KaTeX 渲染一直有 bug,相关 issue 开了很久也没人修

    github.com/anthropics/claude-code

    [BUG] Inline KaTeX math ($...$) no longer renders in chat output — only block $$...$$ works (regression)

    已打开 10:56AM - 05 Jun 26 UTC

    图片

    GuyAzene

    bug

    platform:macos

    area:desktop

    Preflight Checklist

    • [x] I have searched existing issues and this hasn't been reported yet
    • [x] This is a single bug report (please file separate reports for different bugs)
    • [x] I am using the latest version of Claude Code

    What's Wrong?

    When Claude's reply contains inline math wrapped in single dollar signs ($...$), it doesn't render — the raw source is shown instead, dollar signs included. For example, $q_0$ appears as the literal text "$q_0$" rather than a typeset q-zero.

    Block math wrapped in double dollar signs ($$...$$) on its own line still renders correctly as typeset KaTeX. So only inline math is broken; block math is fine.

    What Should Happen?

    Inline math wrapped in single dollar signs ($...$) should render as typeset KaTeX, the same way block math ($$...$$) does, with the dollar delimiters hidden. For example, the start state is $q_0$ should display a typeset q-zero, not the literal text $q_0$. Inline math should render the way it did in earlier versions and the way block math still does today.

    Error Messages/Logs```shell

    ```### Steps to Reproduce

    1. Ask Claude anything whose answer naturally contains inline math, e.g. "explain a Turing machine's transition function".
    2. Claude replies with a sentence containing inline $...$, such as: the start state is $q_0$ and the alphabet is $\Sigma = \{0,1\}$.
    3. Observe that each inline $...$ segment shows as raw text with visible dollar signs, not typeset math.
    4. For contrast, note that block math on its own line renders correctly:

    $$\delta: Q \times \Gamma \to Q \times \Gamma \times \{L,R\}$$

    Claude Model

    Opus

    Is this a regression?

    Yes, this worked in a previous version

    Last Working Version

    _No response_

    Claude Code Version

    2.1.156 (Claude Code)

    Platform

    Anthropic API

    Operating System

    macOS

    Terminal/Shell

    Other

    Additional Information

    Surface: Claude Code desktop app (macOS). The Terminal/Shell dropdown has no desktop-app option, so it may not reflect the actual surface.

    Reproducible 100% of the time this session: every inline $...$ expression shows raw dollar signs, while every $$...$$ block renders correctly. Inline single-$ math rendered fine in earlier versions, so this looks like a regression.

    <img width="1049" height="371" alt="Image" src="https://github.com/user-attachments/assets/a62ccbff-f968-4c0f-ad6f-ba3ca994421d&quot; />

    相比之下Codex App 在这方面体验好很多

    但是答疑质量上还是 Opus4.6 薄纱 GPT

    GPT 也用了两个月,输出风格实在不敢恭维

    主楼
  • almosl

    把下面这个放进用户claude.md 可以在大部分情况缓解问题```

    Math in chat replies (Claude Desktop renderer)

    The Claude Desktop markdown renderer has a broken inline-math path. Measured behaviour applies to chat output, not to files:

    1. Inline math: only \(...\) renders. `, , \\(...\\), and $$...$$`

    written inline all print as literal source. Never use `` inline.

    2. \( must be preceded by a space or start-of-line. Glued to the previous character it

    silently degrades to a plain ( and the body gets eaten by markdown emphasis

    (V_{\mathrm{cell}} → italics). This is the most common failure: a CJK comma or a Chinese

    word directly before \(. Write 文字 \(x\), not 文字\(x\).

    The closing \) is safe glued to anything — \(V=IR\)。 and \(V=IR\)成立 both render.

    3. Hard length cap: the body must be ≤ 60 source characters. 60 renders, 61 fails —

    sharp cliff, verified at every length from 31 to 64. The count is source characters, not

    rendered symbols: \alpha+... at 63 chars fails while the identical formula written with

    α at 21 chars renders.

    4. Over 60 chars, two fixes: compress the source with Unicode glyphs

    (? ? Δ α η μ σ π ≈ ± × ≤ ≥ ∞ ? instead of \partial \nabla \Delta \alpha ..., and drop

    \mathrm from subscripts: V_{cell} not V_{\mathrm{cell}}), or move it to a display block.

    Both verified to recover previously-failing formulas.

    5. Display math: $$...$$ on its own lines works reliably, with no length limit and no

    space rule. This is the escape hatch — when in doubt, promote to display.

    6. aligned loses its & alignment points (rows come out centred). Use

    \begin{array}{rcl} ... &=& ... \\ \end{array} instead; column spacing runs a bit wide but

    the equals signs line up.

    Practical default: keep inline math short and Unicode-dense, always leave a space before \(,

    and push anything with a fraction-of-fractions or more than ~4 terms into $$.

    #1

发表回复

登录后回复