vscode markdown preview not supporting some math commands

Viewed 2985

I'm writing markdown on vscode. But some math latex commands are not supported on vscode built-in preview. E.g.

$$ \ket{\psi} $$

cannot be properly rendered. How do I fix this? How do I add support to a bigger set of commands? Are there any extension that does this for me?

I installed markdown + math extension, but still not working for \ket command. Also for some reason, markdown + math's official example for equation numbers supporting is not working. I don't understand why.

1 Answers

VSCode 1.58 (June 2021) will support math equations rendering in markdown:

Math formula rendering in the Markdown preview

VS Code's built-in Markdown preview can now render math equations using KaTeX

Math rendering in the built-in markdown preview

Inline math equations are wrapped in single dollar signs:

Inline math: $x^2$

While you can create a math equation block with double dollar signs:

Math block:
$$
\displaystyle
\left( \sum_{k=1}^n a_k b_k \right)^2
\leq
\left( \sum_{k=1}^n a_k^2 \right)
\left( \sum_{k=1}^n b_k^2 \right)
$$

You can set "markdown.math.enabled": false to disable this feature.

It even comes with:

Markdown math formula syntax highlighting

We now also support highlighting of math equations in Markdown source:

Syntax highlighting of a math equation in a markdown file

This works both in normal markdown files and in Markdown cells inside notebooks.

Related