Skip to content
Beni Cherniavsky-Paskin edited this page Oct 22, 2023 · 57 revisions

Survey of Syntax for Math in MarkDown

$\alpha$

✏️ this is a wiki, everyone is welcome to contribute ✏️

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


Help needed: check and document these:

Madoko - great new entrant!;
Laverna; gistdeck; Swipe.to;
Bookdown;
LaTeX markdown package;
https://www.npmjs.com/package/gulp-markdown-equations (?);
https://www.npmjs.com/package/markdown-it-katex;
https://www.npmjs.com/package/markdown-it-asciimath;
https://www.npmjs.com/package/markdown-it-simplemath;
https://www.npmjs.com/package/markdown-it-texmath;
https://www.npmjs.com/package/markdown-it-synapse-math;
https://github.com/goessner/mdmath;
https://boostnote.io/; MarkDownEdit; various python-markdown extensions; https://facelessuser.github.io/pymdown-extensions/extensions/arithmatex/; Gitit; Markdig; https://wyam.io/modules/markdown (based on Markdig); Ornate; EME; b3log: https://github.com/b3log/solo/issues/12360, https://github.com/b3log/pipe/issues/134 (implemented, need to understand syntax)

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:

  1. dollars: $inline$ and $$display$$. Pro: same as LaTeX ($$ is deprecated TeX syntax but never mind), easiest to write. Con: prone to false positives like $20 — confusing to users who don't write math. There are frequently restrictions on when this is recognized.

  2. single backslash: \(inline\) and \[display\] Pro: same as LaTeX. Con: interferes with ability to escape parens and brackets e.g. \[this is not]\(a link)

  3. double backslash: \\(inline\\) and \\[display\\] Pro: doesn't interfere with escaping parens and brackets (introduced by MultiMarkdown for this reason). Con: non-standard, ugly.

  4. Literal-based syntaxes. Their upside is they are interpreted as literal text by engines that don't understand the syntax. This avoids runaway misformatting due to _ or *. I'd say this backward compatibility is not that important for converters (if you have a math-rich document, you'll not be happy with a converter that merely doesn't choke on it, you want the math to actually render) but a considerable win for editors.

  5. naked latex environment \begin{foo}...\end{foo}. Pro: simple way to include (almost) arbitrary raw latex.

  6. standalone sub/superscript outside math — unique to Pandoc AFAIK. Not worth the a separate syntax IMHO.

TODO: arrange this by goals, not syntaxes. TODO: discuss macros.

Converter Engines

reminder: LaTeX

Just a reminder: LaTeX itself supports $inline$, \(inline\), $$display$$ (deprecated), \[display\]. Also some environments enter math mode e.g. \begin{equation}...\end{equation}.

Escaping these is possible (with occasional complications) via \$ and \backslash / \textbackslash.

Macro definition appear outside math mode but usually affect math.

MultiMarkdown 2 used ASCIIMathML syntax within (only?) double backslashes.

MultiMarkdown 3 and 4 switched to LaTeX/MathJax syntax, within double backslashes (\\(inline\\), \\[ display \\]) as well as dollars ( $inline$ , $$display$$). For $inline$, in order to be correctly parsed as math, there must not be any space between the $ and the actual math on the inside of the delimiter, and there must be space on the outside.

It also support Pandoc-style superscript (y^(a+b)^) and subscript (x~y,z~). The trailing ^ or ~ delimiter is optional in simple cases.

By default dollars; optional support for single and/or double backslashes. $...$ constrained by heuristic: opening dollar not followed by space, closing not followed by number.

Smart enough to parse nested $y = x^2 \hbox{ when $x > 2$}$ as single formula.

Recognizes \begin{foo}...\end{foo} and \foo{...} without any extra delimiters. Supports macros — recognizes \def..., \newcommand... without any extra delimiters, pre-expands macros for non-latex output formats.

Also supports free-standing sub/superscripts: H~2~O is a liquid. 2^10^ is 1024.

Uses a version of pandoc's markdown, extended with AsciiMath (text enclosed by €...€ is treated as AsciiMath). It also allows embedding LaTeX straight into documents (the same way embedding direct html in markdown is supported), while html is not supported.

Compiles to latex and it's intended use is scientific document writing. It was developed to be used as a replacement of LaTeX for document typesetting, instead of for use as a replacement of markdown.

Scholdoc fork of pandoc

Scholdoc/ScholarlyMarkdown is notable as the most ambitious effort for science-friendly markdown, adding not just math but also numbered references, figures and other stuff. Note: it's an experiment in progress, "a stop-gap measure to quickly test out ideas".

As for math, it supports same dollar syntaxes as Pandoc, as well as literal-based syntaxes:

  • Exactly 2 backticks for inline math: ``a+b=c``. Recall that markdown allows any number of surrounding backticks, to delimit literals containing lesser sequence(s) of backticks. It's almost backward compatible (usage of 2 backticks is quite rare), and you still can use 3 or more to write non-math literals containing backticks.

    The ScholarlyMarkdown use of literal inline delimiters allows for math expressions to prepend numbers, such as \approx5 meters. In contrast, $\approx$5 meters will fail to be recognized as math (as in Pandoc).

  • Fenced literal of math "language" for display blocks, also supporting optional label which can be refernced:

    ```math #yourmathlabel
    a + b = c
    ```
    
    Can be referenced with [#yourmathlabel] — rendered as 1, or (#yourmathlabel) — rendered as (1).
    
    • Display math is automatically wraped in gathered [aligned] environment if it contains \\ (and &) symbols. If you want to disable this behavior, use the math_plain "language".
  • Fenced block of math_def "language" for macro definitions (and I presume other stuff legal in latex preamble?) — whereever it appears in the markdown source, it will be parsed first in the output (nice e.g. if you want to use the macro in the document's title):

    ```math_def
    \newcommand{\foo}{Foo}
    ```
    

The markdown renderer for Julia-language docstrings similarly uses `` for inline LaTeX equations and math ``` for display-mode equations.

Rather clever single syntax: $$ ... $$ is display math if alone in a paragraph, inline if on same line with other content; $$\begin{foo}...\end{foo}$$ outputs raw \begin{foo}...\end{foo} without wrapping in math delimiters.

Criticism: https://github.com/GitbookIO/kramed/issues/3 This syntax has no way to express display math in middle of paragragh:

That sounds contradictory, but due to the fact that it is accepted to treat mathematics as part of sentences, it totally makes sense for mathematical equations, even display/block mathematics, to be inside a paragraph.

Fork of marked. Same as kramdown: dual use of $$...$$ for inline and display.

Another fork of marked. Dollars within literals: `$inline$`, `$$display$$` — but also in literal blocks:

    $inline typesetting but on its own line?$

and:

    $$display$$

[source -> output]

(My personal opinion is that this is not such a great idea because it makes it hard to use the dialect to describe its own math syntax — in general it breaks the "literals are never processed" axiom. But that applies to some other literal-based syntaxes, and must be weighed against the tool-compatibility benefit...)

With HOEDOWN_EXT_MATH (--math), supports \\(inline\\), \\[display\\], and Kramdown style $$dwim$$ syntax automatically interpreted as inline or display. With HOEDOWN_EXT_MATH_EXPLICIT added (--math --math-explicit), also parses $inline$ and double dollars become $$always block$$. [I might be wrong, has no docs]

Forked from Hoedown, code diverged a lot. $inline$, $$display$$ and a syntax for numbered equation display:

@equation(id)
x = \sum_{i=1}{N} i
@/

Off by default, math extension has to be enabled.

$inline$, $$display$$, \[display\]. Supports a unique nicer syntax for referencing equations:

Consider (eq:a):

$$ \alpha = \beta $$        (a)

(\label and \eqref also work)

recommonmark parser for Docutils and Sphinx

```math
display
```

and ``$ y=\sum_{i=1}^n g(x_i) $``

MyST parser for Docutils and Sphinx

$$
display
$$

and $inline$.

Also supports generic syntax for any reStructuredText directive/role, so:

```{math}
display
```

and {math}`inline` work as well.

[Not a converter in itself but powers math in most online apps.]

Configurable delimiters — by default \(inline\), $$display$$, \[display\]. Smart enough to parse $y = x^2 \hbox{ when $x > 2$}$. as one expression. Supports backslash-escaping to prevent parsing as math.

Recognizes \begin{foo}...\end{foo} without any extra delimiters. Supports macros — recognizes \def..., \newcommand... without any extra delimiters.

Can also support MathML and AsciiMath — depends on configuration.

Much faster (and smaller) than MathJax but supports considerably less constructs so far. Doesn't yet recognize math by any delimiter, need to call function per math fragment. Notable for outputting stable HTML+CSS+webfont that work on all modern browsers, so can run during conversion and work without javascript on client. (MathJax 2.5 also has "CommonHTML" output but it's bad quality, only usable as preview; the closest server-side option is MathJax-node outputing SVG.)

Not yet used much with markdown.

ikiwiki with mathjax plugin

Both display ($$...$$ or [...]) and inline ($...$ or (...)) math are supported. Just take care that inline math must stay on *one line in your markdown source. A single literal dollar sign in a line does not need to be escaped, but two do.

(alternatively there is a pandoc plugin)

Dollars. (although their MathJax config also allows \( and \[?)

Single backslashes. Supports labels, \ref and \eqref.

Also supports but discourages Leanpub's {$$}...{/$$} syntax.

$inline$, requires consistent spaces (or punctuation) either outside or inside of the LaTeX dollar signs to distinguish them from regular text usage. $$display$$ as well as \begin{equation}...\end{equation} and friends without dollars.
Uses MathJax, so supports $\newcommand...$.

Mentions it also supports AsciiMath but unclear how (probably means you could config MathJax to parse AsciiMath instead of TeX)?

Markdown-it with markdown-it-math plugin

Markdown-it is JS CommonMark-compatible parser. markdown-it-math supports configurable delimiters, with some the restriction that block delimiters must stand on their own line; the defaults are notably unique:

$$inline$$

$$$
display
$$$

More importantly, the inner syntax is configurable (by passing alternative convertor) but defaults to AsciiMath, not TeX!

Markdown-it with markdown-it-katex plugin

This differs from the markdown-it-math plugin in that uses KaTeX for rendering, allowing it to work in browsers that don't support MathML (like Chrome).

Supports the standard pandoc syntax:

$inline$

$$
display
$$

based on markdown-it-math

$inline$, apparently also allows $$inline$$(?). Has unique syntax for display math with no closing delimiter:

$$$
A_{m,n} = \begin{pmatrix}
  ...
\end{pmatrix}

Lots of examples here.

$inline$ and $$display$$.

Python-markdown with various extensions

Pelican with render_math plugin

$inline$ as long as the closing $ is not preceded by space; $$display$$; \begin{foo}...\end{foo}. Apparently this plugin only deals with rendering, you also need a Python-markdown extension to protect _ etc in math from getting parsed as markdown — and the recognized syntaxes might not exactly match.

Reveal.js by has MathJax support and markdown support. To use them together, without bugs, put formula inside backticks:

`$inline$` and `\(inline\)`.

`$$display$$`
`\[display\]`

Can customize MathJax config, so can be configured to use other delimiters and even AsciiMath.

Same as Reveal.js — need to put math inside backticks.

mdBook, "Like Gitbook but implemented in Rust"

Optional support through MathJax, need to configure in book.toml.

As of v0.2.3, "The usual delimiters MathJax uses are not yet supported", need double backslashes: \\( inline \\), \\[ display \\], "Hopefully this limitation will be lifted soon." — so syntax is not stable yet. I suspect it has the usual math-after-markdown bugs...

Sites / Online Editors

To a large degree these rely on one of the above converters for math support.

Stack Exchange scientific sites such as mathoverflow, Physics.SE, Mathematics.SE and CSTheory.SE

$inline$, $$display$$. Also (undocumented?) recognizes \begin{foo}...\end{foo} without any delimiters but only for some environments, e.g. \begin{equation} works but \begin{matrix} requires surrounding dollars. Recognizes \newcommand and friends inside dollars.

  • Electrical Engineering.SE has a weird exception: single $ does not delimit inline math, \$...\$ does!?! ($$display$$ works as usual.)

Supports both literal-based and TeX-like syntax.

The inline literal was copied from GitLab's innovative choice: $`inline`$ + display with math "language":

```math
display
```

TeX style supports $inline$ with some undocumented heuristics ($10 to $20 is interpretted as plain text) and $$display$$.
Apperently the heuristics detect presence of valid math on line-by-line basis?

Rendered with MathJax.

Gitlab invented literal-based syntax with a novel twist: $`inline`$ which decays in other implementations to the literal TeX source surrounded by dollars – nice!
The great benefit is any existing parser already knows to ignore active markdown chars like _ inside, avoiding the frequent bugs when people hack in dollars support. You can actually correctly render this style in post-processing, without touching a parser at all 💖

Display is blocks with math "language":

```math
display
```

Later (fully enabled v15.8), I suppose following GitHub, they added $inline$ (with undocumented heuristics, slightly different from GitHub!) and $$display$$ support as well.

Rendered with KaTeX.

Dollars. Smart enough to parse $y = x^2 \hbox{ when $x > 2$}$. as one expression. \begin{foo}...\end{foo} outside dollars also works. Also recognizes \\\\(inline\\\\) (yep, that's 4 backslashes) and \\[display\\] but I'm not sure they're intentional.

Dillinger.io

$$inline$$.
Uses markdown-it-math library. Apparently recognizes $$$display$$$ but renders it in inline style as well; if real support for distinct inline vs display arrives, syntax may change.

Also support pandoc's standalone ^superscript^ and ~subscript~ syntaxes (markdown-it-sub, markdown-it-sup libraries).

Classeur.io by author of StackEdit.

$inline$, $$display$$, \\(inline\\), \\[display\\] — only the dollar forms are documented.
$inline$ limited by heuristicts akin to pandoc — opening $ can't be followed by space, closing $ can't be preceded by space nor followed by digit. Other 3 syntaxes not limited in this way. All 4 can span lines.
Not rendered in editor (except for making delimiters grey), only in preview.

Also support pandoc's standalone ^superscript^ and ~subscript~ syntaxes (these are also styled in the editor).

Uses https://github.com/classeur/markdown-it-mathjax, markdown-it-sub, markdown-it-sup and others.

(open/proprietary forked from same codebase, explanation here)

$inline$, $$display$$, \\(inline\\), \\[display\\] — only the dollar forms are documented.
$inline$ limited by heuristicts akin to pandoc — opening $ can't be followed by space, closing $ can't be preceded by space nor followed by digit. Other 3 syntaxes not limited in this way. All 4 can span lines.
Also supports \begin{foo}...\end{foo}.

Same syntax as Classeur because both use https://github.com/classeur/markdown-it-mathjax.

Marxi.co (Based on Stackedit; uses SVG to store HTML with math in Evernote.)

Dollars. Smart enough to parse $y = x^2 \hbox{ when $x > 2$}$. as one expression. \begin{foo}...\end{foo} outside dollars also works.

$inline$, $$display$$. Backslash syntaxes \(inline\), \[display\] work too but not sure if documented. Powered by MathJax (with printing powered by pandoc) so also recognizes stuff like \begin{foo}...\end{foo} outside math delimiters.

$inline$, $$display$$.

The site supports (via pandoc) multiple input formats from AsciiDoc to Texile. In markdown it uses single backslash: \(inline\) and \[display\]. discussion

Converted by pandoc, compiled by latex. $inline$ and $$display$$. \begin{foo}...\end{foo} outside dollars also works.

Mixed: \(inline, only on one line\), and $$display, can be multi-line$$.

Dollars, double backslashes.

socrates.io

$$inline$$, $$$display$$$. Suffers from markdown-symbols-in-math bug.

Beegit

Undocumented but seems to support \\(inline\\), $$display$$, \\[display\\] as well as \begin{foo}...\end{foo}.

{$$}...{/$$}. Used for both inline and display (if the math stands alone in a paragraph).

Draft Markua spec

Markua is a successor to Leanpub Flavored Markdown but published as a neutral spec; independent implementations are beginning e.g. https://github.com/dshafik/markua.

Inline math is represented using {math: mathml}...{/math: mathml} and {math: latex}math here too!{/math: latex}.
There is also the {$$}...{/$$} shorthand which uses the default math language (see below). In addition to this, there is `...`$ for latex.

Display math is represented using {math: latex} or {math: mathml} attributes before a code block:

{math: latex}
```
\left|\sum_{i=1}^n a_ib_i\right|
\le
\left(\sum_{i=1}^n a_i^2\right)^{1/2}
\left(\sum_{i=1}^n b_i^2\right)^{1/2}
```

There is also a shorthand — starting a code block with ```math will use the default math language. Additionally, ```$ will do the latex.

The default math language in a Markua document is determined by the value of the math attribute which is set in the metadata; if unset it's latex.

Supported via https://github.com/GitbookIO/plugin-mathjax or https://github.com/GitbookIO/plugin-katex plugins. Both use kramdown-style double-duty $$inline$$ (among other text) and $$display$$ (alone in paragragh), but the exact rule is different:

With GitBook, inline math are differentiated from block math using the first character, example:

Some inline math $$a = b$$

And a block of math:
$$
a = b
$$

The desktop GitBook editor supports the same syntax.

[At some point Gitbook's online editor didn't exactly match the rule — TODO: retest].

Dollars. $$display math$$ delimiters only recognized at start/end of line (can be combined with markdown constructs e.g. > - $$quoted listed math$$ but not text $$math$$.). Both kinds of math can be split across lines.

(Need to choose "Enable LaTeX" from gear menu)

Only $$inline$$ — yep, only inline math in double dollars. (can use $$\displaystyle ...$$ workaround) Uses KaTeX.

$$inline$$ and fenced block for display:

``` math
Displayed
```

Discourse with discourse-mathjax plugin

$inline$, $$display$$, \(inline\), \[display\].

$inline$, $$display$$, \[display\]. The internal math syntax is itex2MML — has some intentional differeces from TeX.

Also supports theorem-like environments and references to numbered equations as (eq:label) or \eqref{label} and embedded SVG as \begin{svg}<svg...</svg>\end{svg}. See https://golem.ph.utexas.edu/wiki/instiki/edit/Sandbox for details.

Math support has to be enabled by including [gimmick: math]() anywhere in the page. \\(inline\\) and $$display$$.

Literal-based syntax:

Display:
```mathjax
x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
```

Inline: `$a^2 + b^2 = c^2$`.  AFAICT, there is no way to write a literal starting and ending in dollars that won't be interpreted as math.

This resembles Scholdoc's syntax, but I'd say Scholdoc's is better thought out.

Kramdown-style $$...$$ for both inline and display — centered if alone on the line. Also ```math or ```latex or ```katex (all equivalent) literal blocks for display. (There are still some bugs with centering != displaystyle.)

MarkdownNotes.com

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

$inline$, $$display$$.

Help (Ctrl+Shift+H) documents $inline$, $$display$$. Currently also supports \\\\(inline\\\\) and \\[display\\], unclear if intentional. Supports \begin{foo}...\end{foo} outside math delimiters.

Conversion/preview engine based on StackExchange's code.

Only $$...$$ syntax, display by default but can start math with \inline e.g. $$\inline x^2$$.

Math is rendered on server, by a real Tex Live, so supports crazy stuff like tikz pictures! Renders to sharp svg, no blurry images.

Mathdown by yours truly

Dollars and backslashes. Tries to recognize LaTeX without delimiters like Pandoc but not very robust: \begin{foo}...\end{foo}, \[re]newcommand...} (greedy till last } on the line).

All this only works when the delimiters & math are written on a single line, but I consider that a bug.

Jupyter (previously: IPython Notebook)

$inline$, $$display$$.

Need to activate MathJax in PITCHME.yaml.

Based on Reveal.js, same syntax — put math inside backticks:

`$inline$` and `\(inline\)`.

`$$display$$`
`\[display\]`

It's WYSIWYG, but auto-formats when you type a lot of markdown syntaxes. To insert inline math type $$ (becomes $$|$$), the formula, and press Enter (or move outside with cursor keys). To edit, click, or select with arrow keys and press Enter (after editing press Enter again to render).

There is no display math (can use \displaystyle hack inside formula, but won't get centered). Uses KaTeX.

Has markdown export, uses $$inline$$ syntax.

Browser extensions

Markdown Here browser extension

$inline$.
The documentation has a couple of $\[display\]$ examples which work but AFAICT this is not officially intended; the author has mentioned the idea of supportting $$display$$ in the future.
Markdown Here itself only recognizes the outer $...$ syntax; the inner \[...\] syntax works with the default configuration which is to render math via Google Charts API, but this default might change.

Markdown Preview Plus chrome extension

By default nothing.

  1. If "MathJax" option is enabled: $$display$$, \\(inline\\), \\[display\\], environments e.g. \begin{equation}...\end{equation}.
  2. Additionally if "LaTeX delimiters" is also enabled: $inline$, \(inline\), \\[display\\].

Defaults off, need to enable "mathjax" option.
$inline$ and \(inline\), $$display$$ and \[display\].

Desktop editors

$inline$, $$display$$, H~2~O subscripts, 2^10^ superscripts. Preview powered by markdown-it with plugins, export by Pandoc.

R Studio R Markdown v2

Based on Pandoc. $inline$ (without space between the $s and the math), $$ display $$. Also supports raw MathML (<math>...</math>). Also superscript^2^ syntax is mentioned in v1->v2 migration doc, so I presume pandoc's subscript~2~ is also supported.

I didn't test this but I have a suspicion the "no space between $ and math" rule was quoted from pandoc doc which is not exactly what pandoc actually implements.

Backslashes, dollars, and WordPress-inspired $latex ...$ and $$latex ... $$ syntaxes. Also supports raw MathML.

Based on pymarkups. $inline$, \(inline\), $$display$$, \[display\] as well as \begin{foo}...\end{foo}.

$inline$ and $$display$$.

Uses Hoedown. Math support is optional, has 2 modes:

  • \\(inline\\), \\[display\\], $$dwim$$ (either inline or display depending on context).
  • \\(inline\\), \\[display\\], $inline$, $$display$$.

Also documented to support MathML [this simply follows from markdown's *ML pass-through plus MathJax (TeX-AMS-MML_HTMLorMML config) rendering MathML even on browsers that don't support it].

Has to be enabled in Preferences (General tab > Enable Mathematics Expression). Can choose between $$$inline$$$ or $inline$ syntax; either way supports $$display$$. Also supports pandoc-like ^superscript^, ~subscript~.

See also Korean doc about math and examples.

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.

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)

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.

$inline$, $$display$$, \[display\].

$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.

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
```

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$$ and $$$inline$$$.

An older version documented \\(inline\\) and \\[display\\] plus requirement to convert double backslashes to triple (\\[\begin{vmatrix} ... \\\ ... \end{vmatrix}\\]); don't know if that's still supported.

Need to enable View -> Math Rendering option. Supported in all modes, not only in markdown files. $inline$, $$display$$.

Inkdrop with math plugin

$inline$,

$$
display
$$

and

```math
display
```

Typora has math support (see Math and Academic Functions). Both $inline$ and $$inline$$ would introduce inline math (according to the DOM, tested under Linux and macOS.). One would need to type $$ followed by an Enter for display math.

$inline$ could be enabled in the preference panel (default off), Typora also support mhchem for chemistry expressions.

MathJax syntax is supported (tested on macOS).

$$inline$$, $$$ display $$$. Uses KaTeX. Renders math inside the editor.

$inline$ with some undocumented heuristics — apparently opening $ must not be followed by space, closing $ must not be preceded by space nor followed by a digit.
$$display$$.
Uses MathJax.

$inline$, $$display$$.

$inline$,

$$
display
$$

When Math Rendering enabled (using MathJax) it supports $inline$, \(inline\), $$display$$ and \[display\]. This editor allows you to add CSS and JS "script assets" and a callback that will be called on update, which allows you to drop in KaTeX and support other styles (e.g. GitLab math)

Marp presentation editor

$inline$ and $$display$$ (there must be no text on same line before/after display).

Deckset presentation editor

kramdown-style $$inline$$ and

$$
display
$$

Slideas presentation editor

kramdown-style $$inline$$ and

$$
display
$$

Marked 2 previewer

Not an editor, just a live previewer refreshing every time you save. Defaults to MultiMarkdown's \\(inline\\), \\[display\\]. Uses MathJax so can be configured to use other delimiters (and any other MathJax options).

Emacs with markdown-mode.el with markdown-enable-math turned on

Highlights (and doesn't parse as markdown) $..$, $$..$$, or \[..\]. But that's all.

Emacs MGL-PAX lisp doc generator

[Not sure PAX belongs under "editors" but apparently it's a common lisp markdown docstrings -> HTML generator that runs under Emacs(?)] $inline$, $$display$$.

Qute

Apparently anything MathJax would recognize — dollars, backslashes, some latex constructs without math delimiters...

Qute is no longer developed, but I mention it fondly as its per-paragraph source/rendered toggling was one of the inspirations for Mathdown's in-place formatting and math rendering (the other was Emacs with preview-mode).

Mail clients

[Untested: mailmate has "raw" and "markdown" modes; doc sounds like this syntax works in both but didn't check.]

~~~asciimath
((n(n+1))/2)^2
~~~

~~~texmath
{\frac{n(n+1)}{2}}^2
~~~

(and ~~~math shorthand if you only enable one of the syntaxes in preferences)

Inline with double backticks: ``a^2 + b^2 = c^2``

Mobile apps

Double backslashes (powered by MultiMarkdown).

\\(inline\\), \\[display\\], $$display.

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

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


Dead

notepag.es

%%inline%%, $$display$$.
https://web.archive.org/web/20110914060605/http://notepag.es/latexdemo, https://github.com/fivesixty/notepages/issues/22, http://chris-spencer.co.uk/2011/03/11/notepag.es-a-markdown-and-LaTeX-notepad/


Appendix: summary table

LaTeX Escaped “Smart”
Naked
LaTeX
$ $$ \( \[ \$ \\( \\[ $$
Editors/Notebooks
Jupyter 💚 💚 💔 💔 💔 💔 💔 💔 💛
SageMathCloud 💚 💚 💚 💚 💔 💔 💔 💔 💛
RStudio 💚 💚 💔 💔 💔 💔 💔 💔 💔
VSCode (via ext.) 💚 💚 💛 💛 💔 💔 💔 💛 💔
Q&A sites
MathOverflow 💚 💚 💔 💔 💔 💔 💔 💔 💛
Math.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
Physics.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
CS.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
CSTheory.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
Chemistry.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
Electronics.SE 💔 💚 💔 💔 💚 💔 💔 💔 💛
Crypto.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
Stats.SE 💚 💚 💔 💔 💔 💔 💔 💔 💛
IM/forums
Gitter 💔 💚* 💔 💔 💔 💔 💔 💔 💔
Discourse 💚 💚 💚 💚 💔 💔 💔 💔 💛
Converters
MultiMarkdown 💚 💚 💔 💔 💔 💚 💚 💔 💔
Pandoc 💚 💚 💛 💛 💔 💛 💛 💔 💔
Kramdown 💔 💔 💔 💔 💔 💔 💔 💚 💔
Hoedown 💛 💛 💔 💔 💔 💚 💚 💚 💔
Maruku 💚 💚 💔 💚 💔 💔 💔 💔 💔
 
$ $$ \( \[ \$ \\( \\[ $$ naked

Appendix: notable non-markdown tools

  • ReLaXed Uses "pug" language which allows embedding :markdown-it blocks (example). \\(inline\\), $$display$$. Not sure if this only works inside markdown or everywhere (I think MathJax just processes everything).

  • Jemdoc (you probably want its MathJax variant): $inline$ and \(display\).

    Yes, round brackets instead of square brackets---this is to avoid a conflict with ordinary square brackets that are escaped to avoid being a link. Sorry.

  • Mathflowy chrome extension for math in Workflowy: \(inline\), \[display\].

Appendix: Testing syntaxes

Testing It costs between $10 and $20.: http://johnmacfarlane.net/babelmark2/?normalize=1&text=It+costs+between+%2410+and+%2420. Only Maruku (Math-Enabled) recognized it as math.

Testing various syntaxes: http://johnmacfarlane.net/babelmark2/?normalize=1&text=Inline%3A+%24dollar+%5Csqrt%7Bx%7D%24%2C+%5C(single+backslash+%5Csqrt%7Bx%7D%5C)%2C+%5C%5C(double+backslash+%5Csqrt%7Bx%7D%5C%5C).%0A%0ADisplay%3A+%24%24double+dollar+%5Csqrt%7Bx%7D%24%24%2C+%5C%5Bsingle+backslash+%5Csqrt%7Bx%7D%5C%5D%2C+%5C%5C%5Bdouble+backslash+%5Csqrt%7Bx%7D%5C%5C%5D.%0A

See also

Clone this wiki locally