[FEATURE] LaTeX rendering in "Claude Code for VS Code" plugin

Status Open
Maintainer reply None cached
Activity 45 comments · opened Jan 6, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Currently "Claude Code for VS Code" plugin does not render LaTeX.

Proposed Solution

It would be great to support LaTeX rendering in "Claude Code for VS Code" plugin. Thanks! ☺️

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Other

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

45 Comments

Ethan-Arrowood · 8 months ago

Here is an example screenshot:

<img width="739" height="614" alt="Image" src="https://github.com/user-attachments/assets/4a2317f7-451a-4128-b4af-e499857d329b" />

I've wound up just copy-pasting the output latex into my markdown file so it renders automatically.

aarontrowbridge · 8 months ago

we really need this!

manideepmamindlapally · 8 months ago

This would be fantastic!

ihrke · 8 months ago

yes, sorely missing that!

MahammadNuriyev62 · 7 months ago

++++

liyimengwork · 7 months ago

definitely need this

mthan160 · 7 months ago

I back this, currently VS Code Github Copilot with Opus 4.6 can render math correctly, but not Claude Code VS Code extension

josephDuque · 7 months ago

Just noticed this issue myself, this would be great to have on VS code!

Sloudis · 7 months ago

This would be really useful for me!!

CiaranHaines · 7 months ago

This please

AI1379 · 7 months ago

Need this please🥺🥺

25d-228 · 7 months ago

how could every software, claude code, codex failed to support latex rendering and text select-response.

ductai199x · 7 months ago

BUMP THIS PLEASE!!!!!

GeorgeWang26 · 7 months ago

bump

gcordova0309 · 7 months ago

Pleaseee!!!

DuoLife-QNL · 6 months ago

Please!!!

ductai199x · 6 months ago
temporary fix https://marketplace.visualstudio.com/items?itemName=nuriyev.claude-code-katex

Do you have a screenshot by chance? And how's the rendering peformance like?

MahammadNuriyev62 · 6 months ago
> temporary fix https://marketplace.visualstudio.com/items?itemName=nuriyev.claude-code-katex Do you have a screenshot by chance? And how's the rendering peformance like?

| Before | After |
|--------|-------|
| <img width="505" alt="Image" src="https://github.com/user-attachments/assets/4813f18c-fcaa-419f-a636-a8c3651f8ec4" /> | <img width="503" alt="Image" src="https://github.com/user-attachments/assets/a26b6b99-9e0c-4643-8467-549134068ee4" /> |

performance seems to be fine

@ductai199x

ductai199x · 6 months ago
> > temporary fix https://marketplace.visualstudio.com/items?itemName=nuriyev.claude-code-katex > > Do you have a screenshot by chance? And how's the rendering peformance like? | Before | After | |--------|-------| | <img width="505" alt="Image" src="https://github.com/user-attachments/assets/4813f18c-fcaa-419f-a636-a8c3651f8ec4" /> | <img width="503" alt="Image" src="https://github.com/user-attachments/assets/a26b6b99-9e0c-4643-8467-549134068ee4" /> | performance seems to be fine @ductai199x

that's prettt good! thank you for the share!! 🎉🎉🎉

MuriloChianfa · 6 months ago

this would be very appreciated, up vote ⬆️⬆️⬆️

ricitron · 6 months ago

Upvote!

The temporary fix from @MahammadNuriyev62 works great in the meantime!

Remilia-Kirisame · 6 months ago
KaiHangYang · 6 months ago
Chesterhuang1999 · 5 months ago
syned13 · 5 months ago

Upvotting this. We need this 🙏🙏

andrewboldi · 5 months ago

Yes, we need this please. Especially in the terminal.

aquaresima · 5 months ago

yes!! Please do this!

MahammadNuriyev62 · 5 months ago
dyed-eye · 5 months ago

For folks running Claude Code in a terminal rather than the VS Code extension (Windows Terminal, conhost, WezTerm, etc.) — claude-code-katex is a great fit if you're in VS Code, but it doesn't help terminal-only setups. @andrewboldi mentioned the gap above.

I built texpop to scratch that exact itch on Windows: a hotkey (Ctrl+Alt+V) opens a popup that overlays the focused terminal exactly, picks the focused chat across multi-tab sessions, and renders the last assistant message with KaTeX + Markdown + custom callouts. Reads the JSONL transcripts on disk; fully offline; MIT.

Not a replacement for first-party rendering inside Claude Code — that's the right long-term fix and what this issue is asking for. Just a stop-gap for the terminal cohort.

OscarBarreraGithub · 4 months ago

I made a VS Code extension called ClaudeTex to take care of this

I was having trouble with other implementations either failing on more complicated physics equations/matrices or opening separate preview tabs, so ClaudeTex renders inline in the existing Claude Code chat and includes extra handling for arrays, matrices, and safer $...$ parsing

haochengxi · 4 months ago

Please add this support! This will be very helpful!

bitons · 4 months ago

Please

canyuchen · 3 months ago

This issue remains for Version 2.1.186

MahammadNuriyev62 · 3 months ago
This issue remains for Version 2.1.186

feel free to use https://marketplace.visualstudio.com/items?itemName=nuriyev.claude-code-katex for now 😇

Fir-lat · 2 months ago

my temporary workaround: https://marketplace.visualstudio.com/items?itemName=lihengzhuang.vibe-latex, supporting copy and paste

aswin-polyenergetics · 2 months ago

+1, need this support natively

muhammadessam · 2 months ago

+1, need this support natively

PedroMilanezAlmeida · 1 month ago

+1, need this support natively

Irratzo · 1 month ago

I mostly have an issue with LaTeX rendering being absent in plans, only in the approval presentation view. Afterwards, I can use any Markdown previewer such as MPE on the approved plan and it's fine. But during the plan, for LaTeX, I always have to sidestep to Claude Code remote control, where most of the LaTeX is adequately rendered. It would be really helpful if it would also be rendered in the VSCode extension plan approval view.

nelsbuhrley · 1 month ago

VS Code chat does not render LaTeX math — remark-math / rehype-katex are absent from the webview bundle

Summary

Claude regularly emits LaTeX in its replies, both inline ($w_r = 2n^2$) and as fenced `math blocks. The same markdown renders correctly on github.com and in VS Code's own built-in markdown preview, but in the Claude Code chat panel it is displayed as literal LaTeX source.

This makes any maths-heavy conversation hard to read. It comes up constantly for scientific and numerical work — I am documenting a reconstruction algorithm, so most of what I ask about is equations, and every reply has to be either squinted at or re-requested in Unicode.

Environment

| | |
|---|---|
| Extension | anthropic.claude-code 2.1.234 and 2.1.235 (both affected) |
| VS Code | 1.134.0 stable (110a328ea54b) |
| Platform | Linux x64, Remote-SSH (.vscode-server) |

Reproduction

  1. Ask Claude anything that elicits maths, e.g. "write the Poisson negative log-likelihood and its gradient"
  2. The reply contains $\lambda_r = n^2|F_r|^2$ and `math blocks
  3. Expected: typeset equations, as on github.com: $\lambda_r = n^2|F_r|^2$
  4. Actual: literal $\lambda_r = n^2|F_r|^2$; the fenced block renders as a monospace code box containing LaTeX source

Root cause

webview/index.js is a react-markdown bundle, and it contains no math plugin or math renderer. Grep counts over the shipped bundle, identical in both versions:

katex=0  KaTeX=0  MathJax=0  remark-math=0  texmath=0  displayMath=0

Without remark-math, $…$ is never parsed as maths, so there is no inlineMath/math node for any renderer to consume — the text passes through as literal characters. The `math fence is treated as a code block with an unrecognised language, which is why it renders as monospace source.

Two details suggest this is a missing dependency rather than a deliberate omission:

  • The plugin array already exists. The react-markdown call site in the bundle passes plugins:

``js
b(QQ, { remarkPlugins: [XA], components: { a: ({href, children}) => … } })
``

  • The AST layer already knows the node type. inlineMath appears in the bundled mdast utility's list of known phrasing types — the serialisation side is aware of maths nodes; only the parser and the renderer are absent.

Suggested fix

The standard two-plugin recipe for react-markdown:

import remarkMath from 'remark-math'
import rehypeKatex from 'rehype-katex'
import 'katex/dist/katex.min.css'

<Markdown
  remarkPlugins={[XA, remarkMath]}
  rehypePlugins={[rehypeKatex]}
  … />

Notes that may reduce the cost:

  • KaTeX already ships inside VS Code, for the built-in markdown preview — ~/.vscode-server/cli/servers/Stable-*/server/node_modules/katex, currently 0.16.22. So the dependency is already present in the environment, and matching that version would keep rendering consistent between the chat panel and the markdown preview.
  • KaTeX adds roughly 270 KB to a bundle that is already ~4.9 MB, i.e. about 5%.
  • rehype-katex needs KaTeX's stylesheet in the webview; the panel already sets a Content-Security-Policy, so the CSS needs to be served with the webview's existing asset/nonce mechanism rather than from a CDN.
  • remark-math treats $ as significant, so a currency-heavy message could render oddly. singleDollarTextMath: false restricts inline maths to $$…$$ if that is a concern.

Why this cannot be worked around

  • Plugins cannot help. The plugin API has no renderer, webview, or display contribution point.
  • MessageDisplay cannot help. It is documented observe-only — on exit 2 "the original text is displayed" — so a hook cannot transliterate the maths on the way out.
  • A separate VS Code extension cannot help. Webviews are isolated and CSP-protected; there is no cross-extension API to modify another extension's webview.
  • Patching the bundle works until the next update overwrites it, and there are no source maps.

The only user-side option is to instruct Claude to emit Unicode instead (wᵣ = 2n²(1 − Iᵣ/λᵣ)), which loses fractions, integrals, matrices, and anything that needs two dimensions — and has to be re-established every session.

Impact

Small, self-contained change; removes a papercut that affects every scientific, mathematical, or ML conversation. Claude already emits correct, GitHub-compatible maths markdown — this is only about the renderer catching up with what the model is already producing.

cylindrical2002 · 1 month ago

Still unfixed in 2.1.239 (and 2.1.238), confirming @nelsbuhrley's analysis above on a newer build. Same environment: Linux x64, VS Code Remote (.vscode-server).

Re-ran the same grep over the shipped bundle in anthropic.claude-code-2.1.239-linux-x64 (webview/index.js, 4.9 MB; webview/index.css, 389 KB):

katex=0  KaTeX=0  MathJax=0  remark-math=0  rehype-katex=0

Two additional checks, in case they help rule out "the renderer is there but mis-wired":

  • No KaTeX stylesheet or fonts. Zero KaTeX CSS classes (.katex, .mord, .mrel, KaTeX_Main) in index.css, and zero .woff/.woff2 files anywhere in the extension directory. Even if a math plugin were present, there would be nothing to style the output with.
  • The MathML hits are a red herring. The only math-adjacent strings in the bundle (MathML, mathMl, teXML) are namespace constants and attribute tables from the bundled hast/DOMPurify code, not a renderer.

Also worth noting for anyone arriving here looking for a workaround: there is no user-side switch. claude-code-settings.schema.json defines 11 claude-code.* settings and none of them relates to math or to markdown plugins.

Given the number of duplicates this has accumulated (#82758, #74027, #84413 open; several more closed), it would help to have this one treated as the canonical thread.

muhammadessam · 1 month ago

One workaround is to use claude desktop code with displaying block latex.

renaud · 29 days ago

Here's what i added to my ~/.claude/CLAUDE.md:


## Writing LaTeX so it renders in the VS Code panel

I read your replies in the Claude Code VS Code side panel, where math is rendered by the
ClaudeTex extension: it runs KaTeX over the **already-rendered markdown HTML**. So the
markdown parser mangles the LaTeX before KaTeX ever sees it. Two rules follow. They cost
nothing in a plain terminal, so apply them always.

### 1. Display math goes on its own lines

Blank line before and after; `$$` alone on its own line at each end; nothing else on those
lines.

Expand:

$$
\zeta - \frac{1}{1-\alpha}\sum_{\omega \in S}\pi_\omega(\zeta - f_\omega)
$$

The first two terms cancel.


Never write `$$…$$` in the middle of a sentence. Markdown splits that paragraph into
`<em>`/`<span>` nodes, and KaTeX only matches `$$…$$` **within a single text node**, so the
whole formula falls out as raw source.

Inline `$…$` is handled by a separate, more tolerant pass and is fine mid-sentence — but
keep it short (under ~240 chars), on one line, with no `$` inside. Use it for symbols and
fragments ($P^{DA}$, $\zeta$), not for equations.

Math inside backticks or a code fence is never rendered — that is the way to show LaTeX
*source*.

### 2. Never put a backslash directly before punctuation

Markdown eats it (`\;` → `;`, `\,` → `,`). This corrupts formulas **even when they render
correctly otherwise**, leaving stray punctuation in the output. Use the letter-only KaTeX
equivalents:

| Don't write | Write instead |
|---|---|
| `\,` `\:` `\;` | `\thinspace` `\medspace` `\thickspace` (or `\quad`, `\qquad`) |
| `\{` `\}` | `\lbrace` `\rbrace` (`\left\{` … `\right\}` is fine — the extension repairs it) |
| `\|` | `\mid` or `\vert` (`\Vert` for the double bar) |
| `\\` row break | `\newline` |
| `\%` `\#` `\&` `\_` | restructure to avoid them |

`\\` row breaks survive only inside `matrix`/`pmatrix`/`bmatrix`/`vmatrix`/`smallmatrix`/
`cases`/`array`, which the extension repairs explicitly. Everywhere else — notably
`aligned` and `align` — write `\newline`, or split into separate `$$` blocks.

### 3. Keep every `_` preceded by a letter or digit

A `_` that follows `}` can **open** markdown emphasis; a later one closes it, wrapping part
of the formula in `<em>`. That splits the text node and kills the entire `$$` block, even
when it is correctly on its own lines. A `_` preceded by a letter or digit can only ever
*close* emphasis, so it is inert and safe.

In practice: write the subscript before the superscript.

| Don't write | Write instead |
|---|---|
| `\Delta^{\uparrow}_\omega` | `\Delta_\omega^{\uparrow}` |
| `\mathrm{CVaR}_\alpha` | `\mathrm{CVaR_\alpha}` |

Symptom to recognise: part of the raw formula shows up in *italics*, with backslashes
leaning over so they read like `|`. That is markdown emphasis, not a typo.
ahippelainen · 6 days ago

Bumping