Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Math InlineNew to Visual Studio Code? Get it now.
Math Inline

Math Inline

polecoder

|
141 installs
| (0) | Free
See LaTeX math ($...$ and $$...$$) rendered inline while you type in Markdown, like Obsidian or Typora. No preview pane needed.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Math Inline

Version Installs Rating

Math Inline demo

Renders $...$ and $$...$$ math in Markdown files directly in the editor, not just in the preview.

Extensions based on the preview show formulas in a separate panel. Math Inline shows them in the editor itself, as Obsidian or Typora do.

Quick start

  1. Install Math Inline from the Marketplace.
  2. Open a .md file.
  3. Type $e^{i\pi}+1=0$. While the cursor is still on it, a preview appears right after the closing $; move the cursor away and the TeX is replaced by the rendered formula.
  4. Move the cursor back into the formula to edit its TeX.
  5. Press Ctrl+Alt+M (Cmd+Alt+M on macOS) to switch between rendered formulas and TeX source.

Features

  • Formulas between single dollars, like $e^{i\pi} + 1 = 0$, are replaced by their rendered version (MathJax, SVG output).
  • Move the cursor into a formula (or select it) to edit its TeX source; it renders again when you leave. While you edit, the rendered formula is shown right after the closing $, and it keeps showing the last valid rendering while the TeX is half-typed.
  • Invalid TeX is underlined (also while you edit it), and hovering it shows the error.
  • Hover a formula's source to see a larger rendering.
  • Formulas are scaled down to fit the line. Those that would get too small (matrices, stacked fractions, big operators with limits) are replaced by a ∑ show formula chip: hover it to see the formula in display mode. While you edit one, the preview opens next to the cursor.
  • Display math written on one line, like $$\int_0^1 x\,dx$$, is rendered in display style the same way, and becomes a chip when it would not fit.
  • Multi-line $$ ... $$ blocks are drawn on their own lines:
    • A block that is a single table (aligned, cases, array, matrices, gathered, ...) with one row per line shows each row rendered on its own line, with the columns aligned as in the full formula. Fractions in tables use text style, and all rows share the same size.
    • Put the cursor on a row to edit it: only that line shows its TeX, with a live preview of the row at the end of the line, while the rest of the block stays rendered. While the TeX is half-typed (say, an unclosed \frac{), the other rows keep their last good rendering and the edited line is underlined.
    • Any other block (a single integral, a long sum split across lines, ...) is cut into horizontal bands, one per line of the block.
    • Blocks that would get too small to read, that you fold by hand, or that have a TeX error show their plain TeX, without a preview. The extension never folds blocks by itself, and blocks left folded from an earlier session are unfolded when the document opens.
  • Formulas that render here but that VS Code's Markdown preview (KaTeX) cannot render, like \bbox, get a warning in the Problems panel pointing at the unsupported command.

Dollar signs follow Pandoc's rules, so $5 and $10 is not math: the opening $ must not be followed by a space, and the closing $ must not be preceded by a space nor followed by a digit. Escaped dollars (\$), code spans and code blocks (fenced or indented, also inside list items) are ignored. So are YAML front matter, HTML comments, the content of <pre>, <code>, <script>, <style> and <textarea>, and the destination and title of links and images ([text](https://github.com/polecoder/math-inline/blob/HEAD/url "title")) and autolinks (<https://...>). The text of a link can still contain formulas.

Settings

Setting Default Description
mathInline.enabled true Render $...$ and $$...$$ math in Markdown editors.
mathInline.scale 1 Size of formulas relative to the editor font size.
mathInline.color "" CSS color for formulas. Empty picks one based on the theme (light/dark/high contrast).
mathInline.katexWarnings true Warn about formulas that VS Code's Markdown preview (KaTeX) cannot render.

Command: Math Inline: Toggle Inline Math Rendering, bound to Ctrl+Alt+M (Cmd+Alt+M on macOS) in Markdown editors. Press it once to see the TeX source of every formula, and again to see them rendered. To use another shortcut, open Preferences: Open Keyboard Shortcuts and search for mathInline.toggle.

Known limitations

  • VS Code cannot add room between lines, so a $$ block is drawn within the lines it already has: rows taller than a line (stacked fractions, matrices inside a row) share one scale and may overlap the empty space of neighbouring lines, and the lines with $$, \begin and \end stay empty.
  • A table is drawn by rows only if every row starts on its own line and the block holds nothing but the table; otherwise it is drawn in bands, and while you edit it the whole block shows its TeX.
  • VS Code cannot change line heights, so tall formulas are scaled down or collapsed into a chip instead of being shown at their natural size. Use mathInline.scale to adjust the overall size.
  • Only the formulas near the visible area are rendered. In long documents, formulas far from it show their plain TeX until you scroll near them (a very fast scroll can show TeX for a moment).
  • With word wrap on, VS Code wraps lines based on the length of the (hidden) TeX source, so a line full of formulas may wrap earlier than it looks like it should.
  • Extensions cannot read theme colors, so the default formula color depends only on the theme kind. Set mathInline.color to match your theme exactly.

Feedback

If Math Inline is useful to you, please leave a rating on the Marketplace or a star on GitHub. If something fails, open an issue.

Development

npm install
npm run watch   # rebuild on change; press F5 to open test-fixtures/sample.md in a dev host
npm test        # parser unit tests + integration tests in a VS Code instance
npm run package # build math-inline-<version>.vsix
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft