{{ message }}

# Survey of Syntax for Math in MarkDown

$\alpha$

### this is a wiki, everyone is welcome to contribute

[If you don't see an  button on top, you need to Sign in/up to Github.]

## Help needed: check and document these:

TODO: This is becoming useful as a cheatsheet => rearrange this page to be user-oriented before being developer-oriented.

It'd be nice if everybody could agree on the same syntax(es) to denote math fragments in Markdown; alas, as every extension to Markdown, it's a mess :-( If you're adding math support to your markdown tool, I have one plea: please consider supporting [a subset of] standard LaTeX delimiters before inventing your own. Also see discussion on CommonMark.

I'm taking for granted that the content of the math fragments is LaTeX syntax. Arguably syntaxes like AsciiMath (MMD used to do this), are a better match for Markdown's philosophy, but most people who care about non-trivial math support already know [some] LaTeX syntax (which is why MMD 3 switched to LaTeX).

• CoffeeTeX is an intriguing new option, based on a lot of unicode. It's a superset of latex math, so could be used harmlessly(?) with these proposals. TODO: take a deeper look.

Multiple syntaxes exist:

display
a = b

### Uberwriter

Uses pandoc for export, so supports $inline$ (with heuristic of no spaces on inside of the dollars), $$display$$ and raw \foo{...} and \begin{bar}...\end{bar}. Plus standalone ~subscript~ and ^superscript^ syntaxes.

The regular preview doesn't render math, but you can preview an individual formula by right-clicking it (Esc to close). This only works for dollar(s)-delimited math, not the other syntaxes pandoc recognizes.

### Remarkable

Didn't find clear documentation of math support. Changelog mentions pandoc-like ^superscript^, ~subscript~ and new "MathJax support (slightly buggy)". It seems $inline$, $$display$$ are the supported syntaxes. All the above work equally in preview, HTML and PDF export and are not confused by chars significant to markdown (like *) inside the math.

\$display\$ and \begin{foo}...\end{foo} also work (preview and export) but content that look like markdown markup breaks the rendering — I suppose these are incidental side effect of MathJax running on the full output. (I'll report the issue)

### Mark Text

The file syntaxes recognized are:

$inline$ and

$$display$$

• In preferences -> Markdown, there is a "GitLab compatibility" option that adds partial support for GitLab syntaxes (as of 2021-02, fenced math blocks supported but $inline$ not yet. https://github.com/marktext/marktext/issues/954)

• In preferences -> Markdown, can also enable support for pandoc subscript H~2~O & superscript 1^st^ syntax, and pandoc [^1] footnote syntax.

However, when editing the behavior is more complex structured editor... Typing on a blank line $$Enter is enough to create a display math block; but after that, it becomes impossible to manipulate the $$ delimiters — cursor can be either on a different line or inside the delimiters :-/

Can always use View->Source Code Mode menu to switch to markdown source & back into structured mode.

### Atom with markdown-preview-plus / markdown-preview-katex plugins

$inline$, $$display$$, $display$.

### VSCode builtin markdown preview

$inline$ (if not preceded nor followed by digit or ascii letter).
$$display$$.

Dollars can be escaped \$ to disable math meaning, and to include a dollar inside: $\frac{\$30}{\text{month}}$.
Uses KaTeX.

### "markdown preview enhanced" plugins for Atom and VSCode

Both powered by https://github.com/shd101wyy/mume which can use KaTeX or MathJax, with configurable delimiters. Default:

$inline$, $$inline$$.
$$display$$, $display$ or literal block:

math
display



### Texts.io

It's a semi-WYSIWYG editor: IIUC editing happens on a document model, which is then exported back into markdown. Most markdown syntaxes can be manually entered and are then auto-converted into the internal model — including $inline$ followed by Space and $$ followed by Enter. Since version 1.2 defaults to Kramdown-style $$
display
$$ and $$inline$$; it's possible to configure to use the older inline style. Not sure of exact criteria when $$ is display vs inline.

Conversions are generally Pandoc-powered.

display
display

### Markor

Need to enable (Settings -> Formats -> Markdown -> Math).

$inline$, $$display$$. Requires delimiters & formula to be on one line. Uses KaTeX.