Demo

maths

This blog has MathJax switched on (in the blog settings, under Text Rendering), so you can write formulas in TeX notation and they are typeset in the reader's browser.

Inline formulas

Wrap a formula in single dollar signs, or in \\( and \\):

Pythagoras: $a^2 + b^2 = c^2$, and Euler: \\(e^{i\pi} + 1 = 0\\).

Pythagoras: $a^2 + b^2 = c^2$, and Euler: \(e^{i\pi} + 1 = 0\).

Displayed formulas

Use double dollar signs, or \\[ and \\], for a formula on its own line:

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

\\[ \int\_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi} \\]

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

\[ \int_{-\infty}^{\infty} e^{-x^2} \, dx = \sqrt{\pi} \]

A sum and a matrix:

$$
\sum\_{k=1}^{n} k = \frac{n(n+1)}{2}
\qquad
\begin{pmatrix} a & b \\\\ c & d \end{pmatrix}
$$

$$ \sum_{k=1}^{n} k = \frac{n(n+1)}{2} \qquad \begin{pmatrix} a & b \\ c & d \end{pmatrix} $$

Markdown goes first

Your post is turned from Markdown into HTML before MathJax sees it, and Markdown has its own uses for some characters. That is why the examples above look a little odd:

  • A backslash in front of punctuation is a Markdown escape and disappears. Where TeX needs one, type two: \\(, \\[, \\{, and four for a line break, \\\\.
  • Underscores and asterisks can turn into italics. Write \_ and \* inside formulas.
  • A hyphen with spaces on both sides becomes a dash, so write b^2-4ac rather than b^2 - 4ac.
  • With dollar signs switched on, two prices in one paragraph look like a formula. Write \$ for a literal dollar sign: it costs \$5, or \$10 for two.

The editor's Preview shows the Markdown result but does not typeset formulas; open the published post to see those.

Where formulas don't render

MathJax runs on the blog's own pages. Elsewhere, for example in a Mastodon timeline, readers see the TeX source instead.

#maths #markdown

This is a demo post on qua.name; see About this demo.