Skip to content

Instantly share code, notes, and snippets.

@aslakr
Last active March 8, 2021 13:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslakr/606ac61badef25c42461735489cddef3 to your computer and use it in GitHub Desktop.
Save aslakr/606ac61badef25c42461735489cddef3 to your computer and use it in GitHub Desktop.
Testing syntax for using AsciiMath in Markdown
title date
Syntax for AsciiMath in Markdown
2016-04-05

What syntax should be used for AsciiMath in Markdown?

Using double backticks ``

When ``a != 0``, there are two solutions to
``ax^2 + bx + c = 0`` and they are

``x = (-b +- sqrt(b^2 - 4ac))/(2a)``

or $ and $$

When $a != 0$, there are two solutions to
$ax^2 + bx + c = 0$ and they are

$$x = (-b +- sqrt(b^2 - 4ac))/(2a)$$

The use of $$ have traditionally been used for TeX and this might make it problematic for reusing this when exchanging documents that have already used a TeX like syntax. Also `` will make the document readable even when the Markdown implementation doesn’t support AsciiMath.

I.e. it looks like this in a Markdown not supporting AsciiMath:

When a != 0, there are two solutions to ax^2 + bx + c = 0 and they are

x = (-b +- sqrt(b^2 - 4ac))/(2a)

while $/$$ looks like:

When $a != 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are

$$x = (-b +- sqrt(b^2 - 4ac))/(2a)$$

or even just $$

When $$a != 0$$, there are two solutions to $$ax^2 + bx + c = 0$$ and they are

$$x = (-b +- sqrt(b^2 - 4ac))/(2a)$$

(and TeX inside $/$$ looks like this:

When $a \ne 0$, there are two solutions to $ax^2 + bx + c = 0$ and they are

$$x = {\frac{-b \pm \sqrt{b^2-4ac}}{2a}}$$

https://github.com/cben/mathdown/wiki/math-in-markdown http://cdn.mathjax.org/mathjax/latest/test/sample-asciimath.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment